Giter VIP home page Giter VIP logo

Comments (4)

yudingyuyihan avatar yudingyuyihan commented on June 21, 2024 5

Hello,
First of all I am beginner in this field and thanks in advance.

I have just tried the same code you provided but, the picture I am getting as an output is the same is the input. there are no squares indicating objects.

The output I get is: (the arrays are empty so it seems nothing gets detected)
(base) Davids-MacBook-Pro:Object_Detection davidlopez$ cd /Users/davidlopez/Documents/Object_Detection ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 /anaconda3/bin/python /Users/davidlopez/.vscode/extensions/ms-python.python-2019.1.0/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 56195 /Users/davidlopez/Documents/Object_Detection/Obj_detection.py
Using TensorFlow backend.
[] [] []

my code is:

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

read input image

image = cv2.imread('varios1.jpg')

apply object detection

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

print(bbox, label, conf)

draw bounding box over detected objects

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

display output

press any key to close window

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

save output

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

release resources

cv2.destroyAllWindows()

If you look at the original code of object_detection.py, you can find that to run the detect_common_objects () function, you need to download the two supporting files yolov3.cfg and yolov3.weights. But if you do n’t download it completely for the first time, these two files will exist, but the content is not complete. So it will cause detect_common_objects () to return null. At this time, you need to press shift + command + g to enter /user/XXXX/.cvlib/object_detection/yolo/yolov3 (if you have seen the source code, you can find yolov3.cfg and yolov3.weights saved in this hidden folder. ) Enter this directory. Then download it through the connection in the source code and put it in this directory.

from cvlib.

rafacompu avatar rafacompu commented on June 21, 2024 2

Try this:

bbox, label, conf = cv.detect_common_objects(image, confidence=0.25, model='yolov3-tiny')

I couldn't make it work in my macbook either until I tried this approach.

from cvlib.

rymoore avatar rymoore commented on June 21, 2024

Same issue. I'm also on a Macbook - I assume it must be Mac related?

from cvlib.

yudingyuyihan avatar yudingyuyihan commented on June 21, 2024

如果你有看object_detection.py这个原代码,你可以发现运行detect_common_objects()函数需要下载yolov3.cfg和yolov3.weights这两个支持文件的。但是如果首次运行,你没有完全下载,那么这两个文件虽然会存在,但是内容不全。所以会导致运行detect_common_objects()返回为空。这时候你需要按shift+command+g输入/user/XXXX/.cvlib/object_detection/yolo/yolov3(如果你有看源代码的话你可以发现yolov3.cfg和yolov3.weights保存在这个隐藏文件夹下。)进入这个目录。然后通过源代码里面的连接下载好后,放在这个目录下就好了。

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.