Pytorch implementation of the joint task of image classification on CIFAR10 of different styles and style transfer, where CIFAR10 is the source domain and CARLA, GTA5 Dataset and Van-Gogh images (from internet) are target domains respectively.
-
Download the GTA5 Dataset
-
Download the CARLA Dataset
-
Download the Van-Gogh images
-
The used model architecture is defined in ./classification/models.py
-
To train classifiers with different datasets, specify the dataroot of the corresponding training set in ./classification/cifar_train.py
python ./classification/cifar_train.py
- To test the trained model for classification task, specify the dataroot of the correspongding test set in ./classification/cifar_test.py
python ./classification/cifar_test.py
- CycleGAN is used to perform this task. Clone this repo and follow the instructions to install necessary tools and modules.
In the original code, the model requires the input source and target domain images to have the same size. Since the images of these two domains differ greatly in image size, so replace the ./cyclegan/data/unaligned_dataset.py in CycleGAN with ./modifications/unaligned_dataset.py in this repo. This enables the target domain images to be resized before cropped to a small image size. The resized target size is controled by the argument loadSize, please choose a reasonable value for different target domains. In ./modifications/unaligned_dataset.py, A represents source domain and B represents target domain. Please give the corresponding paths to the datasets of the two domains.
Also replace ./cyclegan/scripts/train_cyclegan.sh in CycleGAN with ./modifications/train_cyclegan.sh in this repo.
./cyclegan/scripts/train_cyclegan.sh
The relevant training arguments can be found in ./cyclegan/options/train_options.py and ./cyclegan/options/train_options.py
Replace ./cyclegan/scripts/test_cyclegan.sh in CycleGAN with ./modifications/test_cyclegan.sh in this repo.
./cyclegan/scripts/test_cyclegan.sh