AhmadYahya97 / Fully-Automated-red-light-Violation-Detection

Detecting and Tracking the violating cars using yolov3 model and various image processing techniques.
35 stars 24 forks source link

Program Crashes #3

Open rachitchokshi opened 4 years ago

rachitchokshi commented 4 years ago

Hello,

While trying to run the project through below command

python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/

The program crashes with below error

INFO] loading YOLO from disk...
[INFO] 120 total frames in video
Traceback (most recent call last):
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 314, in <module>
    thresholdRedLight = getLightThresh(showStages=True)
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 249, in getLightThresh
    im2, contours, hierarchy = cv2.findContours(th, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS)
ValueError: not enough values to unpack (expected 3, got 2)

After fixing this one it crashes with

Traceback (most recent call last):
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 516, in <module>
    boxesTemp = updateTrackers(frame)
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 411, in updateTrackers
    tracker, box = trackersList[n]
IndexError: list index out of range 

Steps to Reproduce on a linux x86_64 machine

cd $HOME
git clone [https://github.com/AhmadYahya97/Fully-Automated-red-light-Violation-Detection](https://github.com/AhmadYahya97/Fully-Automated-red-light-Violation-Detection)
cd Fully-Automated-red-light-Violation-Detection/
python3 -m virtualenv venv
source venv/bin/activate
pip install numpy imutils matplotlib opencv-python opencv-contrib-python
python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/
Azhar1504 commented 4 years ago

Hey, in your command to run it, you have correctly given an input video but not the output video. You have given it a directory instead of a .mp4 file, maybe this could be the problem?

Azhar1504 commented 4 years ago

Try changing the --output to something like test.avi?

Yaoxiao1 commented 4 years ago

Hi, about the IndexError: list index out of range , I think that might be a variable naming problem. checke the line 395 image see the enumerate variable "n", it crashes with the upper variable "n" so you got a index problem, just change it to another name (for me I change it to "nn") and that would be fine.

Hoping it would help

Green00101 commented 4 years ago

cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:712: error: (-213:The function/feature is not implemented) Transpose the weights (except for convolutional) is not implemented in function 'cv::dnn::darknet::ReadDarknetFromWeightsStream'

what should i do?

Yaoxiao1 commented 4 years ago

cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:712: error: (-213:The function/feature is not implemented) Transpose the weights (except for convolutional) is not implemented in function 'cv::dnn::darknet::ReadDarknetFromWeightsStream'

what should i do?

go download any yolo-weight(approximately 280M) and replace the one in this directory

Green00101 commented 4 years ago

cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:712: error: (-213:The function/feature is not implemented) Transpose the weights (except for convolutional) is not implemented in function 'cv::dnn::darknet::ReadDarknetFromWeightsStream' what should i do?

go download any yolo-weight(approximately 280M) and replace the one in this directory

I solve that problem, thanks a lot

Green00101 commented 4 years ago

image

How do I slove this problem, and if its wrong it will told me

Traceback (most recent call last): File "yolo_video_new.py", line 387, in boxesTemp = updateTrackers(frame) File "yolo_video_new.py", line 320, in updateTrackers tracker, box = trackersList[n] IndexError: list index out of range

rutuja1409 commented 4 years ago

image

How do I slove this problem, and if its wrong it will told me

Traceback (most recent call last): File "yolo_video_new.py", line 387, in boxesTemp = updateTrackers(frame) File "yolo_video_new.py", line 320, in updateTrackers tracker, box = trackersList[n] IndexError: list index out of range

I am getting the same error. Can you tell me how did u solve it ?? Thank you..

rachitchokshi commented 4 years ago

Look above comments, @Yaoxiao1 has a solution which should work

image How do I slove this problem, and if its wrong it will told me Traceback (most recent call last): File "yolo_video_new.py", line 387, in boxesTemp = updateTrackers(frame) File "yolo_video_new.py", line 320, in updateTrackers tracker, box = trackersList[n] IndexError: list index out of range

I am getting the same error. Can you tell me how did u solve it ?? Thank you..

rutuja1409 commented 4 years ago

Look above comments, @Yaoxiao1 has a solution which should work

image How do I slove this problem, and if its wrong it will told me Traceback (most recent call last): File "yolo_video_new.py", line 387, in boxesTemp = updateTrackers(frame) File "yolo_video_new.py", line 320, in updateTrackers tracker, box = trackersList[n] IndexError: list index out of range

I am getting the same error. Can you tell me how did u solve it ?? Thank you..

Thank you for the solution. Can I increase the frame size or some other method which will increase the speed to get output faster? Please guide .

ezratoga commented 4 years ago

When i tried run the code: python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/

there was an error like this : Traceback (most recent call last): File "yolo_video_new.py", line 115, in "csrt": cv2.TrackerCSRT_create, AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create'

Anyone can help me?

durgeshkulkarni1999 commented 3 years ago

When i tried run the code: python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/

there was an error like this : Traceback (most recent call last): File "yolo_video_new.py", line 115, in "csrt": cv2.TrackerCSRT_create, AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create'

Anyone can help me?

You have install full opencv library for that you have to

Uninstall current opencv version by using pip uninstall opencv-python. Then install by using pip install opencv-contrib-python.

sifodev commented 2 years ago

When i tried run the code: python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/ there was an error like this : Traceback (most recent call last): File "yolo_video_new.py", line 115, in "csrt": cv2.TrackerCSRT_create, AttributeError: module 'cv2.cv2' has no attribute 'TrackerCSRT_create' Anyone can help me?

You have install full opencv library for that you have to

Uninstall current opencv version by using pip uninstall opencv-python. Then install by using pip install opencv-contrib-python.

u can use opencv-contrib-python==4.2.0.34 it will solve the issue for me

sifodev commented 2 years ago

Hello,

While trying to run the project through below command

python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/

The program crashes with below error

INFO] loading YOLO from disk...
[INFO] 120 total frames in video
Traceback (most recent call last):
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 314, in <module>
    thresholdRedLight = getLightThresh(showStages=True)
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 249, in getLightThresh
    im2, contours, hierarchy = cv2.findContours(th, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS)
ValueError: not enough values to unpack (expected 3, got 2)

After fixing this one it crashes with

Traceback (most recent call last):
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 516, in <module>
    boxesTemp = updateTrackers(frame)
  File "/home/xxxx/PR/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py", line 411, in updateTrackers
    tracker, box = trackersList[n]
IndexError: list index out of range 

Steps to Reproduce on a linux x86_64 machine

cd $HOME
git clone [https://github.com/AhmadYahya97/Fully-Automated-red-light-Violation-Detection](https://github.com/AhmadYahya97/Fully-Automated-red-light-Violation-Detection)
cd Fully-Automated-red-light-Violation-Detection/
python3 -m virtualenv venv
source venv/bin/activate
pip install numpy imutils matplotlib opencv-python opencv-contrib-python
python ~/Fully-Automated-red-light-Violation-Detection/yolo_video_new.py -i ~/Fully-Automated-red-light-Violation-Detection/videos/aziz1.MP4 -o ~/Fully-Automated-red-light-Violation-Detection/videos -y ~/Fully-Automated-red-light-Violation-Detection/yolo-coco/

how you solve the first error that u mentioned?

Mosh094 commented 2 years ago

Anyone has ran this on windows? I am having trouble running it

Guttappa1238 commented 2 years ago

Hi, i'm getting the same error how to solve this:

Traceback (most recent call last):
  File "yolo_video_new.py", line 516, in <module>
    boxesTemp = updateTrackers(frame)
  File "yolo_video_new.py", line 411, in updateTrackers
    tracker, box = trackersList[nn]
IndexError: list index out of range