A web-app that provides object detection using YOLOv3 and also an API.
It's implemented using django framework and PyTorch (for YOLO model). The app uses cloudinary API for image hosting.
You also need to download the yolo.weights
file and place it in the "weights" directory.
You can download the weights by -
$ wget https://pjreddie.com/media/files/yolov3.weights
Firstly, you need to put your cloudinary credentials (cloud_name, api_key and api_secret) in settings.py
file.
To run the server
$ pip3 install -r requirements.txt
$ python3 manage.py collectstatic
$ python3 manage.py runserver
The website is hosted at - https://object-detection-yolo.herokuapp.com
The detection service is currently not working because of memory limits of Heroku.
To use the web API, you can send a POST request to - https://object-detection-yolo.herokuapp.com/detect/api
You can send either of the following parameters -
Parameter | Type | Description |
---|---|---|
image | file | Image file that you want to detect. |
image64 | text | Image in base64 form that you want to detect. Currently supports JPEG images only |
Parameter | Type | Description |
---|---|---|
success | bool | Whether classification was successful or not |
detect | class label, float | pair of label and its confidence |
url | image URL | Link to the result image uploaded to cloudinary |
Example: {"success": true, "detect": { "dog": 0.9989, "truck": 0.9999 }, 'url':"https://example.com/image.png"}
"detect" will be empty if no objects are detected.
The website also shows the detection output with bounding boxes around the detected objects. There will be no box if the input doesn't contain any object.
No. of objects detected - 3
The result image is generated using matplotlib.
- Move app to Google Cloud Platform
- Create a docker image
If you want to contribute and/or find any bug, feel free to do a pull request!