Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU Deployment Support #246

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Scaled-YOLOv4
# Welcome

This is the implementation of "[Scaled-YOLOv4: Scaling Cross Stage Partial Network](https://arxiv.org/abs/2011.08036)".
Scaled-YOLOv4: Scaling Cross Stage Partial Network is yolov4-csp. Actual produces erros on CPU so there is a bit modification. This is a small code to build API for newcomers. Please refer to [this original link for Scaled Yolov4 AKA yolov4-csp](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp)

![Scaled-YOLOv4](https://github.com/WongKinYiu/ScaledYOLOv4/blob/main/figure/scaled-yolov4.png)
Implementation is in `Pytorch` but you can use the `DarkNet`. Please refer to the original documentation.

* [YOLOv4-CSP](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp)
* [YOLOv4-tiny](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-tiny)
* [YOLOv4-large](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-large)

## Citation
# Why Fork?

```
@article{wang2020scaled,
title={{Scaled-YOLOv4}: Scaling Cross Stage Partial Network},
author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
journal={arXiv preprint arXiv:2011.08036},
year={2020}
}
```
If you are here, it means that you must be looking for a way to Deploy Scaled Yolov4 model using CPU. Original implementation uses `mishcuda` on the model loading itself so it generates error. `yolov4-csp` is actually `Scaled Yolov4`.

Steps:
1. Clone this repo
2. Navigate to `ScaledYOLOv4/`
3. You'll find it empty because all work is done on the `yolov4-csp` branch
5. On your terminal, do `git checkout yolov4-csp`
6. Store your model weights somewhere and edit the `weights` variable inside `API_deploy_CPU.py` (Optional)
7. run `python API_deploy_CPU.py`. It'll deploy a very very basic model on `flask`
8. Input the path to weights on terminal
9. Use `postman` or `requests` module to send the request at `localhost:5000/predict`. Check the port number first.
10. Results returned are list of lists in the form of `[ [x_min, y_min, x_max, y_ax, class, conf_score], [......], .....[...], ]`


I can bet You've missed `step No 4` ;)

## Note:
Code for this API is built around a Single class model. Please change and tweak the code given in `detect.py` according to your needs.