VAE GAN
Par Eric Antoine ScuccimarraI started working on a variational auto-encoder (VAE) for faces a few months ago. I was easily able to make a non-variational autoencoder to reproduce images that worked incredibly well, but since it was not variational there wasn't much you could do with it other than compress images. I wanted to be able to play with interpolation and such, and for that you need a VAE. So I converted my auto-encoder to a variational one, but the problem was that the resulting images were very blurry and the quality wasn't all that great. So I thought maybe I could attach a GAN to this to make the images look more realistic. And I tried that but unfortunately it didn't work very well, the GAN was trying to produce to generate images of what it though were faces will the autoencoder was trying to reproduce its input, as seen in the images below:
After fighting with this for a few months I decided to try to make sure that the GAN was working properly before I added on the autoencoder, and although I had to fight with the GAN quite a bit and was never able to get it to generate really high quality images, I was sure that it was working properly. So I decided to try to hook it up to the autoencoder again.
Then I discovered this paper Autoencoding beyond pixels using a learned similarity metric, which does the same thing I was trying to do but in a much smarter way. What I had been doing was using the MSE between the input and the generated images for my VAE loss, and training both the encoder and the decoder with the GAN loss. Obviously this did not work.
What they do in the paper is basically separate the encoder and leave the decoder and discriminator as the GAN, which is trained as usual. I had tried to think of ways to train the encoder and decoder separately, but my ideas were much more primitive and didn't work at all. What they do that is train the encoder separately, using the KLD loss and - this is the brilliant part - instead of using MSE between the input and the recreation they use the MSE between a feature map from an intermediate layer of the discriminator for the real and faked images. So rather than trying to produce an exact duplicate of the input, the encoder is trying to produce something that the discriminator thinks is close to the input.
It took me a few hours to rewrite my code to make use of this new loss, and come up with a version that would be able to run without having to keep all of the graphs in memory and be able to train in a reasonable amount of time, and I think everything is finally working. Hopefully this works better than my previous attempts, and next time I will try to remember to review the literature before trying to implement a new idea on my own.
Libellés: pytorch, autoencoders, gan
Comments
Please login to comment
Dorothytom
Nov 23, 2019 at 07:30 pm |
[url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Spegra (ΠΠΎΠ»ΡΡΠ΅Π³Π»Π°Π²ΠΈΡ / Π’Π΅Π½ΠΎΡΠΎΠ²ΠΈΡ Π°Π»Π°ΡΠ΅Π½Π°ΠΌΠΈΠ΄ / ΠΠΌΡΡΠΈΡΠΈΡΠ°Π±ΠΈΠ½) - Π‘ΠΏΠ΅Π³ΡΠ° (Dolutegravir/ Taf / Emtricitabine)[/url] β ΡΡΠΎ Π»Π΅ΠΊΠ°ΡΡΡΠ²ΠΎ Π΄Π»Ρ Π»Π΅ΡΠ΅Π½ΠΈΡ Π»ΡΠ΄Π΅ΠΉ, ΠΊΠΎΡΠΎΡΡΠ΅ ΡΡΠΎΠ»ΠΊΠ½ΡΠ»ΠΈΡΡ Ρ ΠΠΠ§-1 ΠΈΠ½ΡΠ΅ΠΊΡΠΈΠ΅ΠΉ. Π‘ΠΈΠΌΠΏΡΠΎΠΌΡ Π·Π°Π±ΠΎΠ»Π΅Π²Π°Π½ΠΈΡ Π±ΡΡΡΡΠΎ ΠΈΡΡΠ΅Π·Π½ΡΡ, ΠΈ ΡΠΆΠ΅ ΡΠ΅ΡΠ΅Π· Π½Π΅ΠΊΠΎΡΠΎΡΠΎΠ΅ Π²ΡΠ΅ΠΌΡ ΠΠ°ΡΠ΅ ΠΎΠ±ΡΠ΅Π΅ ΡΠ°ΠΌΠΎΡΡΠ²ΡΡΠ²ΠΈΠ΅ Π·Π½Π°ΡΠΈΡΠ΅Π»ΡΠ½ΠΎ ΡΠ»ΡΡΡΠΈΡΡΡ: ΠΡ Π·Π°Π±ΡΠ΄Π΅ΡΠ΅ ΠΎ ΡΠΎΠΌ, ΡΡΠΎ ΡΠ°ΠΊΠΎΠ΅ Π±ΠΎΠ»ΠΈ ΠΈ Π΄ΠΈΡΠΊΠΎΠΌΡΠΎΡΡ. ΠΠ»Π°Π³ΠΎΠ΄Π°ΡΡ Π΄Π°Π½Π½ΠΎΠΌΡ Π»Π΅ΠΊΠ°ΡΡΡΠ²Ρ ΠΌΠΎΠΆΠ½ΠΎ ΠΈΡΠΊΠ»ΡΡΠΈΡΡ ΡΠΈΡΠΊ Π»Π΅ΡΠ°Π»ΡΠ½ΠΎΠ³ΠΎ ΠΈΡΡ ΠΎΠ΄Π°. ΠΡ ΠΌΠΎΠΆΠ΅ΡΠ΅ [url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Spegra (ΠΠΎΠ»ΡΡΠ΅Π³Π»Π°Π²ΠΈΡ / Π’Π΅Π½ΠΎΡΠΎΠ²ΠΈΡ Π°Π»Π°ΡΠ΅Π½Π°ΠΌΠΈΠ΄ / ΠΠΌΡΡΠΈΡΠΈΡΠ°Π±ΠΈΠ½) - Π‘ΠΏΠ΅Π³ΡΠ° (Dolutegravir/ Taf / Emtricitabine) ΠΊΡΠΏΠΈΡΡ[/url] Π² Π½Π°ΡΠ΅ΠΉ Π°ΠΏΡΠ΅ΠΊΠ΅ Π½Π° Π²ΡΠ³ΠΎΠ΄Π½ΡΡ ΡΡΠ»ΠΎΠ²ΠΈΡΡ . Π‘ΠΏΠ΅ΡΠΈΠ°Π»ΠΈΡΡΡ Π³ΠΎΠ²ΠΎΡΡΡ ΠΎ ΡΠΎΠΌ, ΡΡΠΎ ΠΏΠ΅ΡΠ΅Π΄ Π½Π°ΡΠ°Π»ΠΎΠΌ Π»Π΅ΡΠ΅Π½ΠΈΡ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎ ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ ΠΎΠ±ΡΠ°ΡΠΈΡΡΡΡ Π² Π±ΠΎΠ»ΡΠ½ΠΈΡΡ. ΠΡ ΡΠ΄Π°Π΄ΠΈΡΠ΅ Π½Π°Π·Π½Π°ΡΠ΅Π½Π½ΡΠ΅ Π°Π½Π°Π»ΠΈΠ·Ρ ΠΈ ΠΏΡΠΎΠΉΠ΄Π΅ΡΠ΅ Π΄ΠΈΠ°Π³Π½ΠΎΡΡΠΈΠΊΡ ΠΎΡΠ³Π°Π½ΠΈΠ·ΠΌΠ°. ΠΠΎΠΊΡΠΎΡΠ° ΡΠ°Π·ΡΠ°Π±ΠΎΡΠ°ΡΡ Π΄Π»Ρ ΠΠ°Ρ ΠΈΠ½Π΄ΠΈΠ²ΠΈΠ΄ΡΠ°Π»ΡΠ½ΡΡ ΡΡ Π΅ΠΌΡ ΡΠ΅ΡΠ°ΠΏΠΈΠΈ, ΠΊΠΎΡΠΎΡΠ°Ρ Π΄Π°ΡΡ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ ΠΏΠΎΠ»ΡΡΠΈΡΡ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ ΡΡΡΠ΅ΠΊΡ. <h2>ΠΠΎΠΊΠ°Π·Π°Π½ΠΈΡ ΠΊ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΡ</h2> ΠΡΠ΅ΠΏΠ°ΡΠ°Ρ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ Π² ΡΠΎΡΡΠ°Π²Π΅ ΡΡΠΈ Π°ΠΊΡΠΈΠ²Π½ΡΡ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ°, Π²ΡΠΏΠΎΠ»Π½ΡΡΡΠΈΡ Π°Π½ΡΠΈΡΠ΅ΡΡΠΎΠ²ΠΈΡΡΡΠ½ΡΠ΅ ΡΡΠ½ΠΊΡΠΈΠΈ. ΠΠ΅ΠΊΠ°ΡΡΡΠ²ΠΎ Π²ΠΎΠ·Π΄Π΅ΠΉΡΡΠ²ΡΠ΅Ρ Π½Π° ΠΎΡΠ³Π°Π½ΠΈΠ·ΠΌ ΠΊΠΎΠΌΠΏΠ»Π΅ΠΊΡΠ½ΠΎ, ΠΏΠΎΡΡΠΎΠΌΡ ΠΡ ΡΠΎΠ²ΡΠ΅ΠΌ ΡΠΊΠΎΡΠΎ ΠΏΠΎΡΡΠ²ΡΡΠ²ΡΠ΅ΡΠ΅ ΡΠ΅Π±Ρ Π»ΡΡΡΠ΅ ΠΈ ΡΠΌΠΎΠΆΠ΅ΡΠ΅ ΡΠΏΡΠ°Π²ΠΈΡΡΡΡ Ρ ΠΎΠΏΠ°ΡΠ½ΠΎΠΉ ΠΠΠ§-1 ΠΈΠ½ΡΠ΅ΠΊΡΠΈΠ΅ΠΉ, ΠΊΠΎΡΠΎΡΠ°Ρ Π½Π΅ΡΠ΅Π΄ΠΊΠΎ ΠΏΡΠΈΠ²ΠΎΠ΄ΠΈΡ ΠΊ Π»Π΅ΡΠ°Π»ΡΠ½ΠΎΠΌΡ ΠΈΡΡ ΠΎΠ΄Ρ. ΠΠΈΡΡΡ Π½Π΅ Π±ΡΠ΄Π΅Ρ Π±ΡΡΡΡΠΎ ΡΠ°Π·Π²ΠΈΠ²Π°ΡΡΡΡ, ΠΈ ΠΡ Π½Π΅ ΡΡΠΎΠ»ΠΊΠ½Π΅ΡΠ΅ΡΡ Ρ Π½Π΅ΠΏΡΠ΅Π΄Π²ΠΈΠ΄Π΅Π½Π½ΡΠΌ ΡΡ ΡΠ΄ΡΠ΅Π½ΠΈΠ΅ΠΌ ΡΠΈΡΡΠ°ΡΠΈΠΈ ΡΠΎ Π·Π΄ΠΎΡΠΎΠ²ΡΠ΅ΠΌ. ΠΡΠΈΠ½ΠΈΠΌΠ°ΡΡ ΠΌΠ΅Π΄ΠΈΠΊΠ°ΠΌΠ΅Π½Ρ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎ ΠΏΠΎ ΡΡ Π΅ΠΌΠ΅, ΠΊΠΎΡΠΎΡΡΡ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠ°Π» ΠΎΠΏΡΡΠ½ΡΠΉ Π²ΡΠ°Ρ, ΠΈ ΡΠΎΠ»ΡΠΊΠΎ ΡΠΎΠ³Π΄Π° ΠΡ Π½Π΅ ΡΡΠΎΠ»ΠΊΠ½Π΅ΡΠ΅ΡΡ Ρ Π½Π΅ΠΏΡΠ΅Π΄Π²ΠΈΠ΄Π΅Π½Π½ΡΠΌΠΈ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡΠΌΠΈ ΡΠ°ΠΌΠΎΡΡΠ²ΡΡΠ²ΠΈΡ. <h2>ΠΡΠΎΡΠΈΠ²ΠΎΠΏΠΎΠΊΠ°Π·Π°Π½ΠΈΡ</h2> ΠΡΠΆΠ½ΠΎ ΡΠ·Π½Π°ΡΡ Π·Π°ΡΠ°Π½Π΅Π΅, Π½Π΅Ρ Π»ΠΈ Ρ ΠΠ°Ρ ΡΠ»Π΅Π΄ΡΡΡΠΈΡ ΠΏΡΠΎΡΠΈΠ²ΠΎΠΏΠΎΠΊΠ°Π·Π°Π½ΠΈΠΉ: β’ Π³ΡΡΠ΄Π½ΠΎΠ΅ Π²ΡΠΊΠ°ΡΠΌΠ»ΠΈΠ²Π°Π½ΠΈΠ΅, ΠΏΠ΅ΡΠΈΠΎΠ΄ Π±Π΅ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΡΡΠΈ; β’ Π°Π»Π»Π΅ΡΠ³ΠΈΡ Π½Π° ΠΎΡΠ½ΠΎΠ²Π½ΡΠ΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΡ, Π²Ρ ΠΎΠ΄ΡΡΠΈΠ΅ Π² ΡΠΎΡΡΠ°Π² ΠΏΡΠ΅ΠΏΠ°ΡΠ°ΡΠ°; β’ Π·Π°Π±ΠΎΠ»Π΅Π²Π°Π½ΠΈΡ, ΠΊΠΎΡΠΎΡΡΠ΅ ΠΈΠ½ΠΎΠ³Π΄Π° ΠΎΠ±ΠΎΡΡΡΡΡΡΡΡ; β’ Π²ΠΎΠ·ΡΠ°ΡΡ Π΄ΠΎ 18-ΡΠΈ Π»Π΅Ρ; β’ Π·Π°Π±ΠΎΠ»Π΅Π²Π°Π½ΠΈΡ ΠΊΠΎΠΆΠΈ, Π΄Π΅ΡΠΌΠ°ΡΠΎΠ»ΠΎΠ³ΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ. ΠΠ° [url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Spegra (ΠΠΎΠ»ΡΡΠ΅Π³Π»Π°Π²ΠΈΡ / Π’Π΅Π½ΠΎΡΠΎΠ²ΠΈΡ Π°Π»Π°ΡΠ΅Π½Π°ΠΌΠΈΠ΄ / ΠΠΌΡΡΠΈΡΠΈΡΠ°Π±ΠΈΠ½) - Π‘ΠΏΠ΅Π³ΡΠ° (Dolutegravir/ Taf / Emtricitabine) ΠΎΡΠ·ΡΠ²Ρ[/url] Ρ ΠΎΡΠΎΡΠΈΠ΅. ΠΠ°ΡΠΈΠ΅Π½ΡΡ Π³ΠΎΠ²ΠΎΡΡΡ, ΡΡΠΎ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ ΡΠ°Π±Π»Π΅ΡΠΎΠΊ ΠΏΠΎΠ·Π²ΠΎΠ»ΠΈΠ»ΠΎ ΠΈΠΌ ΡΠΏΡΠ°Π²ΠΈΡΡΡΡ Ρ ΡΠ°Π·Π»ΠΈΡΠ½ΡΠΌΠΈ ΠΏΡΠΎΠ±Π»Π΅ΠΌΠ°ΠΌΠΈ. ΠΡ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΎΠΏΡΠΎΠ±ΠΎΠ²Π°ΡΡ ΠΌΠ΅Π΄ΠΈΠΊΠ°ΠΌΠ΅Π½Ρ Π½Π° ΠΏΡΠ°ΠΊΡΠΈΠΊΠ΅, ΡΡΠΎΠ±Ρ ΡΠ±Π΅Π΄ΠΈΡΡΡΡ Π² Π΅Π³ΠΎ ΡΡΡΠ΅ΠΊΡΠΈΠ²Π½ΠΎΠΌ Π²ΠΎΠ·Π΄Π΅ΠΉΡΡΠ²ΠΈΠΈ Π½Π° ΠΎΡΠ³Π°Π½ΠΈΠ·ΠΌ, Π΄ΠΎΡΡΠ°ΡΠΎΡΠ½ΠΎ ΠΎΡΠΎΡΠΌΠΈΡΡ Π·Π°ΠΊΠ°Π·. <h2>Π‘ΠΏΠΎΡΠΎΠ± ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΡ</h2> ΠΠ° [url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Spegra (ΠΠΎΠ»ΡΡΠ΅Π³Π»Π°Π²ΠΈΡ / Π’Π΅Π½ΠΎΡΠΎΠ²ΠΈΡ Π°Π»Π°ΡΠ΅Π½Π°ΠΌΠΈΠ΄ / ΠΠΌΡΡΠΈΡΠΈΡΠ°Π±ΠΈΠ½) - Π‘ΠΏΠ΅Π³ΡΠ° (Dolutegravir/ Taf / Emtricitabine) ΡΠ΅Π½[/url]Π° Π΄ΠΎΡΡΡΠΏΠ½Π°Ρ. Π§ΡΠΎΠ±Ρ ΡΠΏΡΠ°Π²ΠΈΡΡΡΡ Ρ Π±ΠΎΠ»Π΅Π·Π½ΡΡ, Π΄ΠΎΡΡΠ°ΡΠΎΡΠ½ΠΎ ΠΏΡΠΈΠ½ΠΈΠΌΠ°ΡΡ ΠΏΠΎ ΠΎΠ΄Π½ΠΎΠΉ ΡΠ°Π±Π»Π΅ΡΠΊΠ΅ Π»Π΅ΠΊΠ°ΡΡΡΠ²Π° Π΄ΠΎ ΠΈΠ»ΠΈ ΠΏΠΎΡΠ»Π΅ Π΅Π΄Ρ ΡΡΡΠΎΠΌ ΠΈ Π²Π΅ΡΠ΅ΡΠΎΠΌ, ΡΠ΅ΡΠΊΠΎ ΡΠ»Π΅Π΄ΡΡ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠ°Π½Π½ΠΎΠΉ Π΄ΠΎΠΊΡΠΎΡΠΎΠΌ ΡΡ Π΅ΠΌΠ΅. <h2>ΠΠΎΠ±ΠΎΡΠ½ΡΠ΅ ΡΠ²Π»Π΅Π½ΠΈΡ</h2> ΠΡΠ»ΠΈ Π½Π°ΡΡΡΠΈΡΡ ΡΡ Π΅ΠΌΡ ΡΠ΅ΡΠ°ΠΏΠΈΠΈ, ΠΌΠΎΠΆΠ½ΠΎ ΡΡΠΎΠ»ΠΊΠ½ΡΡΡΡΡ Ρ ΡΠ°ΠΊΠΈΠΌΠΈ ΡΠ»ΠΎΠΆΠ½ΠΎΡΡΡΠΌΠΈ: β’ ΡΠ°ΡΡΡΡΠΎΠΉΡΡΠ²Π° ΠΆΠ΅Π»ΡΠ΄ΠΊΠ°; β’ ΠΎΡΡΡΡΡΡΠ²ΠΈΠ΅ ΡΠΈΠ», Π±Π΅ΡΡΠΎΠ½Π½ΠΈΡΠ°; β’ Π±ΠΎΠ»ΠΈ Π² ΠΎΠ±Π»Π°ΡΡΠΈ ΠΆΠ΅Π»ΡΠ΄ΠΊΠ°; β’ ΡΠ΅Π·ΠΊΠΈΠ΅ ΡΠΊΠ°ΡΠΊΠΈ Π΄Π°Π²Π»Π΅Π½ΠΈΡ; β’ ΠΈΠ½ΡΠ΅ΠΊΡΠΈΠΈ Π΄ΡΡ Π°ΡΠ΅Π»ΡΠ½ΡΡ ΠΏΡΡΠ΅ΠΉ; β’ ΠΊΡΠΎΠ²ΠΎΡΠ΅ΡΠ΅Π½ΠΈΡ ΠΈΠ· Π½ΠΎΡΠ°. ΠΠ° [url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Spegra (ΠΠΎΠ»ΡΡΠ΅Π³Π»Π°Π²ΠΈΡ / Π’Π΅Π½ΠΎΡΠΎΠ²ΠΈΡ Π°Π»Π°ΡΠ΅Π½Π°ΠΌΠΈΠ΄ / ΠΠΌΡΡΠΈΡΠΈΡΠ°Π±ΠΈΠ½) - Π‘ΠΏΠ΅Π³ΡΠ° (Dolutegravir/ Taf / Emtricitabine) ΡΡΠΎΠΈΠΌΠΎΡΡΡ[/url] Π΄ΠΎΡΡΡΠΏΠ½Π°Ρ. ΠΠΎΠΌΠ½ΠΈΡΠ΅: Π½ΡΠΆΠ½ΠΎ ΡΡΡΠΎΠ³ΠΎ ΠΏΡΠΈΠ΄Π΅ΡΠΆΠΈΠ²Π°ΡΡΡΡ ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°ΡΠΈΠΉ ΡΠΏΠ΅ΡΠΈΠ°Π»ΠΈΡΡΠ°, ΡΡΠΎΠ±Ρ Π½Π΅ ΡΡΠΎΠ»ΠΊΠ½ΡΡΡΡΡ Ρ ΠΏΡΠΎΠ±Π»Π΅ΠΌΠ°ΠΌΠΈ. [url=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin]Π²ΠΈΡ ΠΏΡΠ΅ΠΏΠ°ΡΠ°ΡΡ +Π² ΠΌΠΎΡΠΊΠ²Π΅[/url]