提问人:SoNoHead 提问时间:9/29/2023 最后编辑:Goku - stands with PalestineSoNoHead 更新时间:9/29/2023 访问量:3377
cv2.error:OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\src\.cpp:660:错误:(-215:断言失败)
cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\src\.cpp:660: error: (-215:Assertion failed)
问:
我的代码:
import cv2
import matplotlib.pyplot as plt
import cvlib as cv
from cvlib.object_detection import draw_bbox
import tensorflow as tf
im = cv2.imread('road.PNG')
bbox, label, conf = cv.detect_common_objects(im)
output_image = draw_bbox(im, bbox, label, conf)
plt.imshow(output_image)
plt.show()
错误:
Traceback (most recent call last):
File "C:\Users\divin\Wk5_Lab_McGrath_Anthony\LAB9-object_detection.py", line 8, in <module>
bbox, label, conf = cv.detect_common_objects(im)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\divin\Wk5_Lab_McGrath_Anthony\venv\Lib\site-packages\cvlib\object_detection.py", line 125, in detect_common_objects
net = cv2.dnn.readNet(weights_file_abs_path, config_file_abs_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:660: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'
我不确定如何破译给出的错误。
答:
0赞
Goku - stands with Palestine
9/29/2023
#1
这通常发生在图像未正确加载(图像位置错误)时。
提供如下地址:
"C:\\Users\\divin\\Wk5_Lab_McGrath_Anthony\\LAB9-object_detection.py"
评论