{
  "id": 210926,
  "title": "How to implement snapmix?",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/210926",
  "author_name": "",
  "post_date": "2021-01-13T02:22:47.945819200Z",
  "votes": 1,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I read <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/202627\" target=\"_blank\">this discussion</a>.<br>\nThough I tried to implement snapmix refer to git <a href=\"https://github.com/Shaoli-Huang/SnapMix/tree/main/utils\" target=\"_blank\">here</a>, I  couldn't.</p>\n<p>I guess I should use <code>snapmix</code> function in utils, mixmethod.py.<br>\nBut I don't know how to use,  because <code>snapmix</code> function needs some config or other function.</p>\n<p>Which code should I quote from git to use snapmix?<br>\nHow do you implement it?</p>",
  "messages": [
    {
      "id": "1150962",
      "postDate": "01/13/2021 02:22:47",
      "content": "<p>I read <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/202627\" target=\"_blank\">this discussion</a>.<br>\nThough I tried to implement snapmix refer to git <a href=\"https://github.com/Shaoli-Huang/SnapMix/tree/main/utils\" target=\"_blank\">here</a>, I  couldn't.</p>\n<p>I guess I should use <code>snapmix</code> function in utils, mixmethod.py.<br>\nBut I don't know how to use,  because <code>snapmix</code> function needs some config or other function.</p>\n<p>Which code should I quote from git to use snapmix?<br>\nHow do you implement it?</p>",
      "rawMarkdown": "I read [this discussion](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/202627).\nThough I tried to implement snapmix refer to git [here](https://github.com/Shaoli-Huang/SnapMix/tree/main/utils), I  couldn't.\n\nI guess I should use <code>snapmix</code> function in utils, mixmethod.py.\nBut I don't know how to use,  because <code>snapmix</code> function needs some config or other function.\n\nWhich code should I quote from git to use snapmix?\nHow do you implement it?",
      "votes": null
    },
    {
      "id": "1151087",
      "postDate": "01/13/2021 06:04:44",
      "content": "<p>Since the effect of mixup and cutmix in this project is limited, I want to know whether this enhancement is more suitable for this project than mixup and cutmix?</p>",
      "rawMarkdown": "Since the effect of mixup and cutmix in this project is limited, I want to know whether this enhancement is more suitable for this project than mixup and cutmix?",
      "votes": null
    },
    {
      "id": "1151294",
      "postDate": "01/13/2021 08:14:26",
      "content": "<p>There's several Kaggle datasets that contain the repository, if you search for them. You can add those to your notebook as data and then use something like <code>sys.path.insert(1, '../input/snapmix/')</code>. There's at least two example notebooks that show this: e.g. <a href=\"https://www.kaggle.com/shaolihuang/training-with-snapmix\" target=\"_blank\">this one</a> or <a href=\"https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline\" target=\"_blank\">that one</a>.</p>",
      "rawMarkdown": "There's several Kaggle datasets that contain the repository, if you search for them. You can add those to your notebook as data and then use something like `sys.path.insert(1, '../input/snapmix/')`. There's at least two example notebooks that show this: e.g. [this one](https://www.kaggle.com/shaolihuang/training-with-snapmix) or [that one](https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline).",
      "votes": null
    },
    {
      "id": "1151302",
      "postDate": "01/13/2021 08:20:42",
      "content": "<p>Snapmix should in theory lead to a more appropriate mixing of classes than mixup and cutmix. The problem in the competition is that just some small areas of the picture may matter for determing the class - e.g. if the edge of one or two leaves shows a disease, this may determine the class of the image. Mixing in some background area from another disease might not change the correct label, at all. That's in contrast to some other image datasets, where e.g. an image of a cat (or dog) fills a lot of the image and every part of the cat matters to some extent (pointy ears, the eyes, the whiskers, the tail, the paws, etc.).</p>\n<p>The good thing about snapmix is that it mixes (or at least aims to) in the area of the other image that matter. To me that makes sense for mixing two images for different diseases and proportionally changing the label. It may not make so much sense for mixing photos of diseased leaves with ones that are not diseased (because a little area with disease and the rest looking healthy still means there's the disease present, while with two diseases, I'd guess the predominant disease was labelled).</p>",
      "rawMarkdown": "Snapmix should in theory lead to a more appropriate mixing of classes than mixup and cutmix. The problem in the competition is that just some small areas of the picture may matter for determing the class - e.g. if the edge of one or two leaves shows a disease, this may determine the class of the image. Mixing in some background area from another disease might not change the correct label, at all. That's in contrast to some other image datasets, where e.g. an image of a cat (or dog) fills a lot of the image and every part of the cat matters to some extent (pointy ears, the eyes, the whiskers, the tail, the paws, etc.).\n\nThe good thing about snapmix is that it mixes (or at least aims to) in the area of the other image that matter. To me that makes sense for mixing two images for different diseases and proportionally changing the label. It may not make so much sense for mixing photos of diseased leaves with ones that are not diseased (because a little area with disease and the rest looking healthy still means there's the disease present, while with two diseases, I'd guess the predominant disease was labelled).",
      "votes": null
    },
    {
      "id": "1151754",
      "postDate": "01/13/2021 14:36:22",
      "content": "<p>Look at this kernel <a href=\"https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline\" target=\"_blank\">https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline</a></p>",
      "rawMarkdown": "Look at this kernel https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline",
      "votes": null
    },
    {
      "id": "1152818",
      "postDate": "01/14/2021 13:20:54",
      "content": "<p>Thank you so much!</p>",
      "rawMarkdown": "Thank you so much!",
      "votes": null
    },
    {
      "id": "1152819",
      "postDate": "01/14/2021 13:21:27",
      "content": "<p>I got it! Thanks!</p>",
      "rawMarkdown": "I got it! Thanks!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1151087,
      "author_name": "zhangeng",
      "author_url": "",
      "post_date": "01/13/2021 06:04:44",
      "content": "<p>Since the effect of mixup and cutmix in this project is limited, I want to know whether this enhancement is more suitable for this project than mixup and cutmix?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1151302,
          "author_name": "bjoernholzhauer",
          "author_url": "",
          "post_date": "01/13/2021 08:20:42",
          "content": "<p>Snapmix should in theory lead to a more appropriate mixing of classes than mixup and cutmix. The problem in the competition is that just some small areas of the picture may matter for determing the class - e.g. if the edge of one or two leaves shows a disease, this may determine the class of the image. Mixing in some background area from another disease might not change the correct label, at all. That's in contrast to some other image datasets, where e.g. an image of a cat (or dog) fills a lot of the image and every part of the cat matters to some extent (pointy ears, the eyes, the whiskers, the tail, the paws, etc.).</p>\n<p>The good thing about snapmix is that it mixes (or at least aims to) in the area of the other image that matter. To me that makes sense for mixing two images for different diseases and proportionally changing the label. It may not make so much sense for mixing photos of diseased leaves with ones that are not diseased (because a little area with disease and the rest looking healthy still means there's the disease present, while with two diseases, I'd guess the predominant disease was labelled).</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1151294,
      "author_name": "bjoernholzhauer",
      "author_url": "",
      "post_date": "01/13/2021 08:14:26",
      "content": "<p>There's several Kaggle datasets that contain the repository, if you search for them. You can add those to your notebook as data and then use something like <code>sys.path.insert(1, '../input/snapmix/')</code>. There's at least two example notebooks that show this: e.g. <a href=\"https://www.kaggle.com/shaolihuang/training-with-snapmix\" target=\"_blank\">this one</a> or <a href=\"https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline\" target=\"_blank\">that one</a>.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1152819,
          "author_name": "tt0721",
          "author_url": "",
          "post_date": "01/14/2021 13:21:27",
          "content": "<p>I got it! Thanks!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1151754,
      "author_name": "raghaw",
      "author_url": "",
      "post_date": "01/13/2021 14:36:22",
      "content": "<p>Look at this kernel <a href=\"https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline\" target=\"_blank\">https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1152818,
          "author_name": "tt0721",
          "author_url": "",
          "post_date": "01/14/2021 13:20:54",
          "content": "<p>Thank you so much!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1150962": "I read [this discussion](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/202627).\nThough I tried to implement snapmix refer to git [here](https://github.com/Shaoli-Huang/SnapMix/tree/main/utils), I  couldn't.\n\nI guess I should use <code>snapmix</code> function in utils, mixmethod.py.\nBut I don't know how to use,  because <code>snapmix</code> function needs some config or other function.\n\nWhich code should I quote from git to use snapmix?\nHow do you implement it?",
    "1151087": "Since the effect of mixup and cutmix in this project is limited, I want to know whether this enhancement is more suitable for this project than mixup and cutmix?",
    "1151294": "There's several Kaggle datasets that contain the repository, if you search for them. You can add those to your notebook as data and then use something like `sys.path.insert(1, '../input/snapmix/')`. There's at least two example notebooks that show this: e.g. [this one](https://www.kaggle.com/shaolihuang/training-with-snapmix) or [that one](https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline).",
    "1151302": "Snapmix should in theory lead to a more appropriate mixing of classes than mixup and cutmix. The problem in the competition is that just some small areas of the picture may matter for determing the class - e.g. if the edge of one or two leaves shows a disease, this may determine the class of the image. Mixing in some background area from another disease might not change the correct label, at all. That's in contrast to some other image datasets, where e.g. an image of a cat (or dog) fills a lot of the image and every part of the cat matters to some extent (pointy ears, the eyes, the whiskers, the tail, the paws, etc.).\n\nThe good thing about snapmix is that it mixes (or at least aims to) in the area of the other image that matter. To me that makes sense for mixing two images for different diseases and proportionally changing the label. It may not make so much sense for mixing photos of diseased leaves with ones that are not diseased (because a little area with disease and the rest looking healthy still means there's the disease present, while with two diseases, I'd guess the predominant disease was labelled).",
    "1151754": "Look at this kernel https://www.kaggle.com/sachinprabhu/pytorch-resnet50-snapmix-train-pipeline",
    "1152818": "Thank you so much!",
    "1152819": "I got it! Thanks!"
  },
  "source": "meta"
}