Deployed 80c3051 with MkDocs version: 1.1.2

gh-pages
Ross Wightman 4 years ago
parent 3a63858dd8
commit 4f6e4af795

@ -186,8 +186,8 @@
<li class="md-nav__item"> <li class="md-nav__item">
<a href="/models/" title="Models" class="md-nav__link"> <a href="/models/" title="Model Architectures" class="md-nav__link">
Models Model Architectures
</a> </a>
</li> </li>
@ -198,8 +198,68 @@
<li class="md-nav__item"> <li class="md-nav__item">
<a href="/changes/" title="Changes" class="md-nav__link"> <a href="/results/" title="Results" class="md-nav__link">
Changes Results
</a>
</li>
<li class="md-nav__item">
<a href="/scripts/" title="Scripts" class="md-nav__link">
Scripts
</a>
</li>
<li class="md-nav__item">
<a href="/training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item">
<a href="/feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a>
</li>
<li class="md-nav__item">
<a href="/changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item">
<a href="/archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a> </a>
</li> </li>
@ -261,6 +321,10 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="/javascripts/tables.js"></script>
</body> </body>
</html> </html>

@ -0,0 +1,726 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Pretained Image Recognition Models">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.4.0">
<title>Archived Changes - Pytorch Image Models</title>
<link rel="stylesheet" href="../assets/stylesheets/main.fe0cca5b.min.css">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#archived-changes" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="Header">
<a href=".." title="Pytorch Image Models" class="md-header-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header-nav__title" data-md-component="header-title">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
Pytorch Image Models
</span>
<span class="md-header-nav__topic md-ellipsis">
Archived Changes
</span>
</div>
</div>
<label class="md-header-nav__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Pytorch Image Models" class="md-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
Pytorch Image Models
</label>
<div class="md-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." title="Getting Started" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a href="../models/" title="Model Architectures" class="md-nav__link">
Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="../results/" title="Results" class="md-nav__link">
Results
</a>
</li>
<li class="md-nav__item">
<a href="../scripts/" title="Scripts" class="md-nav__link">
Scripts
</a>
</li>
<li class="md-nav__item">
<a href="../training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item">
<a href="../feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a>
</li>
<li class="md-nav__item">
<a href="../changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Archived Changes
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span>
</label>
<a href="./" title="Archived Changes" class="md-nav__link md-nav__link--active">
Archived Changes
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#feb-29-2020" class="md-nav__link">
Feb 29, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-18-2020" class="md-nav__link">
Feb 18, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020" class="md-nav__link">
Feb 12, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-6-2020" class="md-nav__link">
Feb 6, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020_1" class="md-nav__link">
Feb 1/2, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-31-2020" class="md-nav__link">
Jan 31, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-1112-2020" class="md-nav__link">
Jan 11/12, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-3-2020" class="md-nav__link">
Jan 3, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#dec-30-2019" class="md-nav__link">
Dec 30, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-28-2019" class="md-nav__link">
Dec 28, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-23-2019" class="md-nav__link">
Dec 23, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-4-2019" class="md-nav__link">
Dec 4, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#nov-29-2019" class="md-nav__link">
Nov 29, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#nov-22-2019" class="md-nav__link">
Nov 22, 2019
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#feb-29-2020" class="md-nav__link">
Feb 29, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-18-2020" class="md-nav__link">
Feb 18, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020" class="md-nav__link">
Feb 12, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-6-2020" class="md-nav__link">
Feb 6, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020_1" class="md-nav__link">
Feb 1/2, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-31-2020" class="md-nav__link">
Jan 31, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-1112-2020" class="md-nav__link">
Jan 11/12, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#jan-3-2020" class="md-nav__link">
Jan 3, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#dec-30-2019" class="md-nav__link">
Dec 30, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-28-2019" class="md-nav__link">
Dec 28, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-23-2019" class="md-nav__link">
Dec 23, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#dec-4-2019" class="md-nav__link">
Dec 4, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#nov-29-2019" class="md-nav__link">
Nov 29, 2019
</a>
</li>
<li class="md-nav__item">
<a href="#nov-22-2019" class="md-nav__link">
Nov 22, 2019
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/rwightman/pytorch-image-models/edit/master/docs/archived_changes.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="archived-changes">Archived Changes</h1>
<h3 id="feb-29-2020">Feb 29, 2020</h3>
<ul>
<li>New MobileNet-V3 Large weights trained from stratch with this code to 75.77% top-1</li>
<li>IMPORTANT CHANGE - default weight init changed for all MobilenetV3 / EfficientNet / related models</li>
<li>overall results similar to a bit better training from scratch on a few smaller models tried</li>
<li>performance early in training seems consistently improved but less difference by end</li>
<li>set <code>fix_group_fanout=False</code> in <code>_init_weight_goog</code> fn if you need to reproducte past behaviour</li>
<li>Experimental LR noise feature added applies a random perturbation to LR each epoch in specified range of training</li>
</ul>
<h3 id="feb-18-2020">Feb 18, 2020</h3>
<ul>
<li>Big refactor of model layers and addition of several attention mechanisms. Several additions motivated by 'Compounding the Performance Improvements...' (<a href="https://arxiv.org/abs/2001.06268">https://arxiv.org/abs/2001.06268</a>):</li>
<li>Move layer/module impl into <code>layers</code> subfolder/module of <code>models</code> and organize in a more granular fashion</li>
<li>ResNet downsample paths now properly support dilation (output stride != 32) for avg_pool ('D' variant) and 3x3 (SENets) networks</li>
<li>Add Selective Kernel Nets on top of ResNet base, pretrained weights<ul>
<li>skresnet18 - 73% top-1</li>
<li>skresnet34 - 76.9% top-1 </li>
<li>skresnext50_32x4d (equiv to SKNet50) - 80.2% top-1</li>
</ul>
</li>
<li>ECA and CECA (circular padding) attention layer contributed by <a href="https://github.com/VRandme">Chris Ha</a></li>
<li>CBAM attention experiment (not the best results so far, may remove)</li>
<li>Attention factory to allow dynamically selecting one of SE, ECA, CBAM in the <code>.se</code> position for all ResNets</li>
<li>Add DropBlock and DropPath (formerly DropConnect for EfficientNet/MobileNetv3) support to all ResNet variants</li>
<li>Full dataset results updated that incl NoisyStudent weights and 2 of the 3 SK weights</li>
</ul>
<h3 id="feb-12-2020">Feb 12, 2020</h3>
<ul>
<li>Add EfficientNet-L2 and B0-B7 NoisyStudent weights ported from <a href="https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet">Tensorflow TPU</a></li>
</ul>
<h3 id="feb-6-2020">Feb 6, 2020</h3>
<ul>
<li>Add RandAugment trained EfficientNet-ES (EdgeTPU-Small) weights with 78.1 top-1. Trained by <a href="https://github.com/andravin">Andrew Lavin</a> (see Training section for hparams)</li>
</ul>
<h3 id="feb-12-2020_1">Feb &frac12;, 2020</h3>
<ul>
<li>Port new EfficientNet-B8 (RandAugment) weights, these are different than the B8 AdvProp, different input normalization.</li>
<li>Update results csv files on all models for ImageNet validation and three other test sets</li>
<li>Push PyPi package update</li>
</ul>
<h3 id="jan-31-2020">Jan 31, 2020</h3>
<ul>
<li>Update ResNet50 weights with a new 79.038 result from further JSD / AugMix experiments. Full command line for reproduction in training section below.</li>
</ul>
<h3 id="jan-1112-2020">Jan 11/12, 2020</h3>
<ul>
<li>Master may be a bit unstable wrt to training, these changes have been tested but not all combos</li>
<li>Implementations of AugMix added to existing RA and AA. Including numerous supporting pieces like JSD loss (Jensen-Shannon divergence + CE), and AugMixDataset</li>
<li>SplitBatchNorm adaptation layer added for implementing Auxiliary BN as per AdvProp paper</li>
<li>ResNet-50 AugMix trained model w/ 79% top-1 added</li>
<li><code>seresnext26tn_32x4d</code> - 77.99 top-1, 93.75 top-5 added to tiered experiment, higher img/s than 't' and 'd'</li>
</ul>
<h3 id="jan-3-2020">Jan 3, 2020</h3>
<ul>
<li>Add RandAugment trained EfficientNet-B0 weight with 77.7 top-1. Trained by <a href="https://github.com/michaelklachko">Michael Klachko</a> with this code and recent hparams (see Training section)</li>
<li>Add <code>avg_checkpoints.py</code> script for post training weight averaging and update all scripts with header docstrings and shebangs.</li>
</ul>
<h3 id="dec-30-2019">Dec 30, 2019</h3>
<ul>
<li>Merge <a href="https://github.com/mehtadushy">Dushyant Mehta's</a> PR for SelecSLS (Selective Short and Long Range Skip Connections) networks. Good GPU memory consumption and throughput. Original: <a href="https://github.com/mehtadushy/SelecSLS-Pytorch">https://github.com/mehtadushy/SelecSLS-Pytorch</a></li>
</ul>
<h3 id="dec-28-2019">Dec 28, 2019</h3>
<ul>
<li>Add new model weights and training hparams (see Training Hparams section)</li>
<li><code>efficientnet_b3</code> - 81.5 top-1, 95.7 top-5 at default res/crop, 81.9, 95.8 at 320x320 1.0 crop-pct<ul>
<li>trained with RandAugment, ended up with an interesting but less than perfect result (see training section)</li>
</ul>
</li>
<li><code>seresnext26d_32x4d</code>- 77.6 top-1, 93.6 top-5<ul>
<li>deep stem (32, 32, 64), avgpool downsample</li>
<li>stem/dowsample from bag-of-tricks paper</li>
</ul>
</li>
<li><code>seresnext26t_32x4d</code>- 78.0 top-1, 93.7 top-5<ul>
<li>deep tiered stem (24, 48, 64), avgpool downsample (a modified 'D' variant)</li>
<li>stem sizing mods from Jeremy Howard and fastai devs discussing ResNet architecture experiments</li>
</ul>
</li>
</ul>
<h3 id="dec-23-2019">Dec 23, 2019</h3>
<ul>
<li>Add RandAugment trained MixNet-XL weights with 80.48 top-1.</li>
<li><code>--dist-bn</code> argument added to train.py, will distribute BN stats between nodes after each train epoch, before eval</li>
</ul>
<h3 id="dec-4-2019">Dec 4, 2019</h3>
<ul>
<li>Added weights from the first training from scratch of an EfficientNet (B2) with my new RandAugment implementation. Much better than my previous B2 and very close to the official AdvProp ones (80.4 top-1, 95.08 top-5).</li>
</ul>
<h3 id="nov-29-2019">Nov 29, 2019</h3>
<ul>
<li>Brought EfficientNet and MobileNetV3 up to date with my <a href="https://github.com/rwightman/gen-efficientnet-pytorch">https://github.com/rwightman/gen-efficientnet-pytorch</a> code. Torchscript and ONNX export compat excluded.</li>
<li>AdvProp weights added</li>
<li>Official TF MobileNetv3 weights added</li>
<li>EfficientNet and MobileNetV3 hook based 'feature extraction' classes added. Will serve as basis for using models as backbones in obj detection/segmentation tasks. Lots more to be done here...</li>
<li>HRNet classification models and weights added from <a href="https://github.com/HRNet/HRNet-Image-Classification">https://github.com/HRNet/HRNet-Image-Classification</a></li>
<li>Consistency in global pooling, <code>reset_classifer</code>, and <code>forward_features</code> across models</li>
<li><code>forward_features</code> always returns unpooled feature maps now</li>
<li>Reasonable chance I broke something... let me know</li>
</ul>
<h3 id="nov-22-2019">Nov 22, 2019</h3>
<ul>
<li>Add ImageNet training RandAugment implementation alongside AutoAugment. PyTorch Transform compatible format, using PIL. Currently training two EfficientNet models from scratch with promising results... will update.</li>
<li><code>drop-connect</code> cmd line arg finally added to <code>train.py</code>, no need to hack model fns. Works for efficientnet/mobilenetv3 based models, ignored otherwise.</li>
</ul>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="../changes/" title="Recent Changes" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Recent Changes
</div>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/vendor.d710d30a.min.js"></script>
<script src="../assets/javascripts/bundle.b39636ac.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
<script>
app = initialize({
base: "..",
features: [],
search: Object.assign({
worker: "../assets/javascripts/worker/search.a68abb33.min.js"
}, typeof search !== "undefined" && search)
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="../javascripts/tables.js"></script>
</body>
</html>

@ -17,7 +17,7 @@
<title>Changes - Pytorch Image Models</title> <title>Recent Changes - Pytorch Image Models</title>
@ -51,7 +51,7 @@
<div data-md-component="skip"> <div data-md-component="skip">
<a href="#june-11-2020" class="md-skip"> <a href="#recent-changes" class="md-skip">
Skip to content Skip to content
</a> </a>
@ -79,7 +79,7 @@
</span> </span>
<span class="md-header-nav__topic md-ellipsis"> <span class="md-header-nav__topic md-ellipsis">
Changes Recent Changes
</span> </span>
</div> </div>
@ -191,8 +191,56 @@
<li class="md-nav__item"> <li class="md-nav__item">
<a href="../models/" title="Models" class="md-nav__link"> <a href="../models/" title="Model Architectures" class="md-nav__link">
Models Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="../results/" title="Results" class="md-nav__link">
Results
</a>
</li>
<li class="md-nav__item">
<a href="../scripts/" title="Scripts" class="md-nav__link">
Scripts
</a>
</li>
<li class="md-nav__item">
<a href="../training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item">
<a href="../feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a> </a>
</li> </li>
@ -208,22 +256,26 @@
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc"> <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc"> <label class="md-nav__link md-nav__link--active" for="__toc">
Changes Recent Changes
<span class="md-nav__icon md-icon"> <span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span> </span>
</label> </label>
<a href="./" title="Changes" class="md-nav__link md-nav__link--active"> <a href="./" title="Recent Changes" class="md-nav__link md-nav__link--active">
Changes Recent Changes
</a> </a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc"> <label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"> <span class="md-nav__icon md-icon">
@ -233,6 +285,13 @@
</label> </label>
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#aug-1-2020" class="md-nav__link">
Aug 1, 2020
</a>
</li>
<li class="md-nav__item"> <li class="md-nav__item">
<a href="#june-11-2020" class="md-nav__link"> <a href="#june-11-2020" class="md-nav__link">
June 11, 2020 June 11, 2020
@ -273,27 +332,6 @@
March 18, 2020 March 18, 2020
</a> </a>
</li>
<li class="md-nav__item">
<a href="#feb-29-2020" class="md-nav__link">
Feb 29, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-18-2020" class="md-nav__link">
Feb 18, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020" class="md-nav__link">
Feb 12, 2020
</a>
</li> </li>
</ul> </ul>
@ -303,6 +341,18 @@
</li> </li>
<li class="md-nav__item">
<a href="../archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a>
</li>
</ul> </ul>
</nav> </nav>
</div> </div>
@ -317,6 +367,8 @@
<nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc"> <label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"> <span class="md-nav__icon md-icon">
@ -326,6 +378,13 @@
</label> </label>
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#aug-1-2020" class="md-nav__link">
Aug 1, 2020
</a>
</li>
<li class="md-nav__item"> <li class="md-nav__item">
<a href="#june-11-2020" class="md-nav__link"> <a href="#june-11-2020" class="md-nav__link">
June 11, 2020 June 11, 2020
@ -366,27 +425,6 @@
March 18, 2020 March 18, 2020
</a> </a>
</li>
<li class="md-nav__item">
<a href="#feb-29-2020" class="md-nav__link">
Feb 29, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-18-2020" class="md-nav__link">
Feb 18, 2020
</a>
</li>
<li class="md-nav__item">
<a href="#feb-12-2020" class="md-nav__link">
Feb 12, 2020
</a>
</li> </li>
</ul> </ul>
@ -409,9 +447,22 @@
<h1>Changes</h1> <h1 id="recent-changes">Recent Changes</h1>
<h3 id="aug-1-2020">Aug 1, 2020</h3>
<h3 id="june-11-2020">June 11, 2020</h3> <p>Universal feature extraction, new models, new weights, new test sets.
* All models support the <code>features_only=True</code> argument for <code>create_model</code> call to return a network that extracts features from the deepest layer at each stride.
* New models
* CSPResNet, CSPResNeXt, CSPDarkNet, DarkNet
* ReXNet
* (Aligned) Xception41/65/71 (a proper port of TF models)
* New trained weights
* SEResNet50 - 80.3
* CSPDarkNet53 - 80.1 top-1
* CSPResNeXt50 - 80.0 to-1
* DPN68b - 79.2 top-1
* EfficientNet-Lite0 (non-TF ver) - 75.5 (submitted by @hal-314)
* Add 'real' labels for ImageNet and ImageNet-Renditions test set, see <a href="results/README.md"><code>results/README.md</code></a></p>
<h3 id="june-11-2020">June 11, 2020</h3>
<p>Bunch of changes:</p> <p>Bunch of changes:</p>
<ul> <ul>
<li>DenseNet models updated with memory efficient addition from torchvision (fixed a bug), blur pooling and deep stem additions</li> <li>DenseNet models updated with memory efficient addition from torchvision (fixed a bug), blur pooling and deep stem additions</li>
@ -454,36 +505,6 @@
<li>Add EfficientNet-Lite models w/ weights ported from <a href="https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite">Tensorflow TPU</a></li> <li>Add EfficientNet-Lite models w/ weights ported from <a href="https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite">Tensorflow TPU</a></li>
<li>Add RandAugment trained ResNeXt-50 32x4d weights with 79.8 top-1. Trained by <a href="https://github.com/andravin">Andrew Lavin</a> (see Training section for hparams)</li> <li>Add RandAugment trained ResNeXt-50 32x4d weights with 79.8 top-1. Trained by <a href="https://github.com/andravin">Andrew Lavin</a> (see Training section for hparams)</li>
</ul> </ul>
<h3 id="feb-29-2020">Feb 29, 2020</h3>
<ul>
<li>New MobileNet-V3 Large weights trained from stratch with this code to 75.77% top-1</li>
<li>IMPORTANT CHANGE - default weight init changed for all MobilenetV3 / EfficientNet / related models</li>
<li>overall results similar to a bit better training from scratch on a few smaller models tried</li>
<li>performance early in training seems consistently improved but less difference by end</li>
<li>set <code>fix_group_fanout=False</code> in <code>_init_weight_goog</code> fn if you need to reproducte past behaviour</li>
<li>Experimental LR noise feature added applies a random perturbation to LR each epoch in specified range of training</li>
</ul>
<h3 id="feb-18-2020">Feb 18, 2020</h3>
<ul>
<li>Big refactor of model layers and addition of several attention mechanisms. Several additions motivated by 'Compounding the Performance Improvements...' (<a href="https://arxiv.org/abs/2001.06268">https://arxiv.org/abs/2001.06268</a>):</li>
<li>Move layer/module impl into <code>layers</code> subfolder/module of <code>models</code> and organize in a more granular fashion</li>
<li>ResNet downsample paths now properly support dilation (output stride != 32) for avg_pool ('D' variant) and 3x3 (SENets) networks</li>
<li>Add Selective Kernel Nets on top of ResNet base, pretrained weights<ul>
<li>skresnet18 - 73% top-1</li>
<li>skresnet34 - 76.9% top-1 </li>
<li>skresnext50_32x4d (equiv to SKNet50) - 80.2% top-1</li>
</ul>
</li>
<li>ECA and CECA (circular padding) attention layer contributed by <a href="https://github.com/VRandme">Chris Ha</a></li>
<li>CBAM attention experiment (not the best results so far, may remove)</li>
<li>Attention factory to allow dynamically selecting one of SE, ECA, CBAM in the <code>.se</code> position for all ResNets</li>
<li>Add DropBlock and DropPath (formerly DropConnect for EfficientNet/MobileNetv3) support to all ResNet variants</li>
<li>Full dataset results updated that incl NoisyStudent weights and 2 of the 3 SK weights</li>
</ul>
<h3 id="feb-12-2020">Feb 12, 2020</h3>
<ul>
<li>Add EfficientNet-L2 and B0-B7 NoisyStudent weights ported from <a href="https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet">Tensorflow TPU</a></li>
</ul>
@ -502,7 +523,7 @@
<div class="md-footer-nav"> <div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer"> <nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="../models/" title="Models" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <a href="../feature_extraction/" title="Feature Extraction" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon"> <div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div> </div>
@ -511,12 +532,26 @@
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Previous Previous
</span> </span>
Models Feature Extraction
</div> </div>
</div> </div>
</a> </a>
<a href="../archived_changes/" title="Archived Changes" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Archived Changes
</div>
</div>
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav> </nav>
</div> </div>
@ -551,6 +586,10 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="../javascripts/tables.js"></script>
</body> </body>
</html> </html>

@ -0,0 +1,785 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Pretained Image Recognition Models">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.4.0">
<title>Feature Extraction - Pytorch Image Models</title>
<link rel="stylesheet" href="../assets/stylesheets/main.fe0cca5b.min.css">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#feature-extraction" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="Header">
<a href=".." title="Pytorch Image Models" class="md-header-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header-nav__title" data-md-component="header-title">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
Pytorch Image Models
</span>
<span class="md-header-nav__topic md-ellipsis">
Feature Extraction
</span>
</div>
</div>
<label class="md-header-nav__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Pytorch Image Models" class="md-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
Pytorch Image Models
</label>
<div class="md-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." title="Getting Started" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a href="../models/" title="Model Architectures" class="md-nav__link">
Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="../results/" title="Results" class="md-nav__link">
Results
</a>
</li>
<li class="md-nav__item">
<a href="../scripts/" title="Scripts" class="md-nav__link">
Scripts
</a>
</li>
<li class="md-nav__item">
<a href="../training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Feature Extraction
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span>
</label>
<a href="./" title="Feature Extraction" class="md-nav__link md-nav__link--active">
Feature Extraction
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#penultimate-layer-features-pre-classifier-features" class="md-nav__link">
Penultimate Layer Features (Pre-Classifier Features)
</a>
<nav class="md-nav" aria-label="Penultimate Layer Features (Pre-Classifier Features)">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#unpooled" class="md-nav__link">
Unpooled
</a>
<nav class="md-nav" aria-label="Unpooled">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#forward_features" class="md-nav__link">
forward_features()
</a>
</li>
<li class="md-nav__item">
<a href="#create-with-no-classifier-and-pooling" class="md-nav__link">
Create with no classifier and pooling
</a>
</li>
<li class="md-nav__item">
<a href="#remove-it-later" class="md-nav__link">
Remove it later
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#pooled" class="md-nav__link">
Pooled
</a>
<nav class="md-nav" aria-label="Pooled">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#create-with-no-classifier" class="md-nav__link">
Create with no classifier
</a>
</li>
<li class="md-nav__item">
<a href="#remove-it-later_1" class="md-nav__link">
Remove it later
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#multi-scale-feature-maps-feature-pyramid" class="md-nav__link">
Multi-scale Feature Maps (Feature Pyramid)
</a>
<nav class="md-nav" aria-label="Multi-scale Feature Maps (Feature Pyramid)">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#create-a-feature-map-extraction-model" class="md-nav__link">
Create a feature map extraction model
</a>
</li>
<li class="md-nav__item">
<a href="#query-the-feature-information" class="md-nav__link">
Query the feature information
</a>
</li>
<li class="md-nav__item">
<a href="#select-specific-feature-levels-or-limit-the-stride" class="md-nav__link">
Select specific feature levels or limit the stride
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item">
<a href="../archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#penultimate-layer-features-pre-classifier-features" class="md-nav__link">
Penultimate Layer Features (Pre-Classifier Features)
</a>
<nav class="md-nav" aria-label="Penultimate Layer Features (Pre-Classifier Features)">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#unpooled" class="md-nav__link">
Unpooled
</a>
<nav class="md-nav" aria-label="Unpooled">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#forward_features" class="md-nav__link">
forward_features()
</a>
</li>
<li class="md-nav__item">
<a href="#create-with-no-classifier-and-pooling" class="md-nav__link">
Create with no classifier and pooling
</a>
</li>
<li class="md-nav__item">
<a href="#remove-it-later" class="md-nav__link">
Remove it later
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#pooled" class="md-nav__link">
Pooled
</a>
<nav class="md-nav" aria-label="Pooled">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#create-with-no-classifier" class="md-nav__link">
Create with no classifier
</a>
</li>
<li class="md-nav__item">
<a href="#remove-it-later_1" class="md-nav__link">
Remove it later
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#multi-scale-feature-maps-feature-pyramid" class="md-nav__link">
Multi-scale Feature Maps (Feature Pyramid)
</a>
<nav class="md-nav" aria-label="Multi-scale Feature Maps (Feature Pyramid)">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#create-a-feature-map-extraction-model" class="md-nav__link">
Create a feature map extraction model
</a>
</li>
<li class="md-nav__item">
<a href="#query-the-feature-information" class="md-nav__link">
Query the feature information
</a>
</li>
<li class="md-nav__item">
<a href="#select-specific-feature-levels-or-limit-the-stride" class="md-nav__link">
Select specific feature levels or limit the stride
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/rwightman/pytorch-image-models/edit/master/docs/feature_extraction.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="feature-extraction">Feature Extraction</h1>
<p>All of the models in <code>timm</code> have consistent mechanisms for obtaining various types of features from the model for tasks besides classification.</p>
<h2 id="penultimate-layer-features-pre-classifier-features">Penultimate Layer Features (Pre-Classifier Features)</h2>
<p>The features from the penultimate model layer can be obtained in severay ways without requiring model surgery (although feel free to do surgery). One must first decide if they want pooled or un-pooled features.</p>
<h3 id="unpooled">Unpooled</h3>
<p>There are three ways to obtain unpooled features.</p>
<p>Without modifying the network, one can call <code>model.forward_features(input)</code> on any model instead of the usual <code>model(input)</code>. This will bypass the head classifier and global pooling for networks.</p>
<p>If one wants to explicitly modify the network to return unpooled features, they can either create the model without a classifier and pooling, or remove it later. Both paths remove the parameters associated with the classifier from the network.</p>
<h4 id="forward_features">forward_features()</h4>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;xception41&#39;</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">299</span><span class="p">,</span> <span class="mi">299</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Original shape: {o.shape}&#39;</span><span class="p">)</span>
<span class="hll"><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">forward_features</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">299</span><span class="p">,</span> <span class="mi">299</span><span class="p">))</span>
</span><span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Unpooled shape: {o.shape}&#39;</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Original shape: torch.Size([2, 1000])
Unpooled shape: torch.Size([2, 2048, 10, 10])
</code></pre></div></p>
<h4 id="create-with-no-classifier-and-pooling">Create with no classifier and pooling</h4>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;resnet50&#39;</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">global_pool</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Unpooled shape: {o.shape}&#39;</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Unpooled shape: torch.Size([2, 2048, 7, 7])
</code></pre></div></p>
<h4 id="remove-it-later">Remove it later</h4>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;densenet121&#39;</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Original shape: {o.shape}&#39;</span><span class="p">)</span>
<span class="hll"><span class="n">m</span><span class="o">.</span><span class="n">reset_classifier</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Unpooled shape: {o.shape}&#39;</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Original shape: torch.Size([2, 1000])
Unpooled shape: torch.Size([2, 1024, 7, 7])
</code></pre></div></p>
<h3 id="pooled">Pooled</h3>
<p>To modify the network to return pooled features, one can use <code>forward_features()</code> and pool/flatten the result themselves, or modify the network like above but keep pooling intact. </p>
<h4 id="create-with-no-classifier">Create with no classifier</h4>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;resnet50&#39;</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Pooled shape: {o.shape}&#39;</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Pooled shape: torch.Size([2, 2048])
</code></pre></div></p>
<h4 id="remove-it-later_1">Remove it later</h4>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;ese_vovnet19b_dw&#39;</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Original shape: {o.shape}&#39;</span><span class="p">)</span>
<span class="hll"><span class="n">m</span><span class="o">.</span><span class="n">reset_classifier</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Pooled shape: {o.shape}&#39;</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Pooled shape: torch.Size([2, 1024])
</code></pre></div></p>
<h2 id="multi-scale-feature-maps-feature-pyramid">Multi-scale Feature Maps (Feature Pyramid)</h2>
<p>Object detection, segmentation, keypoint, and a variety of dense pixel tasks require access to feature maps from the backbone network at multiple scales. This is often done by modifying the original classification network. Since each network varies quite a bit in structure, it's not uncommon to see only a few backbones supported in any given obj detection or segmentation library.</p>
<p><code>timm</code> allows a consistent interface for creating any of the included models as feature backbones that output feature maps for selected levels. </p>
<p>A feature backbone can be created by adding the argument <code>features_only=True</code> to any <code>create_model</code> call. By default 5 strides will be output from most models (not all have that many), with the first starting at 2 (some start at 1 or 4).</p>
<h3 id="create-a-feature-map-extraction-model">Create a feature map extraction model</h3>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;resnest26d&#39;</span><span class="p">,</span> <span class="n">features_only</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">o</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>torch.Size([2, 64, 112, 112])
torch.Size([2, 256, 56, 56])
torch.Size([2, 512, 28, 28])
torch.Size([2, 1024, 14, 14])
torch.Size([2, 2048, 7, 7])
</code></pre></div></p>
<h3 id="query-the-feature-information">Query the feature information</h3>
<p>After a feature backbone has been created, it can be queried to provide channel or resolution reduction information to the downstream heads without requiring static config or hardcoded constants. The <code>.feature_info</code> attribute is a class encapsulating the information about the feature extraction points.</p>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;regnety_032&#39;</span><span class="p">,</span> <span class="n">features_only</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="hll"><span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Feature channels: {m.feature_info.channels()}&#39;</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">224</span><span class="p">))</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">o</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Feature channels: [32, 72, 216, 576, 1512]
torch.Size([2, 32, 112, 112])
torch.Size([2, 72, 56, 56])
torch.Size([2, 216, 28, 28])
torch.Size([2, 576, 14, 14])
torch.Size([2, 1512, 7, 7])
</code></pre></div></p>
<h3 id="select-specific-feature-levels-or-limit-the-stride">Select specific feature levels or limit the stride</h3>
<p>There are to additional creation arguments impacting the output features. </p>
<ul>
<li><code>out_indices</code> selects which indices to output</li>
<li><code>output_stride</code> limits the feature output stride of the network (also works in classification mode BTW)</li>
</ul>
<p><code>out_indices</code> is supported by all models, but not all models have the same index to feature stride mapping. Look at the code or check feature_info to compare. The out indices generally correspond to the <code>C(i+1)th</code> feature level (a <code>2^(i+1)</code> reduction). For most models, index 0 is the stride 2 features, and index 4 is stride 32.</p>
<p><code>output_stride</code> is achieved by converting layers to use dilated convolutions. Doing so is not always straightforward, some networks only support <code>output_stride=32</code>.</p>
<p><div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">timm</span>
<span class="hll"><span class="n">m</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">create_model</span><span class="p">(</span><span class="s1">&#39;ecaresnet101d&#39;</span><span class="p">,</span> <span class="n">features_only</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">output_stride</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">out_indices</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</span><span class="hll"><span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Feature channels: {m.feature_info.channels()}&#39;</span><span class="p">)</span>
</span><span class="hll"><span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;Feature reduction: {m.feature_info.reduction()}&#39;</span><span class="p">)</span>
</span><span class="n">o</span> <span class="o">=</span> <span class="n">m</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">320</span><span class="p">,</span> <span class="mi">320</span><span class="p">))</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">o</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
</code></pre></div>
Output:
<div class="highlight"><pre><span></span><code>Feature channels: [512, 2048]
Feature reduction: [8, 8]
torch.Size([2, 512, 40, 40])
torch.Size([2, 2048, 40, 40])
</code></pre></div></p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="../training_hparam_examples/" title="Training Examples" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Training Examples
</div>
</div>
</a>
<a href="../changes/" title="Recent Changes" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Recent Changes
</div>
</div>
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/vendor.d710d30a.min.js"></script>
<script src="../assets/javascripts/bundle.b39636ac.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
<script>
app = initialize({
base: "..",
features: [],
search: Object.assign({
worker: "../assets/javascripts/worker/search.a68abb33.min.js"
}, typeof search !== "undefined" && search)
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="../javascripts/tables.js"></script>
</body>
</html>

@ -221,8 +221,22 @@
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
<a href="#load-pretrained-model" class="md-nav__link"> <a href="#load-a-pretrained-model" class="md-nav__link">
Load Pretrained Model Load a Pretrained Model
</a>
</li>
<li class="md-nav__item">
<a href="#list-models-with-pretrained-weights" class="md-nav__link">
List Models with Pretrained Weights
</a>
</li>
<li class="md-nav__item">
<a href="#list-model-architectures-by-wildcard" class="md-nav__link">
List Model Architectures by Wildcard
</a> </a>
</li> </li>
@ -240,8 +254,20 @@
<li class="md-nav__item"> <li class="md-nav__item">
<a href="models/" title="Models" class="md-nav__link"> <a href="models/" title="Model Architectures" class="md-nav__link">
Models Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="results/" title="Results" class="md-nav__link">
Results
</a> </a>
</li> </li>
@ -252,8 +278,56 @@
<li class="md-nav__item"> <li class="md-nav__item">
<a href="changes/" title="Changes" class="md-nav__link"> <a href="scripts/" title="Scripts" class="md-nav__link">
Changes Scripts
</a>
</li>
<li class="md-nav__item">
<a href="training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item">
<a href="feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a>
</li>
<li class="md-nav__item">
<a href="changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item">
<a href="archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a> </a>
</li> </li>
@ -291,8 +365,22 @@
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
<a href="#load-pretrained-model" class="md-nav__link"> <a href="#load-a-pretrained-model" class="md-nav__link">
Load Pretrained Model Load a Pretrained Model
</a>
</li>
<li class="md-nav__item">
<a href="#list-models-with-pretrained-weights" class="md-nav__link">
List Models with Pretrained Weights
</a>
</li>
<li class="md-nav__item">
<a href="#list-model-architectures-by-wildcard" class="md-nav__link">
List Model Architectures by Wildcard
</a> </a>
</li> </li>
@ -325,17 +413,17 @@
<div class="admonition info"> <div class="admonition info">
<p class="admonition-title">Conda Environment</p> <p class="admonition-title">Conda Environment</p>
<p>All development and testing has been done in Conda Python 3 environments <p>All development and testing has been done in Conda Python 3 environments on Linux x86-64 systems, specifically Python 3.6.x, 3.7.x., 3.8.x.</p>
on Linux x86-64 systems, specifically Python 3.6.x and 3.7.x. </p> <p>Little to no care has been taken to be Python 2.x friendly and will not support it. If you run into any challenges running on Windows, or other OS, I'm definitely open to looking into those issues so long as it's in a reproducible (read Conda) environment.</p>
<p>To install <code>timm</code> in a conda environment: <p>PyTorch versions 1.4, 1.5.x, and 1.6 have been tested with this code.</p>
<p>I've tried to keep the dependencies minimal, the setup is as per the PyTorch default install instructions for Conda:
<div class="highlight"><pre><span></span><code>conda create -n torch-env <div class="highlight"><pre><span></span><code>conda create -n torch-env
conda activate torch-env conda activate torch-env
conda install -c pytorch pytorch torchvision cudatoolkit=10.1 conda install -c pytorch pytorch torchvision cudatoolkit=10.2
conda install pyyaml conda install pyyaml
pip install timm
</code></pre></div></p> </code></pre></div></p>
</div> </div>
<h2 id="load-pretrained-model">Load Pretrained Model</h2> <h2 id="load-a-pretrained-model">Load a Pretrained Model</h2>
<p>Pretrained models can be loaded using <code>timm.create_model</code></p> <p>Pretrained models can be loaded using <code>timm.create_model</code></p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">timm</span> <div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">timm</span>
@ -343,8 +431,37 @@ pip install timm
<span class="n">m</span><span class="o">.</span><span class="n">eval</span><span class="p">()</span> <span class="n">m</span><span class="o">.</span><span class="n">eval</span><span class="p">()</span>
</code></pre></div> </code></pre></div>
<p>To load a different model see <a href="/models <h2 id="list-models-with-pretrained-weights">List Models with Pretrained Weights</h2>
/#pretrained-imagenet-weights">the list of pretrained weights</a>.</p> <div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">timm</span>
<span class="kn">from</span> <span class="nn">pprint</span> <span class="kn">import</span> <span class="n">pprint</span>
<span class="n">model_names</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">list_models</span><span class="p">(</span><span class="n">pretrained</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">model_names</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="p">[</span><span class="s1">&#39;adv_inception_v3&#39;</span><span class="p">,</span>
<span class="s1">&#39;cspdarknet53&#39;</span><span class="p">,</span>
<span class="s1">&#39;cspresnext50&#39;</span><span class="p">,</span>
<span class="s1">&#39;densenet121&#39;</span><span class="p">,</span>
<span class="s1">&#39;densenet161&#39;</span><span class="p">,</span>
<span class="s1">&#39;densenet169&#39;</span><span class="p">,</span>
<span class="s1">&#39;densenet201&#39;</span><span class="p">,</span>
<span class="s1">&#39;densenetblur121d&#39;</span><span class="p">,</span>
<span class="s1">&#39;dla34&#39;</span><span class="p">,</span>
<span class="s1">&#39;dla46_c&#39;</span><span class="p">,</span>
<span class="o">...</span>
<span class="p">]</span>
</code></pre></div>
<h2 id="list-model-architectures-by-wildcard">List Model Architectures by Wildcard</h2>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">timm</span>
<span class="kn">from</span> <span class="nn">pprint</span> <span class="kn">import</span> <span class="n">pprint</span>
<span class="n">model_names</span> <span class="o">=</span> <span class="n">timm</span><span class="o">.</span><span class="n">list_models</span><span class="p">(</span><span class="s1">&#39;*resne*t*&#39;</span><span class="p">)</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">model_names</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="p">[</span><span class="s1">&#39;cspresnet50&#39;</span><span class="p">,</span>
<span class="s1">&#39;cspresnet50d&#39;</span><span class="p">,</span>
<span class="s1">&#39;cspresnet50w&#39;</span><span class="p">,</span>
<span class="s1">&#39;cspresnext50&#39;</span><span class="p">,</span>
<span class="o">...</span>
<span class="p">]</span>
</code></pre></div>
@ -364,13 +481,13 @@ pip install timm
<nav class="md-footer-nav__inner md-grid" aria-label="Footer"> <nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="models/" title="Models" class="md-footer-nav__link md-footer-nav__link--next" rel="next"> <a href="models/" title="Model Architectures" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title"> <div class="md-footer-nav__title">
<div class="md-ellipsis"> <div class="md-ellipsis">
<span class="md-footer-nav__direction"> <span class="md-footer-nav__direction">
Next Next
</span> </span>
Models Model Architectures
</div> </div>
</div> </div>
<div class="md-footer-nav__button md-icon"> <div class="md-footer-nav__button md-icon">
@ -412,6 +529,10 @@ pip install timm
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="javascripts/tables.js"></script>
</body> </body>
</html> </html>

@ -0,0 +1,6 @@
app.location$.subscribe(function() {
var tables = document.querySelectorAll("article table")
tables.forEach(function(table) {
new Tablesort(table)
})
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,482 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Pretained Image Recognition Models">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.4.0">
<title>Scripts - Pytorch Image Models</title>
<link rel="stylesheet" href="../assets/stylesheets/main.fe0cca5b.min.css">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#scripts" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="Header">
<a href=".." title="Pytorch Image Models" class="md-header-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header-nav__title" data-md-component="header-title">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
Pytorch Image Models
</span>
<span class="md-header-nav__topic md-ellipsis">
Scripts
</span>
</div>
</div>
<label class="md-header-nav__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Pytorch Image Models" class="md-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
Pytorch Image Models
</label>
<div class="md-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." title="Getting Started" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a href="../models/" title="Model Architectures" class="md-nav__link">
Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="../results/" title="Results" class="md-nav__link">
Results
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Scripts
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span>
</label>
<a href="./" title="Scripts" class="md-nav__link md-nav__link--active">
Scripts
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#training-script" class="md-nav__link">
Training Script
</a>
</li>
<li class="md-nav__item">
<a href="#validation-inference-scripts" class="md-nav__link">
Validation / Inference Scripts
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../training_hparam_examples/" title="Training Examples" class="md-nav__link">
Training Examples
</a>
</li>
<li class="md-nav__item">
<a href="../feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a>
</li>
<li class="md-nav__item">
<a href="../changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item">
<a href="../archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#training-script" class="md-nav__link">
Training Script
</a>
</li>
<li class="md-nav__item">
<a href="#validation-inference-scripts" class="md-nav__link">
Validation / Inference Scripts
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/rwightman/pytorch-image-models/edit/master/docs/scripts.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="scripts">Scripts</h1>
<p>A train, validation, inference, and checkpoint cleaning script included in the github root folder. Scripts are not currently packaged in the pip release.</p>
<p>The training and validation scripts evolved from early versions of the <a href="https://github.com/pytorch/examples">PyTorch Imagenet Examples</a>. I have added significant functionality over time, including CUDA specific performance enhancements based on
<a href="https://github.com/NVIDIA/apex/tree/master/examples">NVIDIA's APEX Examples</a>.</p>
<h2 id="training-script">Training Script</h2>
<p>The variety of training args is large and not all combinations of options (or even options) have been fully tested. For the training dataset folder, specify the folder to the base that contains a <code>train</code> and <code>validation</code> folder.</p>
<p>To train an SE-ResNet34 on ImageNet, locally distributed, 4 GPUs, one process per GPU w/ cosine schedule, random-erasing prob of 50% and per-pixel random value:</p>
<p><code>./distributed_train.sh 4 /data/imagenet --model seresnet34 --sched cosine --epochs 150 --warmup-epochs 5 --lr 0.4 --reprob 0.5 --remode pixel --batch-size 256 -j 4</code></p>
<p>NOTE: NVIDIA APEX should be installed to run in per-process distributed via DDP or to enable AMP mixed precision with the --amp flag</p>
<h2 id="validation-inference-scripts">Validation / Inference Scripts</h2>
<p>Validation and inference scripts are similar in usage. One outputs metrics on a validation set and the other outputs topk class ids in a csv. Specify the folder containing validation images, not the base as in training script. </p>
<p>To validate with the model's pretrained weights (if they exist):</p>
<p><code>python validate.py /imagenet/validation/ --model seresnext26_32x4d --pretrained</code></p>
<p>To run inference from a checkpoint:</p>
<p><code>python inference.py /imagenet/validation/ --model mobilenetv3_large_100 --checkpoint ./output/model_best.pth.tar</code></p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="../results/" title="Results" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Results
</div>
</div>
</a>
<a href="../training_hparam_examples/" title="Training Examples" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Training Examples
</div>
</div>
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/vendor.d710d30a.min.js"></script>
<script src="../assets/javascripts/bundle.b39636ac.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
<script>
app = initialize({
base: "..",
features: [],
search: Object.assign({
worker: "../assets/javascripts/worker/search.a68abb33.min.js"
}, typeof search !== "undefined" && search)
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="../javascripts/tables.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

@ -1,15 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-07-10</lastmod> <lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-07-10</lastmod> <lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-07-10</lastmod> <lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-08-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>

Binary file not shown.

@ -0,0 +1,591 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Pretained Image Recognition Models">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.4.0">
<title>Training Examples - Pytorch Image Models</title>
<link rel="stylesheet" href="../assets/stylesheets/main.fe0cca5b.min.css">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#training-examples" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="Header">
<a href=".." title="Pytorch Image Models" class="md-header-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header-nav__title" data-md-component="header-title">
<div class="md-header-nav__ellipsis">
<span class="md-header-nav__topic md-ellipsis">
Pytorch Image Models
</span>
<span class="md-header-nav__topic md-ellipsis">
Training Examples
</span>
</div>
</div>
<label class="md-header-nav__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Pytorch Image Models" class="md-nav__button md-logo" aria-label="Pytorch Image Models">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
</a>
Pytorch Image Models
</label>
<div class="md-nav__source">
<a href="https://github.com/rwightman/pytorch-image-models/" title="Go to repository" class="md-source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 00-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 01-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 000 40.81l195.61 195.6a28.86 28.86 0 0040.8 0l194.69-194.69a28.86 28.86 0 000-40.81z"/></svg>
</div>
<div class="md-source__repository">
rwightman/pytorch-image-models
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." title="Getting Started" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a href="../models/" title="Model Architectures" class="md-nav__link">
Model Architectures
</a>
</li>
<li class="md-nav__item">
<a href="../results/" title="Results" class="md-nav__link">
Results
</a>
</li>
<li class="md-nav__item">
<a href="../scripts/" title="Scripts" class="md-nav__link">
Scripts
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Training Examples
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
</span>
</label>
<a href="./" title="Training Examples" class="md-nav__link md-nav__link--active">
Training Examples
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#efficientnet-b2-with-randaugment-804-top-1-951-top-5" class="md-nav__link">
EfficientNet-B2 with RandAugment - 80.4 top-1, 95.1 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#mixnet-xl-with-randaugment-805-top-1-949-top-5" class="md-nav__link">
MixNet-XL with RandAugment - 80.5 top-1, 94.9 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#se-resnext-26-d-and-se-resnext-26-t" class="md-nav__link">
SE-ResNeXt-26-D and SE-ResNeXt-26-T
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-b3-with-randaugment-815-top-1-957-top-5" class="md-nav__link">
EfficientNet-B3 with RandAugment - 81.5 top-1, 95.7 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-b0-with-randaugment-777-top-1-953-top-5" class="md-nav__link">
EfficientNet-B0 with RandAugment - 77.7 top-1, 95.3 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#resnet50-with-jsd-loss-and-randaugment-clean-2x-ra-augs-7904-top-1-9439-top-5" class="md-nav__link">
ResNet50 with JSD loss and RandAugment (clean + 2x RA augs) - 79.04 top-1, 94.39 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-es-edgetpu-small-with-randaugment-78066-top-1-93926-top-5" class="md-nav__link">
EfficientNet-ES (EdgeTPU-Small) with RandAugment - 78.066 top-1, 93.926 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#mobilenetv3-large-100-75766-top-1-92542-top-5" class="md-nav__link">
MobileNetV3-Large-100 - 75.766 top-1, 92,542 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#resnext-50-32x4d-w-randaugment-79762-top-1-9460-top-5" class="md-nav__link">
ResNeXt-50 32x4d w/ RandAugment - 79.762 top-1, 94.60 top-5
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../feature_extraction/" title="Feature Extraction" class="md-nav__link">
Feature Extraction
</a>
</li>
<li class="md-nav__item">
<a href="../changes/" title="Recent Changes" class="md-nav__link">
Recent Changes
</a>
</li>
<li class="md-nav__item">
<a href="../archived_changes/" title="Archived Changes" class="md-nav__link">
Archived Changes
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</span>
Table of contents
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#efficientnet-b2-with-randaugment-804-top-1-951-top-5" class="md-nav__link">
EfficientNet-B2 with RandAugment - 80.4 top-1, 95.1 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#mixnet-xl-with-randaugment-805-top-1-949-top-5" class="md-nav__link">
MixNet-XL with RandAugment - 80.5 top-1, 94.9 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#se-resnext-26-d-and-se-resnext-26-t" class="md-nav__link">
SE-ResNeXt-26-D and SE-ResNeXt-26-T
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-b3-with-randaugment-815-top-1-957-top-5" class="md-nav__link">
EfficientNet-B3 with RandAugment - 81.5 top-1, 95.7 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-b0-with-randaugment-777-top-1-953-top-5" class="md-nav__link">
EfficientNet-B0 with RandAugment - 77.7 top-1, 95.3 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#resnet50-with-jsd-loss-and-randaugment-clean-2x-ra-augs-7904-top-1-9439-top-5" class="md-nav__link">
ResNet50 with JSD loss and RandAugment (clean + 2x RA augs) - 79.04 top-1, 94.39 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#efficientnet-es-edgetpu-small-with-randaugment-78066-top-1-93926-top-5" class="md-nav__link">
EfficientNet-ES (EdgeTPU-Small) with RandAugment - 78.066 top-1, 93.926 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#mobilenetv3-large-100-75766-top-1-92542-top-5" class="md-nav__link">
MobileNetV3-Large-100 - 75.766 top-1, 92,542 top-5
</a>
</li>
<li class="md-nav__item">
<a href="#resnext-50-32x4d-w-randaugment-79762-top-1-9460-top-5" class="md-nav__link">
ResNeXt-50 32x4d w/ RandAugment - 79.762 top-1, 94.60 top-5
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/rwightman/pytorch-image-models/edit/master/docs/training_hparam_examples.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="training-examples">Training Examples</h1>
<h2 id="efficientnet-b2-with-randaugment-804-top-1-951-top-5">EfficientNet-B2 with RandAugment - 80.4 top-1, 95.1 top-5</h2>
<p>These params are for dual Titan RTX cards with NVIDIA Apex installed:</p>
<p><code>./distributed_train.sh 2 /imagenet/ --model efficientnet_b2 -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.3 --drop-connect 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .016</code></p>
<h2 id="mixnet-xl-with-randaugment-805-top-1-949-top-5">MixNet-XL with RandAugment - 80.5 top-1, 94.9 top-5</h2>
<p>This params are for dual Titan RTX cards with NVIDIA Apex installed:</p>
<p><code>./distributed_train.sh 2 /imagenet/ --model mixnet_xl -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .969 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.3 --drop-connect 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.3 --amp --lr .016 --dist-bn reduce</code></p>
<h2 id="se-resnext-26-d-and-se-resnext-26-t">SE-ResNeXt-26-D and SE-ResNeXt-26-T</h2>
<p>These hparams (or similar) work well for a wide range of ResNet architecture, generally a good idea to increase the epoch # as the model size increases... ie approx 180-200 for ResNe(X)t50, and 220+ for larger. Increase batch size and LR proportionally for better GPUs or with AMP enabled. These params were for 2 1080Ti cards:</p>
<p><code>./distributed_train.sh 2 /imagenet/ --model seresnext26t_32x4d --lr 0.1 --warmup-epochs 5 --epochs 160 --weight-decay 1e-4 --sched cosine --reprob 0.4 --remode pixel -b 112</code></p>
<h2 id="efficientnet-b3-with-randaugment-815-top-1-957-top-5">EfficientNet-B3 with RandAugment - 81.5 top-1, 95.7 top-5</h2>
<p>The training of this model started with the same command line as EfficientNet-B2 w/ RA above. After almost three weeks of training the process crashed. The results weren't looking amazing so I resumed the training several times with tweaks to a few params (increase RE prob, decrease rand-aug, increase ema-decay). Nothing looked great. I ended up averaging the best checkpoints from all restarts. The result is mediocre at default res/crop but oddly performs much better with a full image test crop of 1.0. </p>
<h2 id="efficientnet-b0-with-randaugment-777-top-1-953-top-5">EfficientNet-B0 with RandAugment - 77.7 top-1, 95.3 top-5</h2>
<p><a href="https://github.com/michaelklachko">Michael Klachko</a> achieved these results with the command line for B2 adapted for larger batch size, with the recommended B0 dropout rate of 0.2.</p>
<p><code>./distributed_train.sh 2 /imagenet/ --model efficientnet_b0 -b 384 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-connect 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .048</code></p>
<h2 id="resnet50-with-jsd-loss-and-randaugment-clean-2x-ra-augs-7904-top-1-9439-top-5">ResNet50 with JSD loss and RandAugment (clean + 2x RA augs) - 79.04 top-1, 94.39 top-5</h2>
<p>Trained on two older 1080Ti cards, this took a while. Only slightly, non statistically better ImageNet validation result than my first good AugMix training of 78.99. However, these weights are more robust on tests with ImageNetV2, ImageNet-Sketch, etc. Unlike my first AugMix runs, I've enabled SplitBatchNorm, disabled random erasing on the clean split, and cranked up random erasing prob on the 2 augmented paths.</p>
<p><code>./distributed_train.sh 2 /imagenet -b 64 --model resnet50 --sched cosine --epochs 200 --lr 0.05 --amp --remode pixel --reprob 0.6 --aug-splits 3 --aa rand-m9-mstd0.5-inc1 --resplit --split-bn --jsd --dist-bn reduce</code></p>
<h2 id="efficientnet-es-edgetpu-small-with-randaugment-78066-top-1-93926-top-5">EfficientNet-ES (EdgeTPU-Small) with RandAugment - 78.066 top-1, 93.926 top-5</h2>
<p>Trained by <a href="https://github.com/andravin">Andrew Lavin</a> with 8 V100 cards. Model EMA was not used, final checkpoint is the average of 8 best checkpoints during training.</p>
<p><code>./distributed_train.sh 8 /imagenet --model efficientnet_es -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-connect 0.2 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .064</code></p>
<h2 id="mobilenetv3-large-100-75766-top-1-92542-top-5">MobileNetV3-Large-100 - 75.766 top-1, 92,542 top-5</h2>
<p><code>./distributed_train.sh 2 /imagenet/ --model mobilenetv3_large_100 -b 512 --sched step --epochs 600 --decay-epochs 2.4 --decay-rate .973 --opt rmsproptf --opt-eps .001 -j 7 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-connect 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .064 --lr-noise 0.42 0.9</code></p>
<h2 id="resnext-50-32x4d-w-randaugment-79762-top-1-9460-top-5">ResNeXt-50 32x4d w/ RandAugment - 79.762 top-1, 94.60 top-5</h2>
<p>These params will also work well for SE-ResNeXt-50 and SK-ResNeXt-50 and likely 101. I used them for the SK-ResNeXt-50 32x4d that I trained with 2 GPU using a slightly higher LR per effective batch size (lr=0.18, b=192 per GPU). The cmd line below are tuned for 8 GPU training.</p>
<p><code>./distributed_train.sh 8 /imagenet --model resnext50_32x4d --lr 0.6 --warmup-epochs 5 --epochs 240 --weight-decay 1e-4 --sched cosine --reprob 0.4 --recount 3 --remode pixel --aa rand-m7-mstd0.5-inc1 -b 192 -j 6 --amp --dist-bn reduce</code></p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid" aria-label="Footer">
<a href="../scripts/" title="Scripts" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Scripts
</div>
</div>
</a>
<a href="../feature_extraction/" title="Feature Extraction" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-footer-nav__title">
<div class="md-ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Feature Extraction
</div>
</div>
<div class="md-footer-nav__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/vendor.d710d30a.min.js"></script>
<script src="../assets/javascripts/bundle.b39636ac.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
<script>
app = initialize({
base: "..",
features: [],
search: Object.assign({
worker: "../assets/javascripts/worker/search.a68abb33.min.js"
}, typeof search !== "undefined" && search)
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js"></script>
<script src="../javascripts/tables.js"></script>
</body>
</html>
Loading…
Cancel
Save