Implementation of the paper Self-ensembling for visual domain adaptation, accepted as a poster at ICLR 2018.
For photographic datasets such as The VisDA visual domain adaptation challenge and the Office dataset.
For the small image experiments go to https://github.com/Britefury/self-ensemble-visual-domain-adapt/.
You need to specify where your datasets can be found on your machine;cCreate a file called
contains the following (note that you can skip e.g. the Office paths if you don't intend to run the Office
[paths] visda17_clf_train=<path_to_visda_train> visda17_clf_validation=<path_to_visda_validation> visda17_clf_test=<path_to_visda_test> office_amazon=<path_to_office_amazon> office_dslr=<path_to_office_dslr> office_webcam=<path_to_office_webcam>
The main experiment file is
experiment_selfens_meanteacher.py. Invoking it with the
--help command line argument
will show you the command line options.
To replicate our results, invoke the shell scripts.
To train a ResNet-152 based network on the training and validation sets:
sh run_visda17_trainval_resnet152.sh <GPU> <RUN>
<GPU> is an integer identifying the GPU to use and
sh run_visda17_trainval_resnet152.sh 0 01
Will run on GPU 0 and will generate log files with names suffixed with
To train a ResNet-152 based network on the training and validation sets using basic augmentation:
sh run_visda17_trainval_resnet152_basicaug.sh <GPU> <RUN>
To train a ResNet-152 based network on the training and validation sets using minimal augmentation:
sh run_visda17_trainval_resnet152_minaug.sh <GPU> <RUN>
To train a ResNet-50 based network on the training and validation sets:
sh run_visda17_trainval_resnet50.sh <GPU> <RUN>
To train a ResNet-152 based network on the training and validation sets using minimal augmentation using supervised
sh run_visda17_trainval_sup_resnet152_minaug.sh <GPU> <RUN>
There are similar experiments for the training and test set.
Running the experiments will generate 3 output files; a log file, a prediction file and a model file. The log file will contain a copy of the training output that was printed to the console. The prediction will will contain the history of predictions generated during training. The model file will contain the network weights.
To generate a submission file suitable for submission to the VisDA-17 CodaLab site, use the program
There are two 'bugs' that are used in our VisDA experiment.
You will need:
First, install OpenCV and PyTorch as
pip may have trouble with these.
On Linux, install using
> conda install opencv
On Windows, go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and download the OpenCV wheel file and install with:
> pip install <path_of_opencv_file>
> conda install pytorch torchvision -c pytorch
> conda install -c peterjc123 pytorch cuda90
Use pip like so:
> pip install -r requirements.txt