Domain-adversarial training / gradient reversal layer

1,373 views
Skip to first unread message

Marcel Bollmann

unread,
Jun 13, 2016, 4:41:52 PM6/13/16
to Keras-users
Hi everyone,

I'm wondering if and how the gradient reversal layer from the paper "Domain-Adversarial Training of Neural Networks" (http://arxiv.org/abs/1505.07818) can be implemented in Keras.

The "gradient reversal layer" as described there is a layer which passes input through unchanged, but during backpropagation multiplies all gradients by a constant (negative) factor.*

This sounds simple enough, but I'm still struggling to understand all the internals of Keras, and the way gradient calculation and backpropagation works is still a bit of a mystery to me. Any pointers or ideas would be highly appreciated.

(*For those wondering why one would do this, the idea -- in a nutshell -- is to have a network with two outputs, and train it so it learns to predict the first output well, while punishing features that help to predict the second one. This is intended for domain adaptation, where the second output predicts whether a given sample is from the source or the target domain, and the idea is to punish features that can discriminate between the two domains, thus leaving the model to focus on domain-independent features.)

Best regards,
- Marcel

ducha...@gmail.com

unread,
Jul 2, 2016, 5:57:38 AM7/2/16
to Keras-users

https://github.com/fchollet/keras/issues/3119#issuecomment-230044404

понеділок, 13 червня 2016 р. 23:41:52 UTC+3 користувач Marcel Bollmann написав:

chileh...@gmail.com

unread,
Apr 13, 2017, 10:10:02 PM4/13/17
to Keras-users
Did you happen to find a solution to this? I'm also trying to implement this in Keras. Any help/tip is appreciated!

Dmytro Mishkin

unread,
Apr 14, 2017, 9:37:58 AM4/14/17
to chileh...@gmail.com, Keras-users

--
You received this message because you are subscribed to a topic in the Google Groups "Keras-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/keras-users/QWe3xAkuBOg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/d37793aa-34e5-4e1d-ad2e-9117e7824248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards, Dmytro Mishkin
Reply all
Reply to author
Forward
0 new messages