A simple Object Detection API with OpenCV and YOLO v3 using a pre-trained model.
Explore the docs »
View Usage
·
Report Bug
·
Request Feature
A simple Object Detection API with OpenCV and YOLO v3 using a pre-trained model.
Download YOLO v3:
cd metro-ai/yolo
wget https://github.com/pjreddie/darknet/blob/master/cfg/yolov3.cfg?raw=true
wget https://github.com/pjreddie/darknet/blob/master/data/coco.names?raw=true
wget https://pjreddie.com/media/files/yolov3.weights
python metro-ai.py
docker-compose up -d
Use the model/predict
endpoint to load a test image and get predicted labels.
curl -X POST -F image=@human-dog.jpg http://localhost:5000/model/predict -v
The coordinates of the bounding box are returned in the detection_box
field as normalized coordinates (ranging from 0 to 1) in the form [ymin, xmin, ymax, xmax]
.
{
"network_execution_time": 2640,
"predictions": [
{
"confidence": 0.9997827410697937,
"detection_box": [
0.20972222222222223,
0.21458333333333332,
0.8486111111111111,
0.56875
],
"label": "person",
"label_id": 0
},
{
"confidence": 0.9979773163795471,
"detection_box": [
0.5902777777777778,
0.48125,
0.8416666666666667,
0.8041666666666667
],
"label": "dog",
"label_id": 16
},
{
"confidence": 0.8539056777954102,
"detection_box": [
0.47638888888888886,
0.45416666666666666,
0.5083333333333333,
0.5666666666666667
],
"label": "frisbee",
"label_id": 29
}
]
}
The coordinates of the bounding box are returned in the detection_box field, and contain the array of normalized coordinates (ranging from 0 to 1) in the form [ymin, xmin, ymax, xmax].
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Antonio Di Virgilio - @antoniodvr