Pytorch实现InceptionV2,Python常见面试题

self.branch3_conv2 = ConvBNReLU(in_channels=out_channels3reduce, out_channels=out_channels3, kernel_size=3,stride=1,padding=1)

self.branch3_conv3a = ConvBNReLUFactorization(in_channels=out_channels3, out_channels=out_channels3, kernel_sizes=[3, 1],paddings=[1, 0])

self.branch3_conv3b = ConvBNReLUFactorization(in_channels=out_channels3, out_channels=out_channels3, kernel_sizes=[1, 3],paddings=[0, 1])

self.branch4 = nn.Sequential(

nn.MaxPool2d(kernel_size=3, stride=1, padding=1),

ConvBNReLU(in_channels=in_channels, out_channels=out_channels4, kernel_size=1),

)

def forward(self, x):

out1 = self.branch1(x)

x2 = self.branch2_conv1(x)

out2 = torch.cat([self.branch2_conv2a(x2), self.branch2_conv2b(x2)],dim=1)

x3 = self.branch3_conv2(self.branch3_conv1(x))

out3 = torch.cat([self.branch3_conv3a(x3), self.branch3_conv3b(x3)], dim=1)

out4 = self.branch4(x)

out = torch.cat([out1, out2, out3, out4], dim=1)

return out

class InceptionV3ModuleD(nn.Module):

def init(self, in_channels,out_channels1reduce,out_channels1,out_channels2reduce, out_channels2):

super(InceptionV3ModuleD, self).init()

self.branch1 = nn.Sequential(

ConvBNReLU(in_channels=in_channels, out_channels=out_channels1reduce, kernel_size=1),

ConvBNReLU(in_channels=out_channels1reduce, out_channels=out_channels1, kernel_size=3,stride=2,padding=1)

)

self.branch2 = nn.Sequential(

ConvBNReLU(in_channels=in_channels, out_channels=out_channels2reduce, kernel_size=1),

ConvBNReLU(in_channels=out_channels2reduce, out_channels=out_channels2, kernel_size=3, stride=1, padding=1),

ConvBNReLU(in_channels=out_channels2, out_channels=out_channels2, kernel_size=3, stride=2,padding=1),

)

self.branch3 = nn.MaxPool2d(kernel_size=3,stride=2,padding=1)

def forward(self, x):

out1 = self.branch1(x)

out2 = self.branch2(x)

out3 = self.branch3(x)

out = torch.cat([out1, out2, out3], dim=1)

return out

class InceptionAux(nn.Module):

def init(self, in_channels,out_channels):

super(InceptionAux, self).init()

self.auxiliary_avgpool = nn.AvgPool2d(kernel_size=5, stride=3)

self.auxiliary_conv1 = ConvBNReLU(in_channels=in_channels, out_channels=128, kernel_size=1)

self.auxiliary_conv2 = nn.Conv2d(in_channels=128, out_channels=768, kernel_size=5,stride=1)

self.auxiliary_dropout = nn.Dropout(p=0.7)

self.auxiliary_linear1 = nn.Linear(in_features=768, out_features=out_channels)

def forward(self, x):

x = self.auxiliary_conv1(self.auxiliary_avgpool(x))

x = self.auxiliary_conv2(x)

x = x.view(x.size(0), -1)

out = self.auxiliary_linear1(self.auxiliary_dropout(x))

return out

class InceptionV2(nn.Module):

def init(self, num_classes=1000, stage=‘train’):

super(InceptionV2, self).init()

self.stage = stage

self.block1 = nn.Sequential(

ConvBNReLU(in_channels=3, out_channels=64, kernel_size=7,stride=2,padding=3),

nn.MaxPool2d(kernel_size=3,stride=2,padding=1),

)

self.block2 = nn.Sequential(

ConvBNReLU(in_channels=64, out_channels=192, kernel_size=3, stride=1, padding=1),

nn.MaxPool2d(kernel_size=3, stride=2,padding=1),

)

self.block3 = nn.Sequential(

InceptionV2ModuleA(in_channels=192,out_channels1=64,out_channels2reduce=64, out_channels2=64, out_channels3reduce=64, out_channels3=96, out_channels4=32),

InceptionV2ModuleA(in_channels=256, out_channels1=64, out_channels2reduce=64, out_channels2=96,out_channels3reduce=64, out_channels3=96, out_channels4=64),

InceptionV3ModuleD(in_channels=320, out_channels1reduce=128, out_channels1=160, out_channels2reduce=64,out_channels2=96),

)

self.block4 = nn.Sequential(

InceptionV2ModuleB(in_channels=576, out_channels1=224, out_channels2reduce=64, out_channels2=96,out_channels3reduce=96, out_channels3=128, out_channels4=128),

InceptionV2ModuleB(in_channels=576, out_channels1=192, out_channels2reduce=96, out_channels2=128,out_channels3reduce=96, out_channels3=128, out_channels4=128),

InceptionV2ModuleB(in_channels=576, out_channels1=160, out_channels2reduce=128, out_channels2=160,out_channels3reduce=128, out_channels3=128, out_channels4=128),

InceptionV2ModuleB(in_channels=576, out_channels1=96, out_channels2reduce=128, out_channels2=192,out_channels3reduce=160, out_channels3=160, out_channels4=128),

InceptionV3ModuleD(in_channels=576, out_channels1reduce=128, out_channels1=192, out_channels2reduce=192,out_channels2=256),

)

self.block5 = nn.Sequential(

InceptionV2ModuleC(in_channels=1024, out_channels1=352, out_channels2reduce=192, out_channels2=160,out_channels3reduce=160, out_channels3=112, out_channels4=128),

InceptionV2ModuleC(in_channels=1024, out_channels1=352, out_channels2reduce=192, out_channels2=160,

out_channels3reduce=192, out_channels3=112, out_channels4=128)

)

self.max_pool = nn.MaxPool2d(kernel_size=7, stride=1)

self.dropout = nn.Dropout(p=0.5)

self.linear = nn.Linear(1024, num_classes)

def forward(self, x):

x = self.block1(x)

x = self.block2(x)

x = self.block3(x)

x = self.block4(x)

x = self.block5(x)

x = self.max_pool(x)

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Python工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Python开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img



既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Python开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注Python)
img

学好 Python 不论是就业还是做副业赚钱都不错,但要学会 Python 还是要有一个学习规划。最后大家分享一份全套的 Python 学习资料,给那些想学习 Python 的小伙伴们一点帮助!

一、Python所有方向的学习路线

Python所有方向路线就是把Python常用的技术点做整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。

二、学习软件

工欲善其事必先利其器。学习Python常用的开发软件都在这里了,给大家节省了很多时间。

三、全套PDF电子书

书籍的好处就在于权威和体系健全,刚开始学习的时候你可以只看视频或者听某个人讲课,但等你学完之后,你觉得你掌握了,这时候建议还是得去看一下书籍,看权威技术书籍也是每个程序员必经之路。

四、入门学习视频

我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了。

五、实战案例

光学理论是没用的,要学会跟着一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。

六、面试资料

我们学习Python必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有阿里大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
img

.csdnimg.cn/img_convert/6c361282296f86381401c05e862fe4e9.png)

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
[外链图片转存中…(img-2Xd5RKQB-1712714314927)]

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值