当前位置:网站首页>RESNET code details
RESNET code details
2022-07-03 10:02:00 【Star soul is not a dream】
In order to analyze the network structure : Downloaded netron
snap install netron # System ubuntu

Above picture ,[ ] It means a block .
about 18/34 layer Resnet
block In the official code is : BasicBlock .BasicBlock according to identity whether Down sampling Divided into two . In the diagram above , The green arrow part namely conv3_1, conv4_1, and conv5_1 It's about identity Conduct Down sampling , Realization : (1x1 conv, s=2) , And double each channel . stay In the code , adopt Pass in _make_layer Of stride Is it 1 determine .

about 50/101/152 layer Resnet
block In the official code is : Bottleneck .Bottleneck according to identity whether Down sampling Divided into two . stay chart 1 in , The green arrow part namely conv3_1, conv4_1, and conv5_1 It's about identity Conduct Down sampling , Realization : (1x1 conv, s=2) , And double each channel . stay In the code , adopt Pass in _make_layer Of stride Is it 1 determine .

notes : about 50/101/152 layer Resnet, according to chart 1 We know that through 3x3 Of max pool Then output the characteristic matrix shape Should be [56, 56, 64], But we conv2_x The corresponding The output characteristic matrix of the main branch shape yes [56, 56, 256]. therefore The first level residual structure requires shape from [56, 56, 64] --> [56, 56, 256]. Be careful , Here only adjust channel dimension , The height and width remain the same ( and conv3_1, conv4_1, conv5_1 Corresponding to a series of residual structures First floor dotted line residual structure It's not just about channel double + Halve the height and width ).

Code :
if stride != 1 or self.inplanes != planes * block.expansion:
downsample = nn.Sequential(
conv1x1(self.inplanes, planes * block.expansion, stride),
nn.BatchNorm2d(planes * block.expansion),
)self.inplanes != planes * block.expansion : 64!= 64 * 4
Reference resources :
边栏推荐
- Introduction to chromium embedded framework (CEF)
- 2.Elment Ui 日期选择器 格式化问题
- All processes of top ten management in project management
- Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
- STM32 port multiplexing and remapping
- [Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
- An executable binary file contains more than machine instructions
- 要选择那种语言为单片机编写程序呢
- Screen display of charging pile design -- led driver ta6932
- Crash工具基本使用及实战分享
猜你喜欢

Adaptiveavgpool1d internal implementation

Blue Bridge Cup for migrant workers majoring in electronic information engineering

03 fastjason solves circular references

学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里

2021-10-27

El table X-axis direction (horizontal) scroll bar slides to the right by default

Timer and counter of 51 single chip microcomputer

When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn

干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己

Eight working modes of stm32gpio and chip naming rules
随机推荐
单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
Synchronization control between tasks
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
2020-08-23
我想各位朋友都应该知道学习的基本规律就是:从易到难
Hal library sets STM32 clock
2021-10-28
A lottery like scissors, stone and cloth (C language)
In third tier cities and counties, it is difficult to get 10K after graduation
2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
STM32 interrupt priority management
Pymssql controls SQL for Chinese queries
01仿B站项目业务架构
2.Elment Ui 日期选择器 格式化问题
Emballage automatique et déballage compris? Quel est le principe?
Circular queue related design and implementation reference 1
Project cost management__ Topic of comprehensive calculation
MySQL 数据库基础知识(系统化一篇入门)
My 4G smart charging pile gateway design and development related articles
getopt_ Typical use of long function