domainadaptation / salad

A toolbox for domain adaptation and semi-supervised learning. Contributions welcome.
https://domainadaptation.org
Mozilla Public License 2.0
333 stars 42 forks source link

Implementation of AutoDIAL: Automatic DomaIN Aignment Layers #21

Open Lan1991Xu opened 5 years ago

Lan1991Xu commented 5 years ago

Hi. Thanks for sharing code. I just check: class salad.layers.da.AutoAlign2d. It seems using original Batchnorm2D, any misunderstanding here.

stes commented 5 years ago

Hi @Lan1991Xu , thanks for flagging this, it is indeed not yet implemented, but it should be straightforward to do so. A similar (or related) functionality (conditional batch norm) was used in the conditional model used in my experiments here. I will think about how to best integrate this in the correct way into salad.

Lan1991Xu commented 5 years ago

Thanks.Do you means conditional batch norm here. https://github.com/domainadaptation/salad/blob/190e3507d111967c61a8973fcf15d1a9c4e728ce/salad/models/digits/ensemble.py. By the I also check the conditional model you mentioned in the link. It seems it has submit to NIPS workshop. Have you publish on the Arxiv? it would be good I can get access for the paper to better understand. Currently my understand is : it using compute_linear in test after we trained the model. To implement AutoAlign2d, we need calculate mean and variance of each BN by a linear transferform spastic information between the source and target. Is this understanding right. Thanks.

stes commented 5 years ago

Thanks.Do you means conditional batch norm here.

Yes, that would be an example on how to use it. Another one (in the context of ResNet for larger images) can be found here.

They way it is implemented so far is by extending the forward function by a domain param, hence the function signature forward(self, x, d). Depending on d, different batch norm statistics will be updated and a different affine transform is used. This functionality is however not yet well integrated into the use with all the implemented domain adaptation algorithms.

By the I also check the conditional model you mentioned in the link. It seems it has submit to NIPS workshop. Have you publish on the Arxiv?

We don't currently have a pre-print available, but I will link the paper once we integrated feedback from the review process, that should be sometime mid-November.

To implement AutoAlign2d, we need calculate mean and variance of each BN by a linear transferform spastic information between the source and target. Is this understanding right. Thanks.

AFAIK, the layer was first proposed here. To break it down:

Regarding the loss functions, the authors use entropy minimization on the target domain, which is already implemented in salad:

image

Regarding the layers, you are right (if I got your comment right): image

where the different q are mixing distributions:

image

So actually, the algorithm can be straightforwardly implemented, I will see if I find some time in the near future.