Is it possible to use this script to convert a mobilenetv2 model (from torchvision) to keras? I have already trained a model using pytorch but i cant convert it to tensorflow via ONNX (dunno why) so i want to try this. But looking at the pytorch version of the mobilenetv2, the first layer is:
and as far as i know that padding doesnt exist in keras, what keras does is:
x = layers.ZeroPadding2D(padding=correct_pad(backend, img_input, 3),
name='Conv1_pad')(img_input)
x = layers.Conv2D(first_block_filters,
kernel_size=3,
strides=(2, 2),
padding='valid',
use_bias=False,
name='Conv1')(x)
I know padding doesnt add any parameters to the problem but it does create a missmatch between the models. Is there any way i can convert my pytorch model?
Is it possible to use this script to convert a mobilenetv2 model (from torchvision) to keras? I have already trained a model using pytorch but i cant convert it to tensorflow via ONNX (dunno why) so i want to try this. But looking at the pytorch version of the mobilenetv2, the first layer is:
(https://github.com/pytorch/vision/blob/master/torchvision/models/mobilenet.py) nn.Conv2d(in_planes, out_planes, kernel_size, stride, padding, groups=groups, bias=False)
and as far as i know that padding doesnt exist in keras, what keras does is: x = layers.ZeroPadding2D(padding=correct_pad(backend, img_input, 3), name='Conv1_pad')(img_input) x = layers.Conv2D(first_block_filters, kernel_size=3, strides=(2, 2), padding='valid', use_bias=False, name='Conv1')(x)
I know padding doesnt add any parameters to the problem but it does create a missmatch between the models. Is there any way i can convert my pytorch model?