# Flask REST API
[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) [API](https://en.wikipedia.org/wiki/API)s are commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API created using Flask to expose the YOLOv5s model from [PyTorch Hub](https://pytorch.org/hub/ultralytics_yolov5/).
## Requirements
[Flask](https://palletsprojects.com/p/flask/) is required. Install with:
```shell
$ pip install Flask
```
## Run
After Flask installation run:
```shell
$ python3 restapi.py --port 5000
```
Then use [curl](https://curl.se/) to perform a request:
```shell
$ curl -X POST -F image=@zidane.jpg 'http://localhost:5000/v1/object-detection/yolov5s'`
```
The model inference results are returned as a JSON response:
```json
[
{
"class": 0,
"confidence": 0.8900438547,
"height": 0.9318675399,
"name": "person",
"width": 0.3264600933,
"xcenter": 0.7438579798,
"ycenter": 0.5207948685
},
{
"class": 0,
"confidence": 0.8440024257,
"height": 0.7155083418,
"name": "person",
"width": 0.6546785235,
"xcenter": 0.427829951,
"ycenter": 0.6334488392
},
{
"class": 27,
"confidence": 0.3771208823,
"height": 0.3902671337,
"name": "tie",
"width": 0.0696444362,
"xcenter": 0.3675483763,
"ycenter": 0.7991207838
},
{
"class": 27,
"confidence": 0.3527112305,
"height": 0.1540903747,
"name": "tie",
"width": 0.0336618312,
"xcenter": 0.7814827561,
"ycenter": 0.5065554976
}
]
```
An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given in `example_request.py`
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于YOLOv5+Deepsort实现车辆行人追踪和计数(完整源码+说明文档+数据).zip 1、资源内容:基于YOLOv5+Deepsort实现车辆行人追踪和计数(完整源码+说明文档+数据).zip 2、代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 3、适用对象:计算机,电子信息工程、数学等专业的大学生课程设计和毕业设计。 4、作者介绍:某大厂资深算法工程师,从事Matlab、Python、C/C++、Java、YOLO算法仿真工作10年;擅长计算机视觉、目标检测模型、智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、智能控制、路径规划、无人机等多种领域的算法仿真实验。 基于YOLOv5+Deepsort实现车辆行人追踪和计数(完整源码+说明文档+数据).zip 1、资源内容:基于YOLOv5+Deepsort实现车辆行人追踪和计数(完整源码+说明文档+数据).zip 2、代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 3、适用对象:计算机,电子信息工程、数学等专业的大学生课程设计和毕业设计。 4、作者介绍:某大厂资深算法工程师,
资源推荐
资源详情
资源评论
收起资源包目录
基于YOLOv5+Deepsort实现车辆行人追踪和计数(完整源码+说明文档+数据).zip (134个子文件)
Dockerfile 821B
手册.docx 28KB
.gitkeep 0B
train.jpg 59KB
README.md 2KB
README.md 65B
result.mp4 8.55MB
image.png 799KB
yolov5s.pt 14.11MB
datasets.py 44KB
general.py 28KB
plots.py 18KB
wandb_utils.py 16KB
common.py 16KB
yolo.py 13KB
torch_utils.py 12KB
json_logger.py 11KB
loss.py 9KB
metrics.py 9KB
kalman_filter.py 8KB
autoanchor.py 7KB
export.py 7KB
linear_assignment.py 6KB
train.py 6KB
nn_matching.py 5KB
experimental.py 5KB
google_utils.py 5KB
track.py 5KB
io.py 4KB
tracker.py 4KB
activations.py 4KB
evaluation.py 3KB
deep_sort.py 3KB
original_model.py 3KB
model.py 3KB
tracker.py 3KB
iou_matching.py 3KB
test.py 2KB
AIDetector_pytorch.py 2KB
preprocessing.py 2KB
feature_extractor.py 2KB
demo.py 1KB
draw.py 1KB
resume.py 1KB
BaseDetector.py 1KB
restapi.py 1KB
parser.py 976B
detection.py 825B
log_dataset.py 800B
tools.py 734B
__init__.py 500B
log.py 463B
asserts.py 316B
example_request.py 299B
evaluate.py 293B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
datasets.cpython-37.pyc 34KB
general.cpython-37.pyc 23KB
common.cpython-36.pyc 19KB
common.cpython-37.pyc 19KB
plots.cpython-37.pyc 16KB
torch_utils.cpython-37.pyc 11KB
yolo.cpython-37.pyc 11KB
metrics.cpython-37.pyc 8KB
linear_assignment.cpython-36.pyc 7KB
kalman_filter.cpython-36.pyc 7KB
kalman_filter.cpython-37.pyc 7KB
autoanchor.cpython-37.pyc 6KB
experimental.cpython-36.pyc 6KB
experimental.cpython-37.pyc 6KB
nn_matching.cpython-36.pyc 6KB
nn_matching.cpython-37.pyc 6KB
track.cpython-36.pyc 5KB
linear_assignment.cpython-37.pyc 5KB
track.cpython-37.pyc 5KB
tracker.cpython-36.pyc 5KB
tracker.cpython-37.pyc 4KB
deep_sort.cpython-36.pyc 4KB
deep_sort.cpython-37.pyc 4KB
google_utils.cpython-37.pyc 3KB
iou_matching.cpython-37.pyc 3KB
iou_matching.cpython-36.pyc 3KB
model.cpython-37.pyc 3KB
model.cpython-36.pyc 3KB
feature_extractor.cpython-36.pyc 3KB
feature_extractor.cpython-37.pyc 3KB
preprocessing.cpython-37.pyc 2KB
preprocessing.cpython-36.pyc 2KB
detection.cpython-36.pyc 2KB
BaseDetector.cpython-37.pyc 2KB
parser.cpython-37.pyc 1KB
parser.cpython-36.pyc 1KB
detection.cpython-37.pyc 1KB
__init__.cpython-37.pyc 676B
共 134 条
- 1
- 2
盈梓的博客
- 粉丝: 6867
- 资源: 1248
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页