Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-212:Parsing error #8

Open
yayaoking opened this issue May 22, 2019 · 32 comments
Open

-212:Parsing error #8

yayaoking opened this issue May 22, 2019 · 32 comments

Comments

@yayaoking
Copy link

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.

@xsurkan
Copy link

xsurkan commented May 24, 2019

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

@yayaoking
Copy link
Author

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

@yayaoking
Copy link
Author

ty

@OzgunKB
Copy link

OzgunKB commented Jun 2, 2019

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`

@iuliakhomenko
Copy link

iuliakhomenko commented Jul 16, 2019

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

@yayaoking
Copy link
Author

yayaoking commented Jul 18, 2019 via email

@Donostia
Copy link

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

@bhavesh0124
Copy link

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

@craig14
Copy link

craig14 commented Nov 25, 2019

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

@vladislav77c
Copy link

ty

---Original--- From: "iulia"notifications@github.com Date: Tue, Jul 16, 2019 21:54 PM To: "iArunava/YOLOv3-Object-Detection-with-OpenCV"YOLOv3-Object-Detection-with-OpenCV@noreply.github.com; Cc: "Author"author@noreply.github.com;"yayaoking"610173929@qq.com; 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??

@DHuiTnut
Copy link

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

@fatima598
Copy link

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
Copy link

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
Copy link

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

@MananGandhi1810
Copy link

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

@vknov21
Copy link

vknov21 commented Oct 2, 2020

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

@ahmedalmindelawy93
Copy link

I have the same problem , help please...

@skykongkong8
Copy link

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

@memsjava
Copy link

Downloading yolov3.weights files save me

@akashAD98
Copy link

i have the same error ,im trying this in window

@rohitdileep
Copy link

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

@rukshar69
Copy link

Downloading yolov3.weights files save me

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

@vknov21
Copy link

vknov21 commented May 19, 2021

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.

@Akashmanoj369
Copy link

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

@vknov21
Copy link

vknov21 commented Jun 3, 2021

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

@Akashmanoj369
Copy link

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.

@0mer5aeed
Copy link

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 .

@SyedTaqveemAli
Copy link

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 ?

@vknov21
Copy link

vknov21 commented Jan 5, 2022

@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.

@mirsadanill
Copy link

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

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

@ZaynAlk
Copy link

ZaynAlk commented Feb 15, 2022

check the name of the file and the path they should be the same in the code, this is the first mistake most people fall.

@cagandurgun
Copy link

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 .

How did you solve this problem. I have the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests