How can I run cv2.dnn.readNetFromDarknet command
Question:
model=cv2.dnn.readNetFromDarknet("C://Users//deniz//Desktop//yolofiles//yolov3-coco_directory//yolov3.cfg","C://Users//deniz//Desktop//yolofiles//yolov3-coco_directory//yolov3.weights")
here is my code but whenever i wrote this code it returns as error cv2.error: OpenCV(4.6.0) D:aopencv-pythonopencv-pythonopencvmodulesdnnsrcdarknetdarknet_importer.cpp:210: error: (-212:Parsing error) Failed to open NetPara
When i write the command to terminal I also got this error(cv2.dnn.readNetFromDarknet : The term ‘cv2.dnn.readNetFromDarknet’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.)
I use VC, Yolov3 and python 3.11
Answers:
I believe the file’s path is incorrect. In my case, I never found such an error. You can store the path of the file in a variable. This is my code sample.
cfgModel = "yolov3.cfg";
weightsModel = "yolov3.weights";
net = cv.dnn.readNetFromDarknet(cfgModel, weightsModel);
I hope this can help you.
model=cv2.dnn.readNetFromDarknet("C://Users//deniz//Desktop//yolofiles//yolov3-coco_directory//yolov3.cfg","C://Users//deniz//Desktop//yolofiles//yolov3-coco_directory//yolov3.weights")
here is my code but whenever i wrote this code it returns as error cv2.error: OpenCV(4.6.0) D:aopencv-pythonopencv-pythonopencvmodulesdnnsrcdarknetdarknet_importer.cpp:210: error: (-212:Parsing error) Failed to open NetPara
When i write the command to terminal I also got this error(cv2.dnn.readNetFromDarknet : The term ‘cv2.dnn.readNetFromDarknet’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.)
I use VC, Yolov3 and python 3.11
I believe the file’s path is incorrect. In my case, I never found such an error. You can store the path of the file in a variable. This is my code sample.
cfgModel = "yolov3.cfg";
weightsModel = "yolov3.weights";
net = cv.dnn.readNetFromDarknet(cfgModel, weightsModel);
I hope this can help you.