FeMaSR icon indicating copy to clipboard operation
FeMaSR copied to clipboard

About converting model to .onnx-> ncnn?

Open zelenooki87 opened this issue 1 year ago • 5 comments

I am very impressed with your project and upscale models. Tried project in google colab and results are fascinanting, even better than commercial products. Cause I have AMD radeon GPU, I would like to convert FeMaSR models to ncnn, (.bin and .params) and use it in OSource programs like cupscale or quality scaler. Do you have recommendations for conversion? Thank you very, very much in advance!

zelenooki87 avatar Jul 04 '22 12:07 zelenooki87

Thanks for interest. Since I have no experience in the conversion, I am not able to give detailed instructions. You may try some official tutorials, for example:

  • https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
  • https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx

chaofengc avatar Jul 04 '22 12:07 chaofengc

I think it is not so hard. https://github.com/Tencent/ncnn/tree/master/tools/pnnx Could you specify input shape of the pretrained models? tnx

zelenooki87 avatar Jul 04 '22 12:07 zelenooki87

The input width and length should be multiplier of 32(16) for x2(x4) model

chaofengc avatar Jul 04 '22 13:07 chaofengc

please suggest values to type when converting torch summary of 4x SR .pth model https://pastebin.com/4JSUFB0f tried with [1,3,224,224] standard values but without success maybe to try 1,4,256,256 for 4x model? without input shape conversion is impossible. Again thank you for great work!

zelenooki87 avatar Jul 07 '22 00:07 zelenooki87

224×224 should be ok. You may try 256×256, which should definitely work.

chaofengc avatar Jul 07 '22 11:07 chaofengc