starimeL/PytorchConverter

ValueError: Unknown layer type: Negate

Closed this issue · 4 comments

tfygg commented

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?

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

tfygg commented

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

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

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