Need help with JigenDG?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

197 Stars 37 Forks GNU Affero General Public License v3.0 96 Commits 14 Opened issues


Repository for the CVPR19 oral paper "Domain Generalization by Solving Jigsaw Puzzles"

Services available


Need anything else?

Contributors list



Repository for the CVPR19 oral paper "Domain Generalization by Solving Jigsaw Puzzles". To cite, please use:

  title={Domain Generalization by Solving Jigsaw Puzzles},
  author={Carlucci, Fabio Maria and D'Innocente, Antonio and Bucci, Silvia and Caputo, Barbara and Tommasi, Tatiana},


Pytorch models will automatically download if needed. You can download the caffemodel we used for AlexNet from here

Once downloaded, move it into models/pretrained/alexnet_caffe.pth.tar

Once you have download the data for the different experiments, you must update the files in data/txtlist to match the actual location of your files. For example, if you saved your data into /home/user/data/images/ you have to change these lines: ``` /home/fmc/data/PACS/kfold/artpainting/dog/pic001.jpg 0 /home/fmc/data/PACS/kfold/artpainting/dog/pic002.jpg 0 /home/fmc/data/PACS/kfold/artpainting/dog/pic_003.jpg 0 ``` into:

/home/user/data/images/PACS/kfold/art_painting/dog/pic_001.jpg 0
/home/user/data/images/PACS/kfold/art_painting/dog/pic_002.jpg 0
/home/user/data/images/PACS/kfold/art_painting/dog/pic_003.jpg 0

A quick way is to use sed:

for i in *.txt; do sed -i "[email protected]/home/fmc/data/@/home/user/data/images/@g" $i; done

Running experiments

Run to run the DG experiment on PACS, with photo as target (using AlexNet).

Note that when using ResNet you should set the imagesize to 222 An example on how to get ResNet18 results on PACS, artpainting as target:

python --batch_size 128 --n_classes 7 --learning_rate 0.001 --network resnet18 --val_size 0.1 --folder_name test --jigsaw_n_classes 30 --train_all True --TTA False --nesterov False --min_scale 0.8 --max_scale 1.0 --random_horiz_flip 0.5 --jitter 0.4 --tile_random_grayscale 0.1 --source photo cartoon sketch --target art_painting --jig_weight 0.7 --bias_whole_image 0.9 --image_size 222


Some people are having issues accessing the VLCS dataset; I have uploaded a copy here:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.