ZhangJUJU / JDDA

Code for the paper Joint Domain Alignment and Discriminative Feature Learning for Unsupervised Deep Domain Adaptation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JDDA

Joint Domain Alignment and Discriminative Feature Learning for Unsupervised Deep Domain Adaptation

This repository contains code for reproducing the experiments reported in the paper Joint Domain Alignment and Discriminative Feature Learning for Unsupervised Deep Domain Adaptation. In the source code, the JDDA_C is denoted by 'center_loss' in Digital_JDDA_C and the JDDA_C is denoted by 'Manifold' in Digital_JDDA_I.

train JDDA

This code requires Python 2 and implemented in Tensorflow 1.9. You can download all the datasets used in our paper from here and place them in the specified directory.

Digital Domain Adaptation

cd Digital_JDDA_I or Digital_JDDA_C
python trainLenet.py

Office-31 Domain Adaptation

  • Create a txt file for the image path of the Office dataset as shown in amazon.txt
  • Download the ResNet-L50 pre-training model
cd Office_JDDA_C or Office_JDDA_I/JDDA_I
python train_JDDA.py

train Compared Approaches

We mainly compare our proposal with DDC, DAN,DANN, CMD, ADDA and CORAL

If you want to use these methods, you can modify them in trainLenet.py.

93        self.CalDiscriminativeLoss(method="CenterBased")
94        self.CalDomainLoss(method="CORAL")

or in train_JDDA.py

84    # domain_loss=tf.maximum(0.0001,KMMD(source_model.avg_pool,target_model.avg_pool))
85    domain_loss=coral_loss(source_model.avg_pool,target_model.avg_pool)
86    centers_update_op,discriminative_loss=CenterBased(source_model.avg_pool,y)
87    # domain_loss = mmatch(source_model.avg_pool,target_model.avg_pool, 5)
88  # domain_loss = log_coral_loss(source_model.adapt, target_model.adapt)

The results (accuracy %) for unsupervised domain adaptation can be seen here image

t-SNE visualization

If you want to use t-SNE visualization, you can open the comment in train_JDDA.py

94  # self.conputeTSNE(step, self.SourceData,  self.TargetData,self.SourceLabel, self.TargetLabel, sess)

image

About

Code for the paper Joint Domain Alignment and Discriminative Feature Learning for Unsupervised Deep Domain Adaptation


Languages

Language:Python 98.8%Language:Shell 1.2%