The usage of `AutoAugment`

Ren_Pang: <p><code>AutoAugment</code> is the new stable feature that is introduced in torchvison 0.9.0.<br>
Currently there seems no docs about <code>AutoAugment</code> yet, and I can only get some information from the release blog.</p><aside class="onebox allowlistedgeneric">
  <header class="source">
      <img src="https://pytorch.org/favicon.ico?" class="site-icon" width="32" height="32">
      <a href="https://pytorch.org/blog/pytorch-1.8-new-library-releases/" target="_blank" rel="noopener nofollow ugc">pytorch.org</a>
  </header>
  <article class="onebox-body">
    <img src="https://pytorch.org/assets/images/pytorch-logo.png" class="thumbnail onebox-avatar" width="500" height="500">

<h3><a href="https://pytorch.org/blog/pytorch-1.8-new-library-releases/" target="_blank" rel="noopener nofollow ugc">PyTorch</a></h3>

<p>An open source deep learning platform that provides a seamless path from research prototyping to production deployment.</p>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://user-images.githubusercontent.com/13214530/110225955-49130e80-7eb8-11eb-98a1-7a1ce7ec7802.png" title="image" rel="noopener nofollow ugc"><img src="https://user-images.githubusercontent.com/13214530/110225955-49130e80-7eb8-11eb-98a1-7a1ce7ec7802.png" alt="image" width="690" height="326"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">image</span><span class="informations">2668×1261</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
<p>However, I have some confusions, especially about the recommend usage for CIFAR10 and ImageNet. What’s the correct way to use <code>AutoAugment</code> for CIFAR10 and ImageNet?</p>
<h1>ImageNet</h1>
<p>For ImageNet, my previous conventional transform is</p>
<pre><code class="lang-auto">        if mode == 'train':
            transform = transforms.Compose([
                transforms.RandomResizedCrop((224, 224)),
                transforms.RandomHorizontalFlip(),
                transforms.ToTensor()])
        else:
            transform = transforms.Compose([
                transforms.Resize((256, 256)),
                transforms.CenterCrop((224, 224)),
                transforms.ToTensor()])
</code></pre>
<p>I assume the example in the blog is the recommend transform for ImageNet, but it doesn’t seem to resize(random crop) the shape to 224.</p>
<pre><code class="lang-auto">transform=transforms.Compose([
   transforms.Resize(256),
   transforms.AutoAugment(),
   transforms.ToTensor()])
</code></pre>
<p>So I doubt whether it is necessary to add one more RandomCrop (or a single center crop)</p>
<pre><code class="lang-auto">transform=transforms.Compose([
   transforms.Resize(256),
   transforms.AutoAugment(),
   transforms.RandomResizedCrop((224, 224)),  # transforms.CenterCrop((224, 224)),
   transforms.ToTensor()])
</code></pre>
<h1>CIFAR10</h1>
<p>For CIFAR10, my previous conventional transform is</p>
<pre><code class="lang-auto">        if mode == 'train':
            transform = transforms.Compose([
                transforms.RandomCrop((32, 32), padding=4),
                transforms.RandomHorizontalFlip(),
                transforms.ToTensor()])
        else:
            transform = transforms.ToTensor()
</code></pre>
<p>I doubt when we use AutoAugment, do we need to add the 4-pad and conduct RandomCrop.</p>

bturan: <p>Hey, good question. As far as I understand it, the AutoAugmentation does not resize or crop the image, so you are right with the blog post.</p>