本文主要是介绍mobilenet模型,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
路径问题
os.path.join()
os.path.join() 函数:连接两个或更多的路径名组件
1.如果各组件名首字母不包含’/’,则函数会自动加上
2.如果有一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃
3.如果最后一个组件为空,则生成的路径以一个’/’分隔符结尾
Demo1
import osPath1 = 'home'
Path2 = 'develop'
Path3 = 'code'Path10 = Path1 + Path2 + Path3
Path20 = os.path.join(Path1,Path2,Path3)
print ('Path10 = ',Path10)
print ('Path20 = ',Path20)
输出
Path10 = homedevelopcode
Path20 = home\develop\code
MobileNet
from torch import nn
import torchdef _make_divisible(ch, divisor=8, min_ch=None):if min_ch is None:min_ch = divisornew_ch = max(min_ch, int(ch + divisor / 2) // divisor * divisor)# Make sure that round down does not go down by more than 10%.if new_ch < 0.9 * ch:new_ch += divisorreturn new_chclass ConvBNReLU(nn.Sequential):def __init__(self, in_channel, out_channel, kernel_size=3, stride=1, groups=1):padding = (kernel_size - 1) // 2super(ConvBNReLU, self).__init__(nn.Conv2d(in_channel, out_channel, kernel_size, stride, padding, groups=groups, bias=False),nn.BatchNorm2d(out_channel),nn.ReLU6(inplace=True))class InvertedResidual(nn.Module):def __init__(self, in_channel,
这篇关于mobilenet模型的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!