{
  "id": 99660,
  "title": "Pytorch transformations on the image arrays",
  "url": "/competitions/generative-dog-images/discussion/99660",
  "author_name": "",
  "post_date": "2019-07-13T04:08:16.244379Z",
  "votes": -1,
  "comment_count": 2,
  "views": 0,
  "content": "<p>How do I use Pytorch transformations for images after I have done some cropping on the images of the folder? </p>",
  "messages": [
    {
      "id": "573973",
      "postDate": "07/13/2019 04:08:16",
      "content": "<p>How do I use Pytorch transformations for images after I have done some cropping on the images of the folder? </p>",
      "rawMarkdown": "How do I use Pytorch transformations for images after I have done some cropping on the images of the folder?",
      "votes": null
    },
    {
      "id": "574185",
      "postDate": "07/13/2019 10:46:59",
      "content": "<p>There are many great examples in public kernels</p>\n\n<pre><code>random_transforms = [transforms.RandomRotation(degrees=5)]\ntransform = transforms.Compose([transforms.Resize(64),\n                            transforms.CenterCrop(64),\n                            transforms.RandomHorizontalFlip(p=0.5),\n                            transforms.RandomApply(random_transforms, p=0.5),\n                            transforms.ToTensor(),\n                            transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n                           ])\n</code></pre>",
      "rawMarkdown": "There are many great examples in public kernels\n\n    random_transforms = [transforms.RandomRotation(degrees=5)]\n    transform = transforms.Compose([transforms.Resize(64),\n                                transforms.CenterCrop(64),\n                                transforms.RandomHorizontalFlip(p=0.5),\n                                transforms.RandomApply(random_transforms, p=0.5),\n                                transforms.ToTensor(),\n                                transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n                               ])",
      "votes": null
    },
    {
      "id": "606438",
      "postDate": "08/23/2019 15:25:55",
      "content": "<p>This is assuming the input images are in greyscale. For RGB:</p>\n\n<p><code>transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])</code></p>",
      "rawMarkdown": "This is assuming the input images are in greyscale. For RGB:\n\n`transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])`",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 574185,
      "author_name": "cdeotte",
      "author_url": "",
      "post_date": "07/13/2019 10:46:59",
      "content": "<p>There are many great examples in public kernels</p>\n\n<pre><code>random_transforms = [transforms.RandomRotation(degrees=5)]\ntransform = transforms.Compose([transforms.Resize(64),\n                            transforms.CenterCrop(64),\n                            transforms.RandomHorizontalFlip(p=0.5),\n                            transforms.RandomApply(random_transforms, p=0.5),\n                            transforms.ToTensor(),\n                            transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n                           ])\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 606438,
          "author_name": "nitinsurya",
          "author_url": "",
          "post_date": "08/23/2019 15:25:55",
          "content": "<p>This is assuming the input images are in greyscale. For RGB:</p>\n\n<p><code>transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])</code></p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "573973": "How do I use Pytorch transformations for images after I have done some cropping on the images of the folder?",
    "574185": "There are many great examples in public kernels\n\n    random_transforms = [transforms.RandomRotation(degrees=5)]\n    transform = transforms.Compose([transforms.Resize(64),\n                                transforms.CenterCrop(64),\n                                transforms.RandomHorizontalFlip(p=0.5),\n                                transforms.RandomApply(random_transforms, p=0.5),\n                                transforms.ToTensor(),\n                                transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n                               ])",
    "606438": "This is assuming the input images are in greyscale. For RGB:\n\n`transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])`"
  },
  "source": "meta"
}