tensorflow implement of ADDA (paper)
tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=cls, labels=Y))
log(D(Ms)) + log(1-D(Mt))
tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=D_source_logits, labels=tf.ones_like(D_source_logits)))
log(D(Mt))
tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=D_target_logits, labels=tf.zeros_like(D_target_logits)))
To generate MNIST-M dataset, first download BSDS500 dataset to "_data/mnist_m/BSR_bsds500.tgz"
Then run create_mnistm.py which is from github
python create_mnistm.py
train Ms and Classifier with source dataset
python main.py --train=source --learning_rate=0.001 --epoch=1000 --threshold=0.05 --batch_size=30
the ckpt files are saved as ./_models/source/source.ckpt and ./_models/classifier/classifier.ckpt
Mt should be initializated with Ms. so copy the source.ckpt to target_pretrain folder and change the scope names.
cp ./_models/source/source.ckpt ./_models/target_pretrain/source.ckpt
cd ./_models/target_pretrain/source.ckpt
python source2target.py --checkpoint_dir=. --replace_from=source _cnn --replace_to=target_cnn
train Mt and Discriminator with source and target image.
python main.py --train=adda --learning_rate_D=0.001 --learning_rate_M=0.00001 --epoch=50 --threshold=0.96 --batch_size=30
the ckpt files are saved as ./_models/target/target.ckpt and ./_models/discriminater/discriminater.ckpt
python main.py --test=source
python main.py --test=adda