Torch 和 OpenCV4.0 在风格转换中对应层(风格迁移)

上一章中已经从 OpenCV4.0 中导出风格迁移各层名称,这里来和 Torch 比一比:

Torch 层			OpenCV4.0 层
nn.Sequential
nn.SpatialReflectionPadding	l1_Padding	加对边 (四周各加20个像素宽的边)
nn.SpatialConvolution		l2_Convolution	卷积		3-->16扩维
nn.InstanceNormalization	l3_MVN		实例正则化
nn.SpatialBatchNormalization	l4_BatchNorm	批正则化
nn.ReLU				l5_ReLU		relu激励
nn.SpatialConvolution		l6_Convolution	卷积		16-->32扩维,并2倍下采样
nn.InstanceNormalization	l7_MVN
nn.SpatialBatchNormalization	l8_BatchNorm
nn.ReLU				l9_ReLU
nn.SpatialConvolution		l10_Convolution	卷积		32-->64扩维,并2倍下采样
nn.InstanceNormalization	l11_MVN
nn.SpatialBatchNormalization	l12_BatchNorm
nn.ReLU				l13_ReLU
--------------------------------------------------残差块 1
nn.Sequential
nn.ConcatTable
nn.Sequential
nn.SpatialConvolution		l15_Convolution	卷积		64-->64维不变
nn.InstanceNormalization	l16_MVN
nn.SpatialBatchNormalization	l17_BatchNorm
nn.ReLU				l18_ReLU
nn.SpatialConvolution		l19_Convolution	卷积		64-->64维不变
nn.InstanceNormalization	l20_MVN
nn.SpatialBatchNormalization	l21_BatchNorm
nn.ShaveImage			l22_Slice	去边(四周刮去1像素宽边)(1*5*4=20)
nn.CAddTable			l23_torchCAddTable	矩阵相加 (残差+输入)
--------------------------------------------------残差块 2
nn.Sequential
nn.ConcatTable
nn.Sequential
nn.SpatialConvolution		l25_Convolution
nn.InstanceNormalization	l26_MVN
nn.SpatialBatchNormalization	l27_BatchNorm
nn.ReLU				l28_ReLU
nn.SpatialConvolution		l29_Convolution
nn.InstanceNormalization	l30_MVN
nn.SpatialBatchNormalization	l31_BatchNorm
nn.ShaveImage			l32_Slice
nn.CAddTable			l33_torchCAddTable
--------------------------------------------------残差块 3
nn.Sequential
nn.ConcatTable
nn.Sequential
nn.SpatialConvolution		l35_Convolution
nn.InstanceNormalization	l36_MVN
nn.SpatialBatchNormalization	l37_BatchNorm
nn.ReLU				l38_ReLU
nn.SpatialConvolution		l39_Convolution
nn.InstanceNormalization	l40_MVN
nn.SpatialBatchNormalization	l41_BatchNorm
nn.ShaveImage			l42_Slice
nn.CAddTable			l43_torchCAddTable
--------------------------------------------------残差块 4
nn.Sequential
nn.ConcatTable
nn.Sequential
nn.SpatialConvolution		l45_Convolution
nn.InstanceNormalization	l46_MVN
nn.SpatialBatchNormalization	l47_BatchNorm
nn.ReLU				l48_ReLU
nn.SpatialConvolution		l49_Convolution
nn.InstanceNormalization	l50_MVN
nn.SpatialBatchNormalization	l51_BatchNorm
nn.ShaveImage			l52_Slice
nn.CAddTable			l53_torchCAddTable
--------------------------------------------------残差块 5
nn.Sequential
nn.ConcatTable
nn.Sequential
nn.SpatialConvolution		l55_Convolution
nn.InstanceNormalization	l56_MVN
nn.SpatialBatchNormalization	l57_BatchNorm
nn.ReLU				l58_ReLU
nn.SpatialConvolution		l59_Convolution
nn.InstanceNormalization	l60_MVN
nn.SpatialBatchNormalization	l61_BatchNorm
nn.ShaveImage			l62_Slice
nn.CAddTable			l63_torchCAddTable
nn.SpatialFullConvolution	l64_Deconvolution	反卷积	64-->32减维,并2倍上采样
nn.InstanceNormalization	l65_MVN
nn.SpatialBatchNormalization	l66_BatchNorm
nn.ReLU				l67_ReLU
nn.SpatialFullConvolution	l68_Deconvolution	反卷积	32-->16减维,并2倍上采样
nn.InstanceNormalization	l69_MVN
nn.SpatialBatchNormalization	l70_BatchNorm
nn.ReLU				l71_ReLU
nn.SpatialConvolution		l72_Convolution	卷积		16-->3减维
nn.Tanh				l73_TanH
nn.MulConstant			l74_Power
nn.TotalVariation		l75_Identity

 

你可能感兴趣的:(风格转换)