Closed Jeffin21 closed 3 years ago
self.net = cv2.dnn.readNet('yolact_base_54_800000.onnx') cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:57: error: (-210:Unsupported format or combination of formats) Failed to parse onnx model in function 'cv::dnn::dnn4_v20191202::ONNXImporter::ONNXImporter' please provide what version of opencv you tried to run
你升级opencv到4.5.1或4.5.2再运行程序
@hpc203 thanks for your comment , will this program support my custom data set?
@hpc203
File "E:\yolact-opencv-dnn-cpp-python-main\main_yolact.py", line 221, in
@hpc203 i run the onnx file generator code in colab i got this error
convert /content/drive/MyDrive/thirip2/yolact_base_54_800000.onnx begin
/content/thalap/yolact.py:282: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
x = F.interpolate(x, size=(int(convouts[j].shape[2]), int(convouts[j].shape[3])), mode=self.interpolation_mode, align_corners=False)
/content/thalap/yolact.py:52: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
return F.interpolate(x, size=(int(x.shape[2] * self.kwdargs['scale_factor']), int(x.shape[3] * self.kwdargs['scale_factor'])), mode=self.kwdargs['mode'], align_corners=self.kwdargs['align_corners'])
convert /content/drive/MyDrive/thirip2/yolact_base_54_800000.onnx to onnx finish!!!
read failed
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-11-f54ed51a524b> in <module>()
21 try:
---> 22 dnnnet = cv2.dnn.readNet(output_onnx)
23 print('read sucess')
error: OpenCV(4.1.2) /io/opencv/modules/dnn/src/layers/eltwise_layer.cpp:110: error: (-215:Assertion failed) inputs.size() >= 2 in function 'getMemoryShapes'
During handling of the above exception, another exception occurred:
error Traceback (most recent call last)
<ipython-input-11-f54ed51a524b> in <module>()
24 except:
25 print('read failed')
---> 26 dnnnet = cv2.dnn.readNet(output_onnx)
error: OpenCV(4.1.2) /io/opencv/modules/dnn/src/layers/eltwise_layer.cpp:110: error: (-215:Assertion failed) inputs.size() >= 2 in function 'getMemoryShapes'
@hpc203 i run the onnx file generator code in colab i got this error
convert /content/drive/MyDrive/thirip2/yolact_base_54_800000.onnx begin /content/thalap/yolact.py:282: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! x = F.interpolate(x, size=(int(convouts[j].shape[2]), int(convouts[j].shape[3])), mode=self.interpolation_mode, align_corners=False) /content/thalap/yolact.py:52: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! return F.interpolate(x, size=(int(x.shape[2] * self.kwdargs['scale_factor']), int(x.shape[3] * self.kwdargs['scale_factor'])), mode=self.kwdargs['mode'], align_corners=self.kwdargs['align_corners']) convert /content/drive/MyDrive/thirip2/yolact_base_54_800000.onnx to onnx finish!!! read failed --------------------------------------------------------------------------- error Traceback (most recent call last) <ipython-input-11-f54ed51a524b> in <module>() 21 try: ---> 22 dnnnet = cv2.dnn.readNet(output_onnx) 23 print('read sucess') error: OpenCV(4.1.2) /io/opencv/modules/dnn/src/layers/eltwise_layer.cpp:110: error: (-215:Assertion failed) inputs.size() >= 2 in function 'getMemoryShapes' During handling of the above exception, another exception occurred: error Traceback (most recent call last) <ipython-input-11-f54ed51a524b> in <module>() 24 except: 25 print('read failed') ---> 26 dnnnet = cv2.dnn.readNet(output_onnx) error: OpenCV(4.1.2) /io/opencv/modules/dnn/src/layers/eltwise_layer.cpp:110: error: (-215:Assertion failed) inputs.size() >= 2 in function 'getMemoryShapes'
你是使用自己的数据集训练yolact的吗?生成onnx文件后,运行opencv程序时,检查一下输入图片resize的尺寸和类别数,是否跟训练时候的一致呢?
@hpc203 not custom data set just the yolocat pretrained files mentioned below
self.net = cv2.dnn.readNet('yolact_base_54_800000.onnx') cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:57: error: (-210:Unsupported format or combination of formats) Failed to parse onnx model in function 'cv::dnn::dnn4_v20191202::ONNXImporter::ONNXImporter' please provide what version of opencv you tried to run