YOLOv3-Object-Detection-with-OpenCV icon indicating copy to clipboard operation
YOLOv3-Object-Detection-with-OpenCV copied to clipboard

-212:Parsing error

Open yayaoking opened this issue 6 years ago • 31 comments

I try the " python yolo.py --image-path=" part ,it returns a error cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: ./yolov3-coco/yolov3.weights in function 'cv::dnn::dnn4_v20190122::readNetFromDarknet' im a noob,hope you can teach me,it will help a lot.

yayaoking avatar May 22 '19 05:05 yayaoking

I have got the same error...can not find the solution till now.

xsurkan avatar May 24 '19 06:05 xsurkan

Im still trying,plz tell me if you find the solution

yayaoking avatar May 24 '19 09:05 yayaoking

ty

yayaoking avatar Jun 01 '19 00:06 yayaoking

I try the " python yolo.py --image-path=" part ,it returns a error cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: ./yolov3-coco/yolov3.weights in function 'cv::dnn::dnn4_v20190122::readNetFromDarknet' im a noob,hope you can teach me,it will help a lot.

change original code line to net = cv.dnn.readNetFromDarknet(FLAGS.config)

I changed the line 88 but there was an error. `E:\YOLOV3\YOLOv3-Object-Detection-with-OpenCV-master>python yolo.py --image-path='/1.jpg' Traceback (most recent call last): File "yolo.py", line 105, in height, width = img.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo.py", line 108, in Please check the path provided!' TypeError: exceptions must derive from BaseException

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo.py", line 111, in img, _, _, _, _ = infer_image(net, layer_names, height, width, img, colors, labels, FLAGS) NameError: name 'height' is not defined`

OzgunKB avatar Jun 02 '19 20:06 OzgunKB

you need to download weights for yolo and put them in yolov3_coco directory you can do it from here : https://pjreddie.com/media/files/yolov3.weights

iuliakhomenko avatar Jul 16 '19 13:07 iuliakhomenko

ty

---Original--- From: "iulia"[email protected] Date: Tue, Jul 16, 2019 21:54 PM To: "iArunava/YOLOv3-Object-Detection-with-OpenCV"[email protected]; Cc: "Author"[email protected];"yayaoking"[email protected]; Subject: Re: [iArunava/YOLOv3-Object-Detection-with-OpenCV] -212:Parsing error (#8)

you need to download weights for yolo you can do it from here : https://pjreddie.com/media/files/yolov3.weights

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yayaoking avatar Jul 18 '19 04:07 yayaoking

I have yolov3.cfg and yolov3.weights files in yolov3-coco directory and another exception occurred:

File "yolo.py", line 104, in height, width = img.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo.py", line 107, in Please check the path provided!' TypeError: exceptions must derive from BaseException

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo.py", line 110, in img, _, _, _, _ = infer_image(net, layer_names, height, width, img, colors, labels, FLAGS) NameError: name 'height' is not defined

Donostia avatar Jul 18 '19 10:07 Donostia

!wget "https://pjreddie.com/media/files/yolov3.weights" Run this command and save the yolo.weight file in yolov3-coco

bhavesh0124 avatar Nov 15 '19 08:11 bhavesh0124

Use opencv>=3.4.2 You can use pip3 install --upgrade opencv-python==3.4.2.16

craig14 avatar Nov 25 '19 17:11 craig14

ty ---Original--- From: "iulia"[email protected] Date: Tue, Jul 16, 2019 21:54 PM To: "iArunava/YOLOv3-Object-Detection-with-OpenCV"[email protected]; Cc: "Author"[email protected];"yayaoking"[email protected]; Subject: Re: [iArunava/YOLOv3-Object-Detection-with-OpenCV] -212:Parsing error (#8) you need to download weights for yolo you can do it from here : https://pjreddie.com/media/files/yolov3.weights — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

where is the yolo_coco location??

vladislav77c avatar Mar 13 '20 17:03 vladislav77c

you need to download weights for yolo and put them in yolov3_coco directory you can do it from here : https://pjreddie.com/media/files/yolov3.weights

I have already got that file,but it can still not work....what should I do?Thanks a lot

DHuiTnut avatar May 28 '20 08:05 DHuiTnut

I try the " python yolo.py --image-path=" part ,it returns a error cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: ./yolov3-coco/yolov3.weights in function 'cv::dnn::dnn4_v20190122::readNetFromDarknet' im a noob,hope you can teach me,it will help a lot.

I get the same error if you solve this problem PLEASE HELP ME

fatima598 avatar Jun 02 '20 20:06 fatima598

I have got the same error...can not find the solution till now.

I get the same problem if you solve PLEASE HELP ME

fatima598 avatar Jun 02 '20 20:06 fatima598

you need to download weights for yolo and put them in yolov3_coco directory you can do it from here : https://pjreddie.com/media/files/yolov3.weights

I have already got that file,but it can still not work....what should I do?Thanks a lot

If you solve this problem PLEASE HELP ME

fatima598 avatar Jun 02 '20 20:06 fatima598

just write absolute path for the files to be imported, it will work

MananGandhi1810 avatar Jun 27 '20 15:06 MananGandhi1810

you need to download weights for yolo and put them in yolov3_coco directory you can do it from here : https://pjreddie.com/media/files/yolov3.weights

I have already got that file,but it can still not work....what should I do?Thanks a lot

If the method doesn't work, then try ls command first. If the file yolov3.weights isn't there, write the absolute path of the file or just cd to that directory. !cd didn't work for changing directory in my case. Edit : Above was the case for COLAB

vknov21 avatar Oct 02 '20 06:10 vknov21

I have the same problem , help please...

ahmedalmindelawy93 avatar Jan 14 '21 19:01 ahmedalmindelawy93

Me, too has the same problem at Windows10... have NO clue cos it worked at mac environment with THE SAME method..

skykongkong8 avatar Feb 05 '21 16:02 skykongkong8

Downloading yolov3.weights files save me

memsjava avatar Mar 17 '21 14:03 memsjava

i have the same error ,im trying this in window

akashAD98 avatar Mar 18 '21 04:03 akashAD98

just git clone the entire repository then copy weights and cfg file in the root , for me it worked

rohitdileep avatar May 17 '21 13:05 rohitdileep

Downloading yolov3.weights files save me

I have yolov3.weights file in directory but still this error occurs. :(

rukshar69 avatar May 19 '21 04:05 rukshar69

For all those who are still facing the problem, I assume their system to be Windows or other non-Linux.

Resoning : The main problem lies in the line 78-79 and the .sh file that is to be executed in such systems

78. 	if FLAGS.download_model:
79. 		subprocess.call(['./yolov3-coco/get_model.sh'])

The getmodel.sh file present in dir ./yolov3-coco contains code

8. wget --no-check-certificate https://pjreddie.com/media/files/yolov3.weights

where the command wget is not supported in Windows.

Solution : I will suggest you to download the weights file from link https://pjreddie.com/media/files/yolov3.weights manually and move the file to ./yolov3-coco directory and execute the code again.

I gave the solution in as much detail as required. Let me know if there's any other error or if it doesn't solve the problem.

vknov21 avatar May 19 '21 06:05 vknov21

For all those who are still facing the problem, I assume their system to be Windows or other non-Linux.

Resoning : The main problem lies in the line 78-79 and the .sh file that is to be executed in such systems

78. 	if FLAGS.download_model:
79. 		subprocess.call(['./yolov3-coco/get_model.sh'])

The getmodel.sh file present in dir ./yolov3-coco contains code

8. wget --no-check-certificate https://pjreddie.com/media/files/yolov3.weights

where the command wget is not supported in Windows.

Solution : I will suggest you to download the weights file from link https://pjreddie.com/media/files/yolov3.weights manually and move the file to ./yolov3-coco directory and execute the code again.

I gave the solution in as much detail as required. Let me know if there's any other error or if it doesn't solve the problem.

i cant find yolov3-coco directory. do help me plz

Akashmanoj369 avatar Jun 03 '21 04:06 Akashmanoj369

For all those who are still facing the problem, I assume their system to be Windows or other non-Linux. Resoning : The main problem lies in the line 78-79 and the .sh file that is to be executed in such systems

78. 	if FLAGS.download_model:
79. 		subprocess.call(['./yolov3-coco/get_model.sh'])

The getmodel.sh file present in dir ./yolov3-coco contains code

8. wget --no-check-certificate https://pjreddie.com/media/files/yolov3.weights

where the command wget is not supported in Windows. Solution : I will suggest you to download the weights file from link https://pjreddie.com/media/files/yolov3.weights manually and move the file to ./yolov3-coco directory and execute the code again. I gave the solution in as much detail as required. Let me know if there's any other error or if it doesn't solve the problem.

i cant find yolov3-coco directory. do help me plz

Did you follow the procedure provided in the README.md file? Follow the repositories README file : https://github.com/iArunava/YOLOv3-Object-Detection-with-OpenCV

Just git-clone the github repository to get the requirements.

git clone https://github.com/iArunava/YOLOv3-Object-Detection-with-OpenCV.git

vknov21 avatar Jun 03 '21 11:06 vknov21

For all those who are still facing the problem, I assume their system to be Windows or other non-Linux. Resoning : The main problem lies in the line 78-79 and the .sh file that is to be executed in such systems

78. 	if FLAGS.download_model:
79. 		subprocess.call(['./yolov3-coco/get_model.sh'])

The getmodel.sh file present in dir ./yolov3-coco contains code

8. wget --no-check-certificate https://pjreddie.com/media/files/yolov3.weights

where the command wget is not supported in Windows. Solution : I will suggest you to download the weights file from link https://pjreddie.com/media/files/yolov3.weights manually and move the file to ./yolov3-coco directory and execute the code again. I gave the solution in as much detail as required. Let me know if there's any other error or if it doesn't solve the problem.

i cant find yolov3-coco directory. do help me plz

Did you follow the procedure provided in the README.md file? Follow the repositories README file : https://github.com/iArunava/YOLOv3-Object-Detection-with-OpenCV

Just git-clone the github repository to get the requirements.

git clone https://github.com/iArunava/YOLOv3-Object-Detection-with-OpenCV.git

Still no change. The error says; cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-h4wtvo23\opencv\modules\dnn\src\darknet\darknet_importer.cpp:207: error: (-212:Parsing error) Failed to parse NetParameter file: yolov3.cfg in function 'cv::dnn::dnn4_v20200609::readNetFromDarknet'

plz help me as i am a noob.

Akashmanoj369 avatar Jun 04 '21 02:06 Akashmanoj369

i solved the issue , it was due to a silly mistake , the name of the file in included in the path does not matched the file name used in the code .

0mer5aeed avatar Jun 24 '21 12:06 0mer5aeed

Traceback (most recent call last): File "C:\Users\DELL\Desktop\YOLOv3-custom-training\image_detect.py", line 163, in yolo = YOLO() can somebody help me solve this error ?

SyedTaqveemAli avatar Jan 05 '22 04:01 SyedTaqveemAli

@SyedTaqveemAli It seems the issue is with the YOLO() class that you might have imported. I am not sure from where you have imported it as I couldn't find the file in this Repository. And also, you haven't provided the type of error, so I can guess the error is because the YOLO class might needed some values in its __init__() which has not been provided or if provided there might be some type error. For proper solution for the error, you might need to share the image_detect.py file and the library from where YOLO is being imported (if not in the same file) and also the type of error it returns in Traceback.

vknov21 avatar Jan 05 '22 05:01 vknov21

yolov3.weights dosyalarını indirmek beni kurtarıyor

Dizinde yolov3.weights dosyası var ama yine de bu hata oluşuyor. :(

mirsadanill avatar Jan 29 '22 08:01 mirsadanill