def AddInceptionA(img, in_channels, pool_features): branch1x1 = AddBasicConv(img, (64, in_channels, 1, 1)) branch5x5 = AddBasicConv(img, (48, in_channels, 1, 1)) branch5x5 = AddBasicConv(branch5x5.GetOutTensor(0), (64, 48, 5, 5), padding=2) branch3x3dbl = AddBasicConv(img, (64, in_channels, 1, 1)) branch3x3dbl = AddBasicConv(branch3x3dbl.GetOutTensor(0), (96, 64, 3, 3), padding=1) branch3x3dbl = AddBasicConv(branch3x3dbl.GetOutTensor(0), (96, 96, 3, 3), padding=1) branch_pool = nn_ops.Pooling(img, (3, 3), stride=1, pad=1) branch_pool = AddBasicConv(branch_pool.GetOutTensor(0), (pool_features, in_channels, 1, 1)) outputs = nn_ops.Concat([ branch1x1.GetOutTensor(0), branch5x5.GetOutTensor(0), branch3x3dbl.GetOutTensor(0), branch_pool.GetOutTensor(0) ], 1) return outputs
def AddInceptionE(img, in_channels): branch1x1 = AddBasicConv(img, (320, in_channels, 1, 1)) branch3x3 = AddBasicConv(img, (384, in_channels, 1, 1)) branch3x3_2a = AddBasicConv(branch3x3.GetOutTensor(0), (384, 384, 1, 3), padding=(0, 1)) branch3x3_2b = AddBasicConv(branch3x3.GetOutTensor(0), (384, 384, 3, 1), padding=(1, 0)) branch3x3 = nn_ops.Concat( [branch3x3_2a.GetOutTensor(0), branch3x3_2b.GetOutTensor(0)], 1) branch3x3dbl = AddBasicConv(img, (448, in_channels, 1, 1)) branch3x3dbl = AddBasicConv(branch3x3dbl.GetOutTensor(0), (384, 448, 3, 3), padding=1) branch3x3dbl_3a = AddBasicConv(branch3x3dbl.GetOutTensor(0), (384, 384, 1, 3), padding=(0, 1)) branch3x3dbl_3b = AddBasicConv(branch3x3dbl.GetOutTensor(0), (384, 384, 3, 1), padding=(1, 0)) branch3x3dbl = nn_ops.Concat( [branch3x3dbl_3a.GetOutTensor(0), branch3x3dbl_3b.GetOutTensor(0)], 1) branch_pool = nn_ops.Pooling(img, (3, 3), stride=1, pad=1) branch_pool = AddBasicConv(branch_pool.GetOutTensor(0), (192, in_channels, 1, 1)) outputs = nn_ops.Concat([ branch1x1.GetOutTensor(0), branch3x3.GetOutTensor(0), branch3x3dbl.GetOutTensor(0), branch_pool.GetOutTensor(0) ], 1) return outputs
def AddInceptionB(img, in_channels): branch3x3 = AddBasicConv(img, (384, in_channels, 3, 3), stride=2) branch3x3dbl = AddBasicConv(img, (64, in_channels, 1, 1)) branch3x3dbl = AddBasicConv(branch3x3dbl.GetOutTensor(0), (96, 64, 3, 3), padding=1) branch3x3dbl = AddBasicConv(branch3x3dbl.GetOutTensor(0), (96, 96, 3, 3), stride=2) branch_pool = nn_ops.Pooling(img, (3, 3), stride=2) outputs = nn_ops.Concat([ branch3x3.GetOutTensor(0), branch3x3dbl.GetOutTensor(0), branch_pool.GetOutTensor(0) ], 1) return outputs
def AddInceptionD(img, in_channels): branch3x3 = AddBasicConv(img, (192, in_channels, 1, 1)) branch3x3 = AddBasicConv(branch3x3.GetOutTensor(0), (320, 192, 3, 3), stride=2) branch7x7x3 = AddBasicConv(img, (192, in_channels, 1, 1)) branch7x7x3 = AddBasicConv(branch7x7x3.GetOutTensor(0), (192, 192, 1, 7), padding=(0, 3)) branch7x7x3 = AddBasicConv(branch7x7x3.GetOutTensor(0), (192, 192, 7, 1), padding=(3, 0)) branch7x7x3 = AddBasicConv(branch7x7x3.GetOutTensor(0), (192, 192, 3, 3), stride=2) branch_pool = nn_ops.Pooling(img, (3, 3), stride=2) outputs = nn_ops.Concat([ branch3x3.GetOutTensor(0), branch7x7x3.GetOutTensor(0), branch_pool.GetOutTensor(0) ], 1) return outputs
def AddInceptionC(img, in_channels, channels_7x7): branch1x1 = AddBasicConv(img, (192, in_channels, 1, 1)) branch7x7 = AddBasicConv(img, (channels_7x7, in_channels, 1, 1)) branch7x7 = AddBasicConv(branch7x7.GetOutTensor(0), (channels_7x7, channels_7x7, 1, 7), padding=(0, 3)) branch7x7 = AddBasicConv(branch7x7.GetOutTensor(0), (192, channels_7x7, 7, 1), padding=(3, 0)) branch7x7_dbl = AddBasicConv(img, (channels_7x7, in_channels, 1, 1)) branch7x7_dbl = AddBasicConv(branch7x7_dbl.GetOutTensor(0), (channels_7x7, channels_7x7, 7, 1), padding=(3, 0)) branch7x7_dbl = AddBasicConv(branch7x7_dbl.GetOutTensor(0), (channels_7x7, channels_7x7, 1, 7), padding=(0, 3)) branch7x7_dbl = AddBasicConv(branch7x7_dbl.GetOutTensor(0), (channels_7x7, channels_7x7, 7, 1), padding=(3, 0)) branch7x7_dbl = AddBasicConv(branch7x7_dbl.GetOutTensor(0), (192, channels_7x7, 1, 7), padding=(0, 3)) branch_pool = nn_ops.Pooling(img, (3, 3), stride=1, pad=1) branch_pool = AddBasicConv(branch_pool.GetOutTensor(0), (192, in_channels, 1, 1)) outputs = nn_ops.Concat([ branch1x1.GetOutTensor(0), branch7x7.GetOutTensor(0), branch7x7_dbl.GetOutTensor(0), branch_pool.GetOutTensor(0) ], 1) return outputs