GFPGAN-ncnn icon indicating copy to clipboard operation
GFPGAN-ncnn copied to clipboard

如何生成ncnn的模型文件呢

Open sketch16 opened this issue 3 years ago • 3 comments

你好,感谢你的工作 我是一名ncnn初学者,我在mac上做了简单修改,成功运行了你的代码 现在我想学习下如何ncnn模型文件是如何转成功的呢?

我目前的步骤为: 1、按如下修改GFPGan的stylegan2_clean_arch.py 中的代码

        # noise injection
        if noise is None:
            b, _, h, w = out.shape
            # noise = out.new_empty(b, 1, h, w).normal_()
            # noise = torch.empty(b, 1, h, w).cuda()
            # nn.init.normal_(noise)
            noise = torch.randn(b, 1, h, w).cuda()

2、将GFPGANCleanv1-NoCE-C2.pth 转为了onnx 3、然后应用了python -m onnxsim model.onnx model-sim.onnx 4、./onnx2ncnn model-sim.onnx encoder.param encoder.bin 报错

Gather not supported yet!
 \# axis=1
zsh: segmentation fault  ./onnx2ncnn model-sim.onnx encoder.param encoder.bin

sketch16 avatar Jan 25 '22 10:01 sketch16

Hi miaofeng01, Did you manage to convert the GFPGANv1.3.pth model?

magicse avatar Aug 14 '22 19:08 magicse

Hi @miaofeng01 could You explain please how convert stylegan2_clean_arch.py to onnx or any other format?

magicse avatar Sep 19 '22 18:09 magicse