antoniodvr / metro-ai

🧠 Object Detection API with OpenCV and YOLO v3 using a pre-trained model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

metro-ai

A simple Object Detection API with OpenCV and YOLO v3 using a pre-trained model.
Explore the docs »


View Usage · Report Bug · Request Feature

Table of Contents

About The Project

A simple Object Detection API with OpenCV and YOLO v3 using a pre-trained model.

Built With

Usage

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

As a library

python metro-ai.py

As a Docker container

docker-compose up -d

Make a prediction

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].

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Antonio Di Virgilio - @antoniodvr

About

🧠 Object Detection API with OpenCV and YOLO v3 using a pre-trained model

License:MIT License


Languages

Language:Python 95.2%Language:Dockerfile 4.8%