Contrast and Mix (CoMix)
The repository contains the codes for the paper Contrast and Mix: Temporal Contrastive Video Domain Adaptation with Background Mixing part of Advances in Neural Information Processing Systems (NeurIPS) 2021.
Aadarsh Sahoo1, Rutav Shah1, Rameswar Panda2, Kate Saenko2,3, Abir Das1
1 IIT Kharagpur, 2 MIT-IBM Watson AI Lab, 3 Boston University
Fig. Temporal Contrastive Learning with Background Mixing and Target Pseudo-labels. Temporal contrastive loss (left) contrasts a single temporally augmented positive (same video, different speed) per anchor against rest of the videos in a mini-batch as negatives. Incorporating background mixing (middle) provides additional positives per anchor possessing same action semantics with a different background alleviating background shift across domains. Incorporating target pseudo-labels (right) additionally enhances the discriminabilty by contrasting the target videos with the same pseudo-label as positives against rest of the videos as negatives.
Preparing the Environment
Conda
Please use the comix_environment.yml file to create the conda environment comix as:
conda env create -f comix_environment.yml
Pip
Please use the requirements.txt file to install all the required dependencies as:
pip install -r requirements.txt
Data Directory Structure
All the datasets should be stored in the folder ./data following the convention ./data/<dataset_name> and it must be passed as an argument to base_dir=./data/<dataset_name>.
UCF - HMDB
For ucf_hmdb dataset with base_dir=./data/ucf_hmdb the structure would be as follows:
