Giter VIP home page Giter VIP logo

object-detection-opencv's People

Contributors

arun-1000lookz avatar arunponnusamy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

object-detection-opencv's Issues

Error, help me to fix this (I'm using jupyter notebook)

usage: ipykernel_launcher.py [-h] -i IMAGE -c CONFIG -w WEIGHTS -cl CLASSES
ipykernel_launcher.py: error: the following arguments are required: -i/--image, -c/--config, -w/--weights, -cl/--classes
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

C:\Users\adith\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3333: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

error 2:

image = cv2.imread(args.image)


NameError Traceback (most recent call last)
in
----> 1 image = cv2.imread(args.image)

NameError: name 'args' is not defined

scale in cv2.readNet

Hi,

i am confused about the scale parameter setting to 0.00392 in cv2.readNet. How to get this figure? Could you please explain.

thanks a lot

Failed to parse NetParameter file: yolov3.weights in function 'cv::dnn::dnn4_v20201117::readNetFromDarknet'

I ran the code and got this error:

cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-6uw63ony\opencv\modules\dnn\src\darknet\darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: yolov3.weights in function 'cv::dnn::dnn4_v20201117::readNetFromDarknet'
Any idea? Do I have a version incompatibility?

python 3.6.8
opencv-python 4.5.1.48

TypeError: only size-1 arrays can be converted to Python scalars

Traceback (most recent call last):
File "yolodetect2.py", line 98, in
draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h))
File "yolodetect2.py", line 39, in draw_prediction
cv2.rectangle(img, (x,y), (x_plus_w,y_plus_h), color, 2)
TypeError: only size-1 arrays can be converted to Python scalars

ubuntu version 16.04
python version 2.7.12
opencv version 4.1.0

please help me to for how to get the high accuracy in faster-rcnn and parameter tuning

For getting more accuracy in faster-rcnn , which parameters i have to tune (tuning parameters). please anybody provide the solution for that problem, actually my model is working but the problem is getting less accuracy and some miss classifications are happens , so please kindly provide solution for getting high accuracy in the model.

Thanking you!

Command prompt hangs

After running the given command to run the script , the command prompt hangs and no response in observed

Error: AttributeError: module 'cv2' has no attribute 'dnn'

When I execute the below command on Python openCV virtual environment, I am getting an error.

$ python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt

Error Logs:
Traceback (most recent call last):
File "yolo_opencv.py", line 59, in
net = cv2.dnn.readNet(args.weights, args.config)
AttributeError: module 'cv2' has no attribute 'dnn'

Error

Error:- -i IMAGE -c CONFIG -w WEIGHTS -cl CLASSES
detect.py: error: the following arguments are required: -i/--image, -c/--config, -w/--weights, -cl/--classes
can you please solve this error

Viewing Output

Hi @arunponnusamy

I am a beginner and trying to run the code you provided. After running the code, I was expecting to see the output something similar to:
image

But, I guess my code is not running completely, because I see just this:
image

Could you please help me out?

unrecognized arguments: --image dog.jpg

Help please :)

E:\YOLOV3\yolo-custom-object-detector-master\python>python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights darknet19.weights --classes yolov3.txt
usage: yolo_opencv.py [-h] [-c CONFIG] [-w WEIGHTS] [-cl CLASSES]
yolo_opencv.py: error: unrecognized arguments: --image dog.jpg

IndexError: invalid index to scalar variable.

I've done everything that is required in README, but once I put python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt in Terminal I get the following error:

Traceback (most recent call last): File "C:\Users\.....\yolo_opencv.py", line 50, in <module> outs = net.forward(get_output_layers(net)) File "C:\Users\......\yolo_opencv.py", line 20, in get_output_layers output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] File "C:\.....\yolo_opencv.py", line 20, in <listcomp> output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] IndexError: invalid index to scalar variable.

I've tried experimenting with i[0] - 1 (like putting i[0] or i[1] - 1) but to no avail. Am I doing something wrong? Can someone help, pretty please?
(I'm using PYCharm latest version (as of 04.11), just in case)
Thank you in advance!

readNet issue

net = cv2.dnn.readNet(args.weights, args.config)
AttributeError: module 'cv2.dnn' has no attribute 'readNet'

File "yolo_opencv.py", line 39, in draw_prediction

Mac OSX 10.14.1 (18B75)

Traceback (most recent call last):
File "yolo_opencv.py", line 98, in
draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h))
File "yolo_opencv.py", line 39, in draw_prediction
cv2.rectangle(img, (x,y), (x_plus_w,y_plus_h), color, 2)
TypeError: only length-1 arrays can be converted to Python scalars

Detect_person

Hi Arun,

I recently came across your code. I am using it in a project I am working on. I needed to detect only persons in the room. Is it possible to detect only a person using the object-detection code?

How can I do when 'IndexError: invalid index to scalar variable'. Its different from #34

D:\...\YOLOobject-detection-opencv>python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt Traceback (most recent call last): File "D:\...\YOLOobject-detection-opencv\yolo_opencv.py", line 63, in <module> outs = net.forward(get_output_layers(net)) File "D:\...\YOLOobject-detection-opencv\yolo_opencv.py", line 28, in get_output_layers output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] File "D:\...\YOLOobject-detection-opencv\yolo_opencv.py", line 28, in <listcomp> output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] IndexError: invalid index to scalar variable.

version of opencv-python

Hi,
I can't manage to make this code work because of numpy and opencv-python are not working. I got the "Importing the multiarray numpy extension module failed" error. What is your configurations of those package and what is your version of python ?

Error when using readNetfromDarknet

I managed to run the inference script fine when using readNet, but now I want to use readNetfromDarknet to use the GPU. I have everything installed and running for using the GPU. However, I get this error

Exception has occurred: error
OpenCV(4.3.0-pre) C:\gitLocal\opencv\modules\dnn\src\darknet\darknet_io.cpp:601: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'
  

Any help would be appreciated. Thanks!

cv2.dnn.readNet issue with Tiny cfg

Hi

Thanks for your sharing.

I have no issue with the yolov3 weights and yolov3.cfg but I got the following issue with Yolov3_tiny.weights and Yolov3_tiny.cfg.

cv2.error: OpenCV(3.4.3) /Users/travis/build/skvark/opencv-python/opencv/modules/dnn/src/darknet/darknet_io.cpp:507: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream'

Just wonder if you have any idea?

'module' has no 'readNet'

hi,

i'm trying to use yolo but when i use the command
$ python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt

i get the following error

Traceback (most recent call last):
  File "yolo_opencv.py", line 57, in <module>
    net = cv2.dnn.readNet(args.weights, args.config)
AttributeError: 'module' object has no attribute 'readNet'

i'm using python 2.7.12

if I use python 3
$ python3 yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt i get this error

Traceback (most recent call last):
  File "yolo_opencv.py", line 8, in <module>
    import cv2
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type

how can i solve this error? (both would be nice, i would like to use python3 if it's possible)

Training the model

Hi @arunponnusamy ,

I might not make sense, so I apologize beforehand. I understand that the DNN module provided here is just for running the images. But in case I want to train the model and check the outcome myself. Or to put it in a better way; what if I would want to make changes to the existing YOLO model to either improve the results. How do I approach? Could you please suggest on how to go about?

TypeError: integer argument expected, got float

I get this error

python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.
weights --classes yolov3.txt
Traceback (most recent call last):
  File "yolo_opencv.py", line 93, in <module>
    draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h))
  File "yolo_opencv.py", line 36, in draw_prediction
    cv2.rectangle(img, (x,y), (x_plus_w,y_plus_h), color, 2)
TypeError: integer argument expected, got float

so I changed this line

98 draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h))
to
draw_prediction(image, class_ids[i], confidences[i], int(x), int(y), int(x+w), int(y+h))
and then it solved

opencv cannot read net - Error of "Unknown layer type"

Hello,
I am trying to use your code for running detection of yolo v1.
I use python 3.5
I use opencv 4.1.0
The error occurs in line 57:
net = cv2.dnn.readNet(args.weights, args.config)
It says:

cv2.error: OpenCV(4.1.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:668: error: (-212:Parsing error) Unknown layer type: connected in function 'ReadDarknetFromCfgStream'

I took the weights and config from the original Darknet.
I tried weights and cfg for yolov1, as well as for yolov1 tiny, but the same error happens for both.
On the other hand, when I tried weights and cfg for yolov3, it succeeded.
So, does cv2.dnn modules are not compatible with yolo1? Is that the problem or anything else?

Thanks!

SystemExit: 2

hi,
When I try to run this code ,there is error like this:

An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
E:\Anaconda\envs\opencv-env\lib\site-packages\IPython\core\interactiveshell.py:3275: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

How can I solve this issue?
Please tell me if you know this problem.

other jpg error

hi,

i've tried to use an other image (this one : https://www.actu-environnement.com/images/illustrations/breves/32181_fb.jpg)

when i run yolo with
python yolo_opencv.py --image trafic.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.py

i get this error

Traceback (most recent call last):
  File "yolo_opencv.py", line 52, in <module>
    with open(args.classes, 'r') as f:
IOError: [Errno 2] No such file or directory: 'yolov3.py'

yolo work with dog.jpg
Did you know how to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.