Giter VIP home page Giter VIP logo

Comments (13)

arunponnusamy avatar arunponnusamy commented on August 25, 2024

You need to read the image before passing it to detect_common_objects function.

# read input image
image = cv2.imread('object_detection_input.jpg')

# apply object detection
bbox, label, conf = cv.detect_common_objects(image)

Checkout this complete example.

from cvlib.

 avatar commented on August 25, 2024

As i try that, i get the second error:Traceback (most recent call last): File "G:\SR4E1\test-object-detectie1.py", line 12, in <module> bbox, label, conf = cv.detect_common_objects(image) File "C:\Users\philippechristl\AppData\Local\Programs\Python\Python310\lib\site-packages\cvlib\object_detection.py", line 77, in detect_common_objects Height, Width = image.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

from cvlib.

arunponnusamy avatar arunponnusamy commented on August 25, 2024

Make sure that you are giving the correct path to the input image while reading using cv2.imread. Try giving the complete path to the image. For example, if the image is in SR4E1 folder, try using the path as below.

image = cv2.imread('G:\SR4E1\object_detection_input.jpg')

Checkout this Colab notebook to learn more.

from cvlib.

 avatar commented on August 25, 2024

Still the same error ...

from cvlib.

arunponnusamy avatar arunponnusamy commented on August 25, 2024

Can you share the complete code and input image you are using ? Let me try to reproduce this error on my end for debugging. Please share the version of OpenCV, cvlib and Python as well.

from cvlib.

 avatar commented on August 25, 2024

python version = 3.10.8
cvlib version = 0.2.7
OpenCV version = 1.0.0
image = https://github.com/arunponnusamy/cvlib/blob/master/examples/images/object_detection_input.jpg

`import cvlib as cv
from cvlib.object_detection import draw_bbox
import sys
import cv2

image = cv2.imread(sys.argv[1])

bbox, label, conf = cv.detect_common_objects(image)
print(bbox, label, conf)

out = draw_bbox(image, bbox, label, conf)

cv2.imshow("object_detection", out)
cv2.waitKey()

cv2.imwrite("object_detection.jpg", out)

cv2.destroyAllWindows()`

from cvlib.

arunponnusamy avatar arunponnusamy commented on August 25, 2024

What command are you using to run the code ?

from cvlib.

 avatar commented on August 25, 2024

python E:\SR4E1\test-object-detectie1.py E:\SR4E1\imeges\object_detection_input.jpg (on Windows 10)

from cvlib.

arunponnusamy avatar arunponnusamy commented on August 25, 2024

It seems that there is issue in reading the image. Are you sure the path to the input image is correct ?
The folder name is images or imeges ? Is that a typo ?

from cvlib.

 avatar commented on August 25, 2024

That is a typo. The folder name is images

from cvlib.

arunponnusamy avatar arunponnusamy commented on August 25, 2024

Can you try running the command from the SR4E1 folder ?

cd E:\SR4E1\
python test-object-detectie1.py E:\SR4E1\images\object_detection_input.jpg

from cvlib.

 avatar commented on August 25, 2024

Still the same error ...

from cvlib.

 avatar commented on August 25, 2024

As i convert the images to PNG it's work! Thank you for helping me. (and for the easy to use libarty)

from cvlib.

Related Issues (20)

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.