# 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:
```shell
[{'class': 0,
'confidence': 0.8197850585,
'name': 'person',
'xmax': 1159.1403808594,
'xmin': 750.912902832,
'ymax': 711.2583007812,
'ymin': 44.0350036621},
{'class': 0,
'confidence': 0.5667674541,
'name': 'person',
'xmax': 1065.5523681641,
'xmin': 116.0448303223,
'ymax': 713.8904418945,
'ymin': 198.4603881836},
{'class': 27,
'confidence': 0.5661227107,
'name': 'tie',
'xmax': 516.7975463867,
'xmin': 416.6880187988,
'ymax': 717.0524902344,
'ymin': 429.2020568848}]
```
An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given in `example_request.py`
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于YOLOv7-plate和CRNN的车牌号检测识别项目源码+pyqt5界面源码+模型+详细运行说明.zip (125个子文件)
detect_rec_plate.cpp 31KB
plate_rec.cpp 8KB
onnx2trt.cpp 7KB
utils.cpp 5KB
preprocess.cu 4KB
logging.h 17KB
preprocess.h 373B
utils.hpp 3KB
single_blue.jpg 1.81MB
single_blue.jpg 1.81MB
demo.jpg 1.23MB
xue.jpg 999KB
single_green.jpg 903KB
hongkang1.jpg 571KB
single_blue.jpg 475KB
police.jpg 382KB
000000390555_AE.jpg 225KB
xue.jpg 210KB
000000390555_YP.jpg 179KB
police.jpg 116KB
shi_lin_guan.jpg 105KB
single_yellow.jpg 105KB
single_yellow.jpg 85KB
shi_lin_guan.jpg 47KB
14.jpg 34KB
nongyong_double.jpg 34KB
double_yellow.jpg 29KB
README.md 1KB
README.md 1KB
README.md 1KB
README.md 444B
tmp3514.png 2.06MB
minghang.png 711KB
minghang.png 692KB
1.png 26KB
AP50_GMACS_val.png 25KB
yolov7-lite-s.pt 2.33MB
best.pt 2.32MB
yolov7-lite-t.pt 727KB
plate_rec_color.pth 733KB
plate_rec.pth 674KB
datasets.py 50KB
train.py 35KB
general.py 31KB
yolo.py 30KB
common.py 30KB
common_ori.py 28KB
test.py 22KB
plots.py 22KB
wandb_utils.py 16KB
loss.py 13KB
torch_utils.py 12KB
ui_yolo.py 11KB
detect.py 11KB
yolov7_plate_onnx_infer.py 11KB
metrics.py 9KB
plateNet.py 8KB
yolov7_detect_rec.py 8KB
export.py 7KB
autoanchor.py 7KB
test_widerface.py 7KB
hubconf.py 6KB
experimental.py 5KB
google_utils.py 5KB
get_small_pic.py 4KB
plate_rec.py 4KB
activations.py 4KB
ncnn_export.py 3KB
resume.py 1KB
restapi.py 1KB
test.py 880B
log_dataset.py 824B
cv_puttext.py 818B
read_image.py 580B
double_plate_split_merge.py 476B
example_request.py 312B
__init__.py 6B
__init__.py 6B
__init__.py 6B
__init__.py 6B
datasets.cpython-37.pyc 36KB
common.cpython-37.pyc 34KB
general.cpython-37.pyc 24KB
yolo.cpython-37.pyc 21KB
plots.cpython-37.pyc 18KB
torch_utils.cpython-37.pyc 11KB
wandb_utils.cpython-37.pyc 11KB
loss.cpython-37.pyc 8KB
metrics.cpython-37.pyc 7KB
autoanchor.cpython-37.pyc 6KB
plateNet.cpython-37.pyc 6KB
yolov7_detect_rec.cpython-37.pyc 6KB
experimental.cpython-37.pyc 6KB
plate_rec.cpython-37.pyc 3KB
google_utils.cpython-37.pyc 3KB
cv_puttext.cpython-37.pyc 925B
double_plate_split_merge.cpython-37.pyc 699B
__init__.cpython-37.pyc 163B
__init__.cpython-37.pyc 150B
__init__.cpython-37.pyc 149B
共 125 条
- 1
- 2
资源评论
熬夜写代码的平头哥
- 粉丝: 3792
- 资源: 7360
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功