forked from fastai/fastai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vision.models.html
152 lines (112 loc) · 8.53 KB
/
vision.models.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
title: vision.models
keywords: fastai
sidebar: home_sidebar
summary: "Overview of the models used for CV in fastai"
---
<!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: docs_src/vision.models.ipynb
# instructions: https://docs.fast.ai/gen_doc_main.html
-->
<div class="container" id="notebook-container">
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Computer-Vision-models-zoo">Computer Vision models zoo<a class="anchor-link" href="#Computer-Vision-models-zoo">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The fastai library includes several pretrained models from <a href="https://pytorch.org/docs/stable/torchvision/models.html">torchvision</a>, namely:</p>
<ul>
<li>resnet18, resnet34, resnet50, resnet50, resnet101, resnet152</li>
<li>squeezenet1_0, squeezenet1_1</li>
<li>densenet121, densenet169, densenet201, densenet161</li>
<li>vgg16_bn, vgg19_bn</li>
<li>alexnet</li>
</ul>
<p>On top of the models offered by torchvision, fastai has implementations for the following models:</p>
<ul>
<li>Darknet architecture, which is the base of <a href="https://pjreddie.com/media/files/papers/YOLOv3.pdf">Yolo v3</a></li>
<li>Unet architecture based on a pretrained model. The original unet is described <a href="https://arxiv.org/abs/1505.04597">here</a>, the model implementation is detailed in <a href="/vision.models.unet.html#vision.models.unet"><code>models.unet</code></a></li>
<li>Wide resnets architectures, as introduced in <a href="https://arxiv.org/abs/1605.07146">this article</a></li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="Darknet" class="doc_header"><code>class</code> <code>Darknet</code><a href="https://github.com/fastai/fastai/blob/master/fastai/vision/models/darknet.py#L21" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#Darknet-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>Darknet</code>(<strong><code>num_blocks</code></strong>:<code>Collection</code>[<code>int</code>], <strong><code>num_classes</code></strong>:<code>int</code>, <strong><code>nf</code></strong>=<strong><em><code>32</code></em></strong>) :: <a href="/core.html#PrePostInitMeta"><code>PrePostInitMeta</code></a> :: <a href="/torch_core.html#Module"><code>Module</code></a></p>
</blockquote>
<div class="collapse" id="Darknet-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#Darknet-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>Darknet</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p><a href="https://github.com/pjreddie/darknet">https://github.com/pjreddie/darknet</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Create a Darknet with blocks of sizes given in <code>num_blocks</code>, ending with <code>num_classes</code> and using <code>nf</code> initial features. Darknet53 uses <code>num_blocks = [1,2,8,8,4]</code>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="WideResNet" class="doc_header"><code>class</code> <code>WideResNet</code><a href="https://github.com/fastai/fastai/blob/master/fastai/vision/models/wrn.py#L37" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#WideResNet-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>WideResNet</code>(<strong><code>num_groups</code></strong>:<code>int</code>, <strong><code>N</code></strong>:<code>int</code>, <strong><code>num_classes</code></strong>:<code>int</code>, <strong><code>k</code></strong>:<code>int</code>=<strong><em><code>1</code></em></strong>, <strong><code>drop_p</code></strong>:<code>float</code>=<strong><em><code>0.0</code></em></strong>, <strong><code>start_nf</code></strong>:<code>int</code>=<strong><em><code>16</code></em></strong>, <strong><code>n_in_channels</code></strong>:<code>int</code>=<strong><em><code>3</code></em></strong>) :: <a href="/core.html#PrePostInitMeta"><code>PrePostInitMeta</code></a> :: <a href="/torch_core.html#Module"><code>Module</code></a></p>
</blockquote>
<div class="collapse" id="WideResNet-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#WideResNet-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>WideResNet</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Wide ResNet with <code>num_groups</code> and a width of <code>k</code>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Each group contains <code>N</code> blocks. <code>start_nf</code> the initial number of features. Dropout of <code>drop_p</code> is applied in between the two convolutions in each block. The expected input channel size is fixed at 3.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Structure: initial convolution -> <code>num_groups</code> x <code>N</code> blocks -> final layers of regularization and pooling</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The first block of each group joins a path containing 2 convolutions with filter size 3x3 (and various regularizations) with another path containing a single convolution with a filter size of 1x1. All other blocks in each group follow the more traditional res_block style, i.e., the input of the path with two convs is added to the output of that path.</p>
<p>In the first group the stride is 1 for all convolutions. In all subsequent groups the stride in the first convolution of the first block is 2 and then all following convolutions have a stride of 1. Padding is always 1.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="wrn_22" class="doc_header"><code>wrn_22</code><a href="https://github.com/fastai/fastai/blob/master/fastai/vision/models/wrn.py#L54" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#wrn_22-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>wrn_22</code>()</p>
</blockquote>
<div class="collapse" id="wrn_22-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#wrn_22-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>wrn_22</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Wide ResNet with 22 layers.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>This is a <a href="/vision.models.wrn.html#WideResNet"><code>WideResNet</code></a> with <code>num_groups=3</code>, <code>N=3</code>, <code>k=6</code> and <code>drop_p=0.</code>.</p>
</div>
</div>
</div>
</div>