starimeL / PytorchConverter

Pytorch model to caffe & ncnn
BSD 2-Clause "Simplified" License
393 stars 76 forks source link

ValueError: Unknown layer type: Negate #4

Closed tfygg closed 6 years ago

tfygg commented 6 years ago

Thanks for your code! When I converting pytorch model to ncnn, it has two errors: (1) ValueError: Unknown layer type: Negate (2) ValueError: Unknown layer type: Permute Could you help me to support Negate and Permute please?

starimeL commented 6 years ago

Supports on Negate and Permute are updated. Take a shot on your net and see if it works well:)

tfygg commented 6 years ago

Thanks for your help, it is OK now. My model has mutil tasks, such as classfication, bounding boxes and so on, so i repair the function ConvertModel_ncnn(pytorch_net, InputShape, softmax=False) , as below: def ConvertModel_ncnn(pytorch_net, InputShape, softmax=False): if softmax: import torch.nn as nn regularize = nn.Softmax() outputs = regularize(outputs[0])

outputs[0] is output of softmax, but it is so ugly. Do you have some suggesstions for me?

tfygg commented 6 years ago

Also,it runs errors when i using the param and bin file,as below

ncnn::Net my_net;

my_net.load_param("my_net.param");

my_net.load_model("my_net.bin");

the errors is Segmentation fault

image

starimeL commented 6 years ago

I haven't tried multi-task net yet, but theoretically they are supported. Can you provide the pytorch net file to help me check? If it's inconvenient to put on here, you can find me in the ncnn QQ discussion group