dimanche 22 septembre 2019 à 13:34

VAE GAN

Par Eric Antoine Scuccimarra

I 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]