Vadim Smirnov
Vadim Smirnov

Reputation: 21

Convert Inception model with include_top=False from Keras to Pytorch

Im try convert old project writen on Keras to PyTorch.

Keras create_model() contains folowing code. This is (129,500,1) grayscale image as input and (None, 2, 14, 2038) as output. Output tensor used in another BiLSTM later.

from tensorflow.python.keras.applications.inception_v3 import InceptionV3

inception_model = InceptionV3(include_top=False, weights=None, input_tensor=input_tensor)
for layer in inception_model.layers:
        layer.trainable = False
x = inception_model.output

How I am can convert this code to Pytorch? The main problem is "include_top=False" what do not exist in Pytorch torchvision.inception_v3 model. This flag allow Keras model work with non-standard 1 channel inputs and 4-dim last Conv block outputs.

Upvotes: 0

Views: 190

Answers (1)

anil kumar
anil kumar

Reputation: 860

Actually, InceptionV3 model available in PyTorch.

You can try the below code.

import torchvision
torchvision.models.inception_v3()

Upvotes: 0

Related Questions