iArunava / YOLOv3-Object-Detection-with-OpenCV

This project implements a real-time image and video object detection classifier using pretrained yolov3 models.
MIT License
329 stars 172 forks source link

-212:Parsing error #8

Open yayaoking opened 5 years ago

yayaoking commented 5 years ago

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 commented 5 years ago

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

yayaoking commented 5 years ago

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

yayaoking commented 5 years ago

ty

OzgunKB commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.

Donostia commented 5 years ago

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 commented 4 years ago

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

craig14 commented 4 years ago

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

vladislav77c commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

vknov21 commented 4 years ago

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 commented 3 years ago

I have the same problem , help please...

skykongkong8 commented 3 years ago

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

memsjava commented 3 years ago

Downloading yolov3.weights files save me

akashAD98 commented 3 years ago

i have the same error ,im trying this in window

rohitdileep commented 3 years ago

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

rukshar69 commented 3 years ago

Downloading yolov3.weights files save me

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

vknov21 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

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

ZaynAlk commented 2 years ago

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.