{
  "id": 171521,
  "title": "CycleGAN Adventures",
  "url": "/competitions/global-wheat-detection/discussion/171521",
  "author_name": "Ryan Epp",
  "post_date": "2020-08-01T08:00:43.391000",
  "votes": 44,
  "comment_count": 11,
  "views": 0,
  "content": "<p>Hey everybody, I wanted to share something that didn't end up working out for me, but I think is still pretty interesting.</p>\n\n<p>Back at the beginning of the contest I was trying to generate more training examples using <a href=\"https://junyanz.github.io/CycleGAN/\">CycleGAN</a>. My thinking was that CycleGAN should preserve the location of the wheat heads so I wouldn't need to worry about the bounding boxes.</p>\n\n<p>I tried to transform images from the Arvalis_1 subset to the Ethz_1 subset. I chose those two because they had the most examples. In hindsight, they may not have been the best choices since there seems to be a lot of variation in Arvalis_1 and I'm not sure more images that look like Ethz_1 would be helpful.</p>\n\n<p>It looked like it was working really well:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F141e471009fb0f3a0358c6e647eff3ee%2FCycleGAN%201.png?generation=1596267020743984&amp;alt=media\" alt=\"\"></p>\n\n<p>But unfortunately, when I used fake/generated images into train my object detector, it was slower to converge and performed worse on the validation set. It turns out the GAN was hallucinating wheat textures in brighter areas where they didn't belong and removing the wheat texture in other places. So the bounding boxes weren't correct:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F529e794153878e6fe746e94d4a657deb%2FCycleGan2.jpg?generation=1596267666137025&amp;alt=media\" alt=\"\"></p>\n\n<p>So I tried adding a second discriminator and masking out the wheat heads / background. So discriminator 1 only sees wheat heads and discriminator 2 only sees background. That way, if the GAN puts wheat heads in the wrong spot or vice versa, the discriminator should catch it.</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82443fccce8207e20a55583e80cc3f3e%2FCycleGan3.jpg?generation=1596268417491010&amp;alt=media\" alt=\"\"></p>\n\n<p>Unfortunately, the discriminator learned that the bounding box distributions for the two subsets... and to compensate the GAN stated adding grey boxes around the bounding boxes to fool the discriminators! Pretty cool, but not super useful for the contest. </p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82e1b36d34d3250a3e59006f0240609a%2FCycleGan4.jpg?generation=1596268761505192&amp;alt=media\" alt=\"\"></p>\n\n<p>I tried adding a third discriminator that used the whole (unmasked) image but at that point I think the whole thing was over-constrained and it failed to make any progress on the losses. </p>\n\n<p>I retried the 2 discriminator approach but I stopped training before the GAN started adding the grey boxes. It improved my local validation results but didn't improve my LB score. By then I had spent WAY too much time trying to generate training images and I moved on to other ideas. </p>\n\n<p><strong>Additional ideas I didn't get to try:</strong>\n- Randomly crop/scale the images so the bounding boxes are less predictable.\n- Use different subsets.\n- Allow the GAN to hallucinate new wheat heads and then re-label the generated images using a trained detector.</p>\n\n<p><strong>Did anybody else try to generate new training images? How did it go? I'd love to hear about it!</strong></p>",
  "messages": [
    {
      "id": 953879,
      "postDate": "2020-08-01T08:00:43.390Z",
      "content": "<p>Hey everybody, I wanted to share something that didn't end up working out for me, but I think is still pretty interesting.</p>\n\n<p>Back at the beginning of the contest I was trying to generate more training examples using <a href=\"https://junyanz.github.io/CycleGAN/\">CycleGAN</a>. My thinking was that CycleGAN should preserve the location of the wheat heads so I wouldn't need to worry about the bounding boxes.</p>\n\n<p>I tried to transform images from the Arvalis_1 subset to the Ethz_1 subset. I chose those two because they had the most examples. In hindsight, they may not have been the best choices since there seems to be a lot of variation in Arvalis_1 and I'm not sure more images that look like Ethz_1 would be helpful.</p>\n\n<p>It looked like it was working really well:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F141e471009fb0f3a0358c6e647eff3ee%2FCycleGAN%201.png?generation=1596267020743984&amp;alt=media\" alt=\"\"></p>\n\n<p>But unfortunately, when I used fake/generated images into train my object detector, it was slower to converge and performed worse on the validation set. It turns out the GAN was hallucinating wheat textures in brighter areas where they didn't belong and removing the wheat texture in other places. So the bounding boxes weren't correct:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F529e794153878e6fe746e94d4a657deb%2FCycleGan2.jpg?generation=1596267666137025&amp;alt=media\" alt=\"\"></p>\n\n<p>So I tried adding a second discriminator and masking out the wheat heads / background. So discriminator 1 only sees wheat heads and discriminator 2 only sees background. That way, if the GAN puts wheat heads in the wrong spot or vice versa, the discriminator should catch it.</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82443fccce8207e20a55583e80cc3f3e%2FCycleGan3.jpg?generation=1596268417491010&amp;alt=media\" alt=\"\"></p>\n\n<p>Unfortunately, the discriminator learned that the bounding box distributions for the two subsets... and to compensate the GAN stated adding grey boxes around the bounding boxes to fool the discriminators! Pretty cool, but not super useful for the contest. </p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82e1b36d34d3250a3e59006f0240609a%2FCycleGan4.jpg?generation=1596268761505192&amp;alt=media\" alt=\"\"></p>\n\n<p>I tried adding a third discriminator that used the whole (unmasked) image but at that point I think the whole thing was over-constrained and it failed to make any progress on the losses. </p>\n\n<p>I retried the 2 discriminator approach but I stopped training before the GAN started adding the grey boxes. It improved my local validation results but didn't improve my LB score. By then I had spent WAY too much time trying to generate training images and I moved on to other ideas. </p>\n\n<p><strong>Additional ideas I didn't get to try:</strong>\n- Randomly crop/scale the images so the bounding boxes are less predictable.\n- Use different subsets.\n- Allow the GAN to hallucinate new wheat heads and then re-label the generated images using a trained detector.</p>\n\n<p><strong>Did anybody else try to generate new training images? How did it go? I'd love to hear about it!</strong></p>",
      "rawMarkdown": "Hey everybody, I wanted to share something that didn't end up working out for me, but I think is still pretty interesting.\n\nBack at the beginning of the contest I was trying to generate more training examples using [CycleGAN](https://junyanz.github.io/CycleGAN/). My thinking was that CycleGAN should preserve the location of the wheat heads so I wouldn't need to worry about the bounding boxes.\n\nI tried to transform images from the Arvalis_1 subset to the Ethz_1 subset. I chose those two because they had the most examples. In hindsight, they may not have been the best choices since there seems to be a lot of variation in Arvalis_1 and I'm not sure more images that look like Ethz_1 would be helpful.\n\nIt looked like it was working really well:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F141e471009fb0f3a0358c6e647eff3ee%2FCycleGAN%201.png?generation=1596267020743984&amp;alt=media)\n\nBut unfortunately, when I used fake/generated images into train my object detector, it was slower to converge and performed worse on the validation set. It turns out the GAN was hallucinating wheat textures in brighter areas where they didn't belong and removing the wheat texture in other places. So the bounding boxes weren't correct:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F529e794153878e6fe746e94d4a657deb%2FCycleGan2.jpg?generation=1596267666137025&amp;alt=media)\n\nSo I tried adding a second discriminator and masking out the wheat heads / background. So discriminator 1 only sees wheat heads and discriminator 2 only sees background. That way, if the GAN puts wheat heads in the wrong spot or vice versa, the discriminator should catch it.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82443fccce8207e20a55583e80cc3f3e%2FCycleGan3.jpg?generation=1596268417491010&amp;alt=media)\n\nUnfortunately, the discriminator learned that the bounding box distributions for the two subsets... and to compensate the GAN stated adding grey boxes around the bounding boxes to fool the discriminators! Pretty cool, but not super useful for the contest. \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82e1b36d34d3250a3e59006f0240609a%2FCycleGan4.jpg?generation=1596268761505192&amp;alt=media)\n\n\nI tried adding a third discriminator that used the whole (unmasked) image but at that point I think the whole thing was over-constrained and it failed to make any progress on the losses. \n\nI retried the 2 discriminator approach but I stopped training before the GAN started adding the grey boxes. It improved my local validation results but didn't improve my LB score. By then I had spent WAY too much time trying to generate training images and I moved on to other ideas. \n\n**Additional ideas I didn't get to try:**\n- Randomly crop/scale the images so the bounding boxes are less predictable.\n- Use different subsets.\n- Allow the GAN to hallucinate new wheat heads and then re-label the generated images using a trained detector.\n\n**Did anybody else try to generate new training images? How did it go? I'd love to hear about it!**\n\n\n",
      "votes": 44
    },
    {
      "id": 954071,
      "postDate": "2020-08-01T11:03:30.223Z",
      "content": "<p>I have not tried cycle-gan but I used style-transfer and pix2pix GAN to generate images.\nHere are some examples:</p>\n\n<ol>\n<li><p>Style Transfer:\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2F961c77efee13d5d7a74842d7ab51c270%2Fstyles.jpg?generation=1596279696685115&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Pix2Pix: (Not that great)\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2Fe62db128712e2ea7384e714d99009650%2Fpix2pix.jpg?generation=1596279779235784&amp;alt=media\" alt=\"\"></p></li>\n</ol>",
      "rawMarkdown": "I have not tried cycle-gan but I used style-transfer and pix2pix GAN to generate images.\nHere are some examples:\n\n1. Style Transfer:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2F961c77efee13d5d7a74842d7ab51c270%2Fstyles.jpg?generation=1596279696685115&amp;alt=media)\n\n2. Pix2Pix: (Not that great)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2Fe62db128712e2ea7384e714d99009650%2Fpix2pix.jpg?generation=1596279779235784&amp;alt=media)\n\n  ",
      "votes": 10,
      "replies": [
        {
          "id": 954722,
          "postDate": "2020-08-02T03:08:26.273Z",
          "content": "<p>Nice! The style transfer images look great. Did they improve your lb score? For pix2pix, don't you need matching pairs of images? How did you choose the input/output pairs?</p>",
          "rawMarkdown": "Nice! The style transfer images look great. Did they improve your lb score? For pix2pix, don't you need matching pairs of images? How did you choose the input/output pairs?",
          "votes": 1
        },
        {
          "id": 954879,
          "postDate": "2020-08-02T06:59:09.077Z",
          "content": "<ol>\n<li>Yes, the style transfer images did increase my LB score by &gt;.006</li>\n<li>Steps I took for Pix2Pix image generation.\ni. Mask the background except for the wheat heads using the bbox.\nii. Apply edge detection (<a href=\"https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.sobel\">sobel filter</a>) on the unmasked wheat heads. \niii. Use the processed image as the input and the original image as output.\niv. For inferencing, I cropped wheat heads from multiple sources and applied edge detection and arbitrarily placing the wheat heads in an empty image and fed as input.</li>\n</ol>",
          "rawMarkdown": "1. Yes, the style transfer images did increase my LB score by &gt;.006\n2. Steps I took for Pix2Pix image generation.\n    i. Mask the background except for the wheat heads using the bbox.\n    ii. Apply edge detection ([sobel filter](https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.sobel)) on the unmasked wheat heads. \n    iii. Use the processed image as the input and the original image as output.\n    iv. For inferencing, I cropped wheat heads from multiple sources and applied edge detection and arbitrarily placing the wheat heads in an empty image and fed as input.",
          "votes": 3
        }
      ]
    },
    {
      "id": 953915,
      "postDate": "2020-08-01T08:35:28.970Z",
      "content": "<p>Very nice experiments. My approach was to generate the images without labels since I thought it would be an easier task. Despite the low scores we are getting in the competition, the task itself is actually not a hard one so I didn't worry much about labeling, I would let my model do the work. I got some pretty decent results but in the end my GAN was too weak, and not very diverse. A handpicked example: <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1110596%2Ffa03febaae8ec390f2f2615a46f7d0f1%2Fseed8469.png?generation=1596270961097189&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Very nice experiments. My approach was to generate the images without labels since I thought it would be an easier task. Despite the low scores we are getting in the competition, the task itself is actually not a hard one so I didn't worry much about labeling, I would let my model do the work. I got some pretty decent results but in the end my GAN was too weak, and not very diverse. A handpicked example: ![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1110596%2Ffa03febaae8ec390f2f2615a46f7d0f1%2Fseed8469.png?generation=1596270961097189&amp;alt=media)\n",
      "votes": 3,
      "replies": [
        {
          "id": 953935,
          "postDate": "2020-08-01T08:52:17.080Z",
          "content": "<p>That looks really good! Did you use the full dataset or a subset? What did your setup look like?</p>\n\n<p>It looks like we may have run into a similar issue with the GAN creating half-wheat-head-half-leaf creatures. Haha.</p>",
          "rawMarkdown": "That looks really good! Did you use the full dataset or a subset? What did your setup look like?\n\nIt looks like we may have run into a similar issue with the GAN creating half-wheat-head-half-leaf creatures. Haha."
        },
        {
          "id": 957764,
          "postDate": "2020-08-04T14:49:54.083Z",
          "content": "<p>I used a manually curated subset, removing ground images and low quality ones like Arvalis_2. By doing this I was able to lower my fid from around 16 to 11. I used Stylegan2 with augmentations, image size of 512, running on 4 1080ti's, I trained until 8 million real images were shown to the discriminator (this is when the quality started to deteriorate). I then used a super-resolution model to upsample the images from 512-1024. </p>",
          "rawMarkdown": "I used a manually curated subset, removing ground images and low quality ones like Arvalis_2. By doing this I was able to lower my fid from around 16 to 11. I used Stylegan2 with augmentations, image size of 512, running on 4 1080ti's, I trained until 8 million real images were shown to the discriminator (this is when the quality started to deteriorate). I then used a super-resolution model to upsample the images from 512-1024. \n",
          "votes": 1
        }
      ]
    },
    {
      "id": 953886,
      "postDate": "2020-08-01T08:06:47.040Z",
      "content": "<p>Very nice work! I also tried out CycleGAN but abandoned it pretty quickly. I'm glad you were able to generate some nice images out of it, though thats unfortunate it didn't boost your score</p>",
      "rawMarkdown": "Very nice work! I also tried out CycleGAN but abandoned it pretty quickly. I'm glad you were able to generate some nice images out of it, though thats unfortunate it didn't boost your score",
      "votes": 1
    },
    {
      "id": 958036,
      "postDate": "2020-08-04T18:00:06.270Z",
      "content": "<p>The problem of applying GANs as of now is it too computational costly to get that kind of image quality also in order to increase quality we can probably join it with auto-encoders but again too costly .</p>",
      "rawMarkdown": "The problem of applying GANs as of now is it too computational costly to get that kind of image quality also in order to increase quality we can probably join it with auto-encoders but again too costly .",
      "votes": 2
    },
    {
      "id": 954169,
      "postDate": "2020-08-01T13:14:12.597Z",
      "content": "<p>Great!Can you public your code after this game finish?</p>",
      "rawMarkdown": "Great!Can you public your code after this game finish?",
      "votes": 2
    },
    {
      "id": 954199,
      "postDate": "2020-08-01T13:40:56.693Z",
      "content": "<p>Interesting results 👍\nSome of the generated images look quite realistic. </p>",
      "rawMarkdown": "Interesting results 👍\nSome of the generated images look quite realistic. "
    },
    {
      "id": 958088,
      "postDate": "2020-08-04T18:58:51.433Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 954071,
      "author_name": "bendang",
      "author_url": "",
      "post_date": "2020-08-01T11:03:30.223000",
      "content": "<p>I have not tried cycle-gan but I used style-transfer and pix2pix GAN to generate images.\nHere are some examples:</p>\n\n<ol>\n<li><p>Style Transfer:\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2F961c77efee13d5d7a74842d7ab51c270%2Fstyles.jpg?generation=1596279696685115&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Pix2Pix: (Not that great)\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2Fe62db128712e2ea7384e714d99009650%2Fpix2pix.jpg?generation=1596279779235784&amp;alt=media\" alt=\"\"></p></li>\n</ol>",
      "votes": 10,
      "replies": [
        {
          "id": 954722,
          "author_name": "Ryan Epp",
          "author_url": "",
          "post_date": "2020-08-02T03:08:26.273000",
          "content": "<p>Nice! The style transfer images look great. Did they improve your lb score? For pix2pix, don't you need matching pairs of images? How did you choose the input/output pairs?</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 954879,
          "author_name": "bendang",
          "author_url": "",
          "post_date": "2020-08-02T06:59:09.077000",
          "content": "<ol>\n<li>Yes, the style transfer images did increase my LB score by &gt;.006</li>\n<li>Steps I took for Pix2Pix image generation.\ni. Mask the background except for the wheat heads using the bbox.\nii. Apply edge detection (<a href=\"https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.sobel\">sobel filter</a>) on the unmasked wheat heads. \niii. Use the processed image as the input and the original image as output.\niv. For inferencing, I cropped wheat heads from multiple sources and applied edge detection and arbitrarily placing the wheat heads in an empty image and fed as input.</li>\n</ol>",
          "votes": 3,
          "replies": []
        }
      ]
    },
    {
      "id": 953915,
      "author_name": "Max",
      "author_url": "",
      "post_date": "2020-08-01T08:35:28.970000",
      "content": "<p>Very nice experiments. My approach was to generate the images without labels since I thought it would be an easier task. Despite the low scores we are getting in the competition, the task itself is actually not a hard one so I didn't worry much about labeling, I would let my model do the work. I got some pretty decent results but in the end my GAN was too weak, and not very diverse. A handpicked example: <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1110596%2Ffa03febaae8ec390f2f2615a46f7d0f1%2Fseed8469.png?generation=1596270961097189&amp;alt=media\" alt=\"\"></p>",
      "votes": 3,
      "replies": [
        {
          "id": 953935,
          "author_name": "Ryan Epp",
          "author_url": "",
          "post_date": "2020-08-01T08:52:17.080000",
          "content": "<p>That looks really good! Did you use the full dataset or a subset? What did your setup look like?</p>\n\n<p>It looks like we may have run into a similar issue with the GAN creating half-wheat-head-half-leaf creatures. Haha.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 957764,
          "author_name": "Max",
          "author_url": "",
          "post_date": "2020-08-04T14:49:54.083000",
          "content": "<p>I used a manually curated subset, removing ground images and low quality ones like Arvalis_2. By doing this I was able to lower my fid from around 16 to 11. I used Stylegan2 with augmentations, image size of 512, running on 4 1080ti's, I trained until 8 million real images were shown to the discriminator (this is when the quality started to deteriorate). I then used a super-resolution model to upsample the images from 512-1024. </p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 953886,
      "author_name": "Matt",
      "author_url": "",
      "post_date": "2020-08-01T08:06:47.040000",
      "content": "<p>Very nice work! I also tried out CycleGAN but abandoned it pretty quickly. I'm glad you were able to generate some nice images out of it, though thats unfortunate it didn't boost your score</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 958036,
      "author_name": "Vishal singh",
      "author_url": "",
      "post_date": "2020-08-04T18:00:06.270000",
      "content": "<p>The problem of applying GANs as of now is it too computational costly to get that kind of image quality also in order to increase quality we can probably join it with auto-encoders but again too costly .</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 954169,
      "author_name": "Zekun",
      "author_url": "",
      "post_date": "2020-08-01T13:14:12.597000",
      "content": "<p>Great!Can you public your code after this game finish?</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 954199,
      "author_name": "Kuo-Hsin Tu",
      "author_url": "",
      "post_date": "2020-08-01T13:40:56.693000",
      "content": "<p>Interesting results 👍\nSome of the generated images look quite realistic. </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 958088,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-08-04T18:58:51.433000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "953879": "Hey everybody, I wanted to share something that didn't end up working out for me, but I think is still pretty interesting.\n\nBack at the beginning of the contest I was trying to generate more training examples using [CycleGAN](https://junyanz.github.io/CycleGAN/). My thinking was that CycleGAN should preserve the location of the wheat heads so I wouldn't need to worry about the bounding boxes.\n\nI tried to transform images from the Arvalis_1 subset to the Ethz_1 subset. I chose those two because they had the most examples. In hindsight, they may not have been the best choices since there seems to be a lot of variation in Arvalis_1 and I'm not sure more images that look like Ethz_1 would be helpful.\n\nIt looked like it was working really well:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F141e471009fb0f3a0358c6e647eff3ee%2FCycleGAN%201.png?generation=1596267020743984&amp;alt=media)\n\nBut unfortunately, when I used fake/generated images into train my object detector, it was slower to converge and performed worse on the validation set. It turns out the GAN was hallucinating wheat textures in brighter areas where they didn't belong and removing the wheat texture in other places. So the bounding boxes weren't correct:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F529e794153878e6fe746e94d4a657deb%2FCycleGan2.jpg?generation=1596267666137025&amp;alt=media)\n\nSo I tried adding a second discriminator and masking out the wheat heads / background. So discriminator 1 only sees wheat heads and discriminator 2 only sees background. That way, if the GAN puts wheat heads in the wrong spot or vice versa, the discriminator should catch it.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82443fccce8207e20a55583e80cc3f3e%2FCycleGan3.jpg?generation=1596268417491010&amp;alt=media)\n\nUnfortunately, the discriminator learned that the bounding box distributions for the two subsets... and to compensate the GAN stated adding grey boxes around the bounding boxes to fool the discriminators! Pretty cool, but not super useful for the contest. \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1202828%2F82e1b36d34d3250a3e59006f0240609a%2FCycleGan4.jpg?generation=1596268761505192&amp;alt=media)\n\n\nI tried adding a third discriminator that used the whole (unmasked) image but at that point I think the whole thing was over-constrained and it failed to make any progress on the losses. \n\nI retried the 2 discriminator approach but I stopped training before the GAN started adding the grey boxes. It improved my local validation results but didn't improve my LB score. By then I had spent WAY too much time trying to generate training images and I moved on to other ideas. \n\n**Additional ideas I didn't get to try:**\n- Randomly crop/scale the images so the bounding boxes are less predictable.\n- Use different subsets.\n- Allow the GAN to hallucinate new wheat heads and then re-label the generated images using a trained detector.\n\n**Did anybody else try to generate new training images? How did it go? I'd love to hear about it!**\n\n\n",
    "954071": "I have not tried cycle-gan but I used style-transfer and pix2pix GAN to generate images.\nHere are some examples:\n\n1. Style Transfer:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2F961c77efee13d5d7a74842d7ab51c270%2Fstyles.jpg?generation=1596279696685115&amp;alt=media)\n\n2. Pix2Pix: (Not that great)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1231059%2Fe62db128712e2ea7384e714d99009650%2Fpix2pix.jpg?generation=1596279779235784&amp;alt=media)\n\n  ",
    "953915": "Very nice experiments. My approach was to generate the images without labels since I thought it would be an easier task. Despite the low scores we are getting in the competition, the task itself is actually not a hard one so I didn't worry much about labeling, I would let my model do the work. I got some pretty decent results but in the end my GAN was too weak, and not very diverse. A handpicked example: ![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1110596%2Ffa03febaae8ec390f2f2615a46f7d0f1%2Fseed8469.png?generation=1596270961097189&amp;alt=media)\n",
    "953886": "Very nice work! I also tried out CycleGAN but abandoned it pretty quickly. I'm glad you were able to generate some nice images out of it, though thats unfortunate it didn't boost your score",
    "958036": "The problem of applying GANs as of now is it too computational costly to get that kind of image quality also in order to increase quality we can probably join it with auto-encoders but again too costly .",
    "954169": "Great!Can you public your code after this game finish?",
    "954199": "Interesting results 👍\nSome of the generated images look quite realistic. ",
    "958088": ""
  }
}