Closed Kreiswolke closed 5 years ago
hello @Kreiswolke. Can you show me the model definition so I can reproduce the error?
Sure, bagnet can be installed from https://github.com/wielandbrendel/bag-of-local-features-models
In the code below I am replacing the output fc layer with an Identity:
import bagnets.pytorch
pytorch_model = bagnets.pytorch.bagnet8()
class Identity(torch.nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
pytorch_model.fc = Identity()
input_np = np.random.uniform(0, 1, (1, 3, 224, 224))
input_var = Variable(torch.FloatTensor(input_np))
k_model = pytorch_to_keras(pytorch_model, input_var, [(3, None, None)], verbose=True)
img = np.random.random(size=(1,3,225,225))
output = k_model.predict(img)
I am converting a pretrained model from pytorch to keras. In the model there is a slicing operator. When converting
I get errors for inputs which are not 224x224 due to the slicing operator which has a fixed [axis, start, end] attribute in onnx. Any idea how this could be made dynamically for varying input?