我已经使用 OpenCV 4.0.0.21 中的 YOLO v3 模型成功地实现了视频对象检测。它在本地机器上成功运行,所以我想在 Google Cloud Platform 实例上测试它。
我已经克隆了我的项目,从源代码构建了 OpenCV 并启动了 YOLO v3 对象检测。不过,这次我在 Darknet 初始化步骤中发现了一个异常:
net = cv2.dnn.readNetFromDarknet(cfg_path, weights_path)
这也是回溯:
Traceback (most recent call last):
File "/home/username/path_to_app/yolo_object_detection.py",
line 21, in run_detection:
net = cv2.dnn.readNetFromDarknet(cfg_path, weights_path)
cv2.error: OpenCV(4.0.0) /home/username/opencv-
4.0.0/modules/dnn/src/darknet/darknet_io.cpp:690:
error: (-213:The function/feature is not implemented)
Transpose the weights (except for convolutional)
is not implemented in function 'ReadDarknetFromWeightsStream'
Run Code Online (Sandbox Code Playgroud)
原因是什么,我该如何克服这个异常?