<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eva Bozich Brundage on Medium]]></title>
        <description><![CDATA[Stories by Eva Bozich Brundage on Medium]]></description>
        <link>https://medium.com/@evabozich?source=rss-2187fbd49bf3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QHtZv8p_AO3pjN5q4GdTOA.jpeg</url>
            <title>Stories by Eva Bozich Brundage on Medium</title>
            <link>https://medium.com/@evabozich?source=rss-2187fbd49bf3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 13:35:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@evabozich/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding CycleGANs]]></title>
            <link>https://medium.com/@evabozich/understanding-cyclegans-f137ef19676d?source=rss-2187fbd49bf3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f137ef19676d</guid>
            <category><![CDATA[generative-adversarial]]></category>
            <category><![CDATA[gans]]></category>
            <category><![CDATA[image-translation]]></category>
            <category><![CDATA[cyclegan]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Eva Bozich Brundage]]></dc:creator>
            <pubDate>Sat, 27 Jul 2019 21:50:18 GMT</pubDate>
            <atom:updated>2019-07-27T21:50:18.646Z</atom:updated>
            <content:encoded><![CDATA[<p>The past five years of computer vision have been expanded by a large factor through the use of a technique called Deep Learning. Deep Learning, concerns with the utility of artificial neural networks in use. One big leap in computer vision and deep learning is the concept of Generative Adversarial Networks, which consists of two competing models, one of them trying to learn a correct image through noise, meanwhile the second model evaluating weather the other did a good job or still has time to go. GAN as a method to tackle unsupervised problems also have introduced interesting work, one of those that we will discuss today, <strong><em>CycleGANs</em></strong>.</p><h4>What do CycleGANs do?</h4><p>Unpaired Image to Image Translation Using Cycle-Consistency Adversarial Networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*btuRTgyaphzkOPKy1ZKKkQ.png" /><figcaption>Original Paper’s Results We Tried to Reproduce</figcaption></figure><p><strong>What does that mean?</strong></p><p>The goal of CycleGANs, is to learn to automatically translate an image from one collection to another given any two unordered image collections, <em>X </em>and <em>Y.</em></p><p><strong>How does this work?</strong></p><p>Using:</p><ul><li><em>two Generative Adversarial Networks:</em> model G and model F.</li><li><em>two unordered image collections*:</em> X and Y</li><li><em>one Cycle- Consistency Loss with three parts:</em> modelGLoss, modelFLoss, and cycleLoss function</li></ul><p>Note: While we use unpaired image collections, we assume there is some relationship between the images in the collections. Ideally they are different renderings of the same structure.</p><p>The significant developments CycleGANs come from solving the previous GAN variations problems.</p><h4>Origin of CycleGANs</h4><p>Prior to CycleGANs, there was no way for the computer to learn to generate photos unsupervised. The first step to developing CycleGANs came with Generative Adversarial Networks in 2014.</p><p><strong>2014 Generative Adversarial Networks</strong> by Ian Goodfellow et al., <a href="https://arxiv.org/abs/1406.2661">https://arxiv.org/abs/1406.2661</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/0*GzQ31A1nFTaPQj3E." /><figcaption>Generative Adversarial Network Example. Image source: <a href="https://arxiv.org/abs/1406.2661">https://arxiv.org/abs/1406.2661</a></figcaption></figure><p>These results demonstrated promising results of using an Adversarial Network to generate images.</p><p>Three years after GANs were developed, a model, Image-to-Image Translation with Conditional Adversarial Networks, was released marking the second significant breakthrough in developing CycleGANs.</p><p><strong>2017 Image-to-Image Translation with Conditional Adversarial Networks</strong></p><p>by Philip Isola et al., <a href="https://arxiv.org/abs/1611.07004">https://arxiv.org/abs/1611.07004</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*nx0zC6XqtO6TXgeVOxIqLA.png" /><figcaption>PIX2PIX Example. Image Source: <a href="https://arxiv.org/abs/1611.07004">https://arxiv.org/abs/1611.07004</a></figcaption></figure><p>Paired image-to-image translation, or PIX2PIX, allows images to be translated from one form of the image to another.</p><p><em>How?</em> By mapping pixels from one image to match the pixels from the other image. However, it only works for paired image datasets which are expensive, time consuming, and even impossible to find.</p><p>CycleGANs solves the problem of paired data.</p><p><strong>2017 Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks</strong></p><p>by Jun-Yan Zhu et al., <a href="https://arxiv.org/abs/1703.10593">https://arxiv.org/abs/1703.10593</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/0*ts9I1OLMR6-E0uoQ." /><figcaption>Examples of Popular CycleGANs applications. Unpaired Image to Image Paper Image</figcaption></figure><p>Unpaired Image-to-Image Translation Using Cycle Consistent Adversarial Networks is a mouthful, let’s call it CycleGANs.</p><p>CycleGANs takes two collections of images, X and Y, and learns to translate an image from collection X to collection Y. It does this by using two GANs that battle against each other using a cycle consistent loss function.</p><p>The CycleGANs model has been successful with a variety of applications as seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*W49ImvojXwc74cDe." /><figcaption>Monet Paintings to Photos</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Bk420QnJo-yYADm3." /><figcaption>Collection Style Transfer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*GEx8Jh2TWaPQSU71." /><figcaption>Object Transfiguration</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*YsStEOD4joSHyJyj." /><figcaption>Season Transfer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*mojrBhnUp0Y-VT9a." /><figcaption>Photo Enhancement: Narrowing depth of field</figcaption></figure><p>While CycleGAN image quality is not state of the art, solving the problem of needing paired image data is.</p><h3>Why Do We Care?</h3><p>One of the founding fathers of Machine Learning, Yann LeCun, said, “There are many interesting recent developments in deep learning… The most important one, in my opinion, is adversarial training, also called GAN for Generative Adversarial Networks. This, and the variations that are now being proposed, is the most interesting idea in the last 10 years in Machine Leaning.” Considering what Yann LeCun said, the fact CycleGANs arise the one of the most recent variations, and a CycleGAN model uses two GANs simultaneously, learning to generate photos with unpaired image datasets.</p><h3>CycleGAN architecture</h3><p>The CycleGAN model consists of two generators, two GAN models, and one cycle consistent loss function. We will discuss all of the three models in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*uGw7WsX4_CTDzfr1." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*pm8x60aB17CsjWOx." /><figcaption>Create My Own Image</figcaption></figure><h4>Generator Model</h4><p>There are three main stages that happen in the generator model: encoding, transformation, and decoding.</p><p>Encoding — extracting features via a convolutional network, relu layer, batch normalization layer → gives us a <em>feature vectorA</em></p><p>Transformation — layers of combining nearby features of an image, allow us to save layers and return to the original image, use resnet blocks → <em>feature vectorB</em></p><p>Decoding — deconvolutional layer takes <em>feature vectorA </em>and <em>feature vectorB </em>and build back the low level features, then back to an image in the new domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7JBT20_KkviBgc1Z." /></figure><h4>Discriminator Model</h4><p>The discriminator has two main stages.</p><p>Stage one - extract the features from the image using convolutional networks</p><p>Stage two - decide whether or not these features belong to images from the training dataset</p><p>It’s goal is to take an image as input and tries to predict if it is an original image or a synthetic image from the generator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Ux4eKW9MbFkwJ6ux." /></figure><h4>Model Build</h4><p>This model needs to work in both directions A→B and from B→A.</p><p>To do that we have two Generator Models: GeneratorA→B and GeneratorB→A.</p><p>and two Discriminator Models: DiscriminatorA and DiscriminatorB.</p><h4>CycleLoss</h4><p>Goal of the cycle loss: Get the generated image back to original image, thus minimizing the loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/0*0WCoNjTJw8Qsfpe4." /><figcaption>CycleLoss Equation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*ACOCgot1XSQL_8EY." /><figcaption>Image Source: Unpaired Image-to-Image Translation</figcaption></figure><p><strong>Putting it all together we achieve our cycle consistent loss function.</strong></p><h4>Cycle Consistent Loss</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/0*u_9GZac76VXeNwKB." /></figure><p>The Cycle Consistent Loss Function is made up of three parts.</p><ol><li>The loss from GAN model G</li><li>The loss from GAN model F</li><li>The Cycle Loss Function tying together model G and model F</li></ol><p>It is important to note that the Cycle Loss Function is more important than the loss from the two GAN models because the Cycle Loss Function is what allows CycleGANs to work with unpaired data. To properly represent the importance of the Cycle Loss Function, we give it extra weight by multiplying it by Lambda.</p><h4>Bad Results</h4><p>While CycleGANs is an unsupervised method, in order to successfully carry out applications such as object transfiguration, semi-supervised data may be required.</p><p>Why would certain applications need partial supervision?</p><p>The original paper touched on this saying, “Some failure cases are caused by the distribution characteristics of the training datasets. For example, the horse → zebra example has got confused, because our model was trained on the <em>wild horse </em>and <em>zebra </em>synsets of ImageNet, which does not contain images of a person riding a horse or zebra.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*6IHHA2LelT5gFkwgefysDg.png" /></figure><p>If you look at the four images above of “wild horses” you will notice there are no humans in the training set. So, when the model worked to translate the input image of a “wild horse” to a zebra, it recognized the entire focus of the image, man and horse, as the horse and the model ends up creating a joint man-zebra.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ozDWuAuvZXx--o9IzWAPpA.png" /><figcaption>Our Horse ← → Zebra Implementation</figcaption></figure><p>This happens because the model works to recognize the structure of the image from one collection and translates it to the structure of another image. The structure is defined by the curves and edges that constitute the image. When the collections obtain images with different structures, i.e one horse, horses and man, cougar and zebra, there will be limited success as they are clearly structurally different. These extra objects created a strong enough structural difference in the image collections which resulted in the discriminator accepting images that have poor similarity the photos in the zebra training set. This implementation uncovers one of the weakness of the CycleGANs model.</p><p>To improve the quality of these results, we could work to ensure that the two collections are more structurally similar by using for example a collection X of horse profiles, and a collection Y of zebra profiles.</p><h4>Good Results</h4><p>The implementation of CycleGANs for season transfer Summer Yosemite ←→ Winter Yosemite produced highly successful results. Ideally with CycleGANs, although we do not need to know the relationship between the image collections, we will have two unpaired image collections X and Y that are strongly structurally similar as seen in the Summer ← →Winter Implementation below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*gURSmP94zimBf3aD." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*jzBgQgUeS9-vqch2." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Rhg0PEXRJxFeqziX." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*SK4m3YHsId-UZ3q3." /><figcaption>Our Summer ← → Winter Implementation</figcaption></figure><p>Our Summer ← → Winter Implementation is working with landscape photos that have roughly the same structure, all being from Yosemite, the main work to be done is translating the pixels between these two image collections. When the main task at hand is translating pixels, versus translating structure and pixels, the results are more successful due to the fact we already have state of the art GAN models like pix2pix[1].</p><h4>Conclusion</h4><p>It is important to recognize that while models such as pix2pix produce images with state of the art quality, the requirement of paired image datasets is a massive handicap. Paired image datasets are time consuming to curate, they are expensive to curate, and it is likely impossible to find the exact dataset required to carry out of the desired implementation. CycleGANs solves that problem of paired data opening a brand new branch in Machine Learning: unsupervised image to image translation.</p><h4>Resources</h4><p><strong>[1] Pix-to-Pix Supervised GANs</strong></p><p>Isola, Phillip, et al. “Image-to-Image Translation with Conditional Adversarial Networks.” <em>2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)</em>, 2017, doi:10.1109/cvpr.2017.632.</p><p><strong>[2] Pix-to-Pix Unsupervised with CycleGANs</strong></p><p>Zhu, Jun-Yan, et al. “Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks.” <em>2017 IEEE International Conference on Computer Vision (ICCV)</em>, 2017, doi:10.1109/iccv.2017.244.</p><p><strong>[3] Why Cycle GANs are Important and Useful</strong></p><p>Likahovich, Olga, et al. “Learning Image to Image Translation with CycleGANs” <em>Microsoft Developer Blog, 2017.</em></p><p><a href="https://www.microsoft.com/developerblog/2017/06/12/learning-image-image-translation-cyclegans/">https://www.microsoft.com/developerblog/2017/06/12/learning-image-image-translation-cyclegans/</a></p><p><strong>[4] Generative Adversarial Networks</strong></p><p>Goodfellow, Ian, et al. “Generative Adversarial Networks.” <em>Cornell University Library, 2014.</em></p><p><a href="https://arxiv.org/abs/1406.2661">https://arxiv.org/abs/1406.2661</a></p><p><strong>[5] Generative Models Lecture Stanford</strong></p><p>Li, Fei-Fei, et al. “Generative Models.” <em>Stanford University School of Engineering, 2017.</em></p><p><a href="https://www.youtube.com/watch?v=5WoItGTWV54">https://www.youtube.com/watch?v=5WoItGTWV54</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f137ef19676d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>