Comments (4)
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 cv2read 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.
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.
Same issue. I'm also on a Macbook - I assume it must be Mac related?
from cvlib.
如果你有看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)
- object Detection color HOT 2
- is there anyway i can detect house in the image HOT 1
- The 'cvlib' distribution was not found and is required by the application in PyInstaller HOT 2
- What dataset have you used to make face detector part of this model? HOT 1
- Count objects detected using cvlib HOT 2
- ModuleNotFoundError HOT 3
- draw_bbox() Line size is fixed at a value of 2 pixels HOT 1
- No face detected in image HOT 1
- The recognition rate of pictures taken by wide-angle lens is low
- yolov4 HOT 4
- Invalid bounding boxes returned occasionally HOT 1
- Is there a way of using face recognition?
- How to add text as object to be detected
- Live Face Detect
- Unable to execute object_detection HOT 7
- library not working
- About Error invalid index to scalar variable in object_detection.py HOT 1
- Add requirements.txt
- 'str' object has no attribute 'shape' HOT 13
- This module is officially broken now with any of the latest python versions, eg python version higher than 3.9 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvlib.