MiDaS icon indicating copy to clipboard operation
MiDaS copied to clipboard

When will MiDaS 3.1 be supported for conversion into ONNX?

Open md5xwl opened this issue 1 year ago • 11 comments

When will MiDaS 3.1 be supported for conversion into ONNX?

md5xwl avatar May 31 '23 09:05 md5xwl

@md5xwl For now, it's enough to use Pytorch Nighthly and onnx opset >= 13 to convert models of version 3.1 to onnx format. I managed to convert dpt_swin2_tiny_256 and dpt_levit_224.

scarletshroud avatar Jul 10 '23 13:07 scarletshroud

@scarletshroud Thanks man, it works for me too!

yqchau avatar Jul 17 '23 02:07 yqchau

Can you please share the code? I used pytorch nightly and onnx opset. I couldn't load the model... P.S. Fine, after reinstalling packages, it worked ...

smzyqin avatar Aug 02 '23 03:08 smzyqin

@smzyqin could you share your code? or the resulting onnx model? thanks.

Flourek avatar Sep 03 '23 15:09 Flourek

@scarletshroud do you mind sharing code?

Syazvinski avatar Sep 19 '23 18:09 Syazvinski

@md5xwl How about these? https://github.com/parkchamchi/MiDaS/releases/tag/23.02.18

ThreeDeeJay avatar Oct 13 '23 13:10 ThreeDeeJay

@md5xwl How about these? https://github.com/parkchamchi/MiDaS/releases/tag/23.02.18 I can’t load your model error: [ERROR:[email protected]] global onnx_importer.cpp:1064 cv::dnn::dnn4_v20230620::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 4 inputs and 1 outputs: [Resize]:(onnx_node!/Resize) from domain='ai.onnx' Traceback (most recent call last): File "D:\code\python\singleCreamDis\WeiShuHelper\test_export.py", line 8, in net = cv2.dnn.readNetFromONNX('weights/dpt_hybrid_384.onnx') cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1083: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20230620::ONNXImporter::handleNode' Node [[email protected]]:(onnx_node!/Resize) parse error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\resize_layer.cpp:62: error: (-215:Assertion failed) inputs.size() == 1 || inputs.size() == 2 in function 'cv::dnn::ResizeLayerImpl::getMemoryShapes'

Can you please share the code?

123467895 avatar Oct 16 '23 08:10 123467895

@123467895 For conversion? we'd have to ask @parkchamchi

ThreeDeeJay avatar Oct 16 '23 11:10 ThreeDeeJay

I tried with this model, but it worked poorly. [https://github.com/parkchamchi/MiDaS/releases/tag/23.02.18] frame_000001-dpt_beit_large_512 frame_000001 png

md5xwl avatar Nov 09 '23 02:11 md5xwl

@md5xwl

I tried with this model, but it worked poorly.

Have you normalized the input? (#)

parkchamchi avatar Nov 09 '23 02:11 parkchamchi

@md5xwl

I tried with this model, but it worked poorly.

Have you normalized the input? (#) Thank you, I check my code. Now it works correctly. I did normalize, but I did it wrong, I forgot this tensor = tensor/255.0

md5xwl avatar Nov 09 '23 03:11 md5xwl