# 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`
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于yolov5的车牌检测,包括车牌转角检测-yolov5车牌.zip (95个子文件)
yolov5-car-plate-master
LICENSE.md 11KB
result.jpg 196KB
weights
download_weights.sh 277B
data
coco128.yaml 2KB
argoverse_hd.yaml 849B
hyp.finetune.yaml 846B
coco.yaml 2KB
plat.yaml 345B
images
zidane.jpg 165KB
bus.jpg 476KB
voc.yaml 738B
hyp.scratch.yaml 2KB
scripts
get_argoverse_hd.sh 2KB
get_voc.sh 4KB
get_coco.sh 963B
LICENSE 34KB
result_warp.jpg 27KB
hubconf.py 5KB
utils
plate_loss.py 14KB
__init__.py 0B
google_utils.py 5KB
loss.py 9KB
flask_rest_api
example_request.py 299B
restapi.py 1KB
README.md 1KB
metrics.py 9KB
aws
__init__.py 0B
userdata.sh 1KB
mime.sh 780B
resume.py 1KB
autoanchor.py 7KB
plate_datasets.py 47KB
general.py 30KB
wandb_logging
__init__.py 0B
log_dataset.py 819B
__pycache__
wandb_utils.cpython-38.pyc 11KB
__init__.cpython-38.pyc 176B
wandb_utils.py 16KB
activations.py 2KB
google_app_engine
Dockerfile 821B
app.yaml 173B
additional_requirements.txt 105B
plots.py 18KB
datasets.py 44KB
__pycache__
metrics.cpython-38.pyc 7KB
torch_utils.cpython-38.pyc 11KB
datasets.cpython-38.pyc 33KB
google_utils.cpython-38.pyc 3KB
loss.cpython-38.pyc 6KB
general.cpython-38.pyc 22KB
plate_loss.cpython-38.pyc 9KB
autoanchor.cpython-38.pyc 6KB
plate_datasets.cpython-38.pyc 35KB
__init__.cpython-38.pyc 162B
plots.cpython-38.pyc 16KB
torch_utils.py 12KB
Dockerfile 2KB
requirements.txt 599B
detect_one.py 7KB
models
hub
yolov5x6.yaml 2KB
anchors.yaml 3KB
yolov5-p2.yaml 2KB
yolov5-panet.yaml 1KB
yolov5s6.yaml 2KB
yolov3.yaml 1KB
yolov5-p6.yaml 2KB
yolov5-p7.yaml 2KB
yolov5l6.yaml 2KB
yolov5m6.yaml 2KB
yolov3-spp.yaml 1KB
yolov3-tiny.yaml 1KB
yolov5-fpn.yaml 1KB
yolov5s-transformer.yaml 1KB
__init__.py 0B
export.py 5KB
yolov5m.yaml 1KB
yolov5s.yaml 1KB
yolov5l.yaml 1KB
common.py 16KB
experimental.py 5KB
__pycache__
experimental.cpython-38.pyc 6KB
yolo_plate.cpython-38.pyc 10KB
common.cpython-38.pyc 18KB
yolo.cpython-38.pyc 10KB
__init__.cpython-38.pyc 163B
yolov5x.yaml 1KB
yolo.py 12KB
yolo_plate.py 12KB
detect.py 9KB
.gitignore 350B
train.py 34KB
__pycache__
test.cpython-38.pyc 11KB
test.py 17KB
README.md 761B
基于yolov5的车牌检测,包含车牌角点检测_yolov5-car-plate
项目内附说明
如果解压失败请用ara软件解压.txt 42B
共 95 条
- 1
资源评论
好家伙VCC
- 粉丝: 2143
- 资源: 9145
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功