enoted
enoted

Reputation: 626

OpenCV implementation of YOLO v3 reproduces Exception on a GCP instance

I have successfully implemented object detection from video using YOLO v3 model from OpenCV 4.0.0.21. It is running successfully on a local machine, so I wanted to test it on a Google Cloud Platform instance.

I've cloned my project, built OpenCV from source and launched YOLO v3 object detection. Though, this time I've caught an exception on the Darknet initialization step:

net = cv2.dnn.readNetFromDarknet(cfg_path, weights_path)

Here is also the traceback:

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'

What is the reason and how can I overcome this exception?

Upvotes: 4

Views: 5313

Answers (1)

Dhruv Pandey
Dhruv Pandey

Reputation: 514

I am not completely sure but looks like the yolov3.weights file is not getting stored correctly on Github(reason maybe its over 100MB). But getting a different weights file worked for me:

!wget "https://pjreddie.com/media/files/yolov3.weights"

Reference: https://colab.research.google.com/drive/1EjN6PrqXABZApL2GmlegOeLhhwmtWrlJ

Upvotes: 9

Related Questions