ronheywood / opencv

Experimenting using Machine Vision OpenCV and Python to create software suitable for driving a Golf launch monitor similar to technology like SkyTrak, GC2 and GC Quad
MIT License
36 stars 4 forks source link

Issue with cv2.dnn.readNet in GolfBallDetection function #2

Open bubersome opened 1 year ago

bubersome commented 1 year ago

Hello @ronheywood,

I'm trying to run your project and I've encountered an issue. Here's the error I'm getting when running the detect-ball-hough-circles.py script:

Searching for a golf ball... Traceback (most recent call last): File "/Users/32f/PycharmProjects/opencv-main/detect-ball-hough-circles.py", line 29, in ball = detection.GolfBallDetection(image) File "/Users/32f/PycharmProjects/opencv-main/modules/detection.py", line 25, in GolfBallDetection net = cv2.dnn.readNet(weights_file, config_file) cv2.error: OpenCV(4.7.0) /Users/xperience/GHA-OCV-Python/_work/opencv-python/opencv-python/opencv/modules/dnn/src/darknet/darknet_importer.cpp:217: error: (-212:Parsing error) Failed to parse NetParameter file: yolov3.weights in function 'readNetFromDarknet'

I've confirmed that the yolov3.weights file is correctly placed in the project directory and the config_file and weights_file paths are correctly set in the GolfBallDetection function.

config_file from https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov3.cfg

I've also verified that my environment is properly set up and I'm using OpenCV version 4.7.0. I suspect the issue might be related to the YOLOv3 configuration, but I'm not entirely sure.

Any help or guidance you could provide would be greatly appreciated.

Thank you in advance!

Best Regards,

Ben

ronheywood commented 1 year ago

Sorry I am going to look at this, I have a new system so I'll try and set it up from scratch

ronheywood commented 1 year ago

Did you try with the yolo config from https://github.com/ronheywood/opencv/blob/main/yolo.cfg?