# 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 实时目标检测的高效 Apex Legends Aimbot
共86个文件
pyc:31个
py:24个
yaml:19个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 42 浏览量
2024-05-28
17:55:23
上传
评论
收藏 36.09MB ZIP 举报
温馨提示
所需条件 兼容 CUDA 的 GPU,性能低于 RTX3060 的显卡可能无法完美工作 如何使用 通过以下方式在requirements.txt上安装全部 pip install -r requirements.txt 模式遵循文件中的代码 80:classname = "PotPlayer64" ## HERE PUT YOUR APEX OR VIDEO PLAYER CLASS NAME 81:titlename = "testapex.mp4 - PotPlayer" ## HERE PUT YOUR APEX OR VIDEO PLAYER WINDOW NAME 然后有一个快乐的测试 # run this in NON-CHINESE folder and using a python 3.7+ (Recommend Python 3.8 anaconda) # May need Admin Powershell python main.py
资源推荐
资源详情
资源评论
收起资源包目录
ProjectAim-ApexLegends-main.zip (86个子文件)
ProjectAim-ApexLegends-main
.vscode
settings.json 69B
weights
apexSt1.pt 13.74MB
main.py 8KB
testvideo.mp4 22.23MB
utils
__init__.py 0B
google_utils.py 6KB
loss.py 9KB
flask_rest_api
example_request.py 299B
restapi.py 1KB
README.md 2KB
metrics.py 9KB
aws
__init__.py 0B
userdata.sh 1KB
mime.sh 780B
resume.py 1KB
autoanchor.py 7KB
general.py 29KB
wandb_logging
__init__.py 0B
log_dataset.py 800B
__pycache__
wandb_utils.cpython-36.pyc 12KB
__init__.cpython-36.pyc 134B
wandb_utils.cpython-38.pyc 12KB
__init__.cpython-38.pyc 142B
wandb_utils.py 16KB
activations.py 4KB
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 34KB
plots.cpython-36.pyc 16KB
general.cpython-36.pyc 23KB
datasets.cpython-36.pyc 34KB
torch_utils.cpython-36.pyc 11KB
google_utils.cpython-38.pyc 4KB
loss.cpython-38.pyc 6KB
google_utils.cpython-36.pyc 4KB
general.cpython-38.pyc 23KB
__init__.cpython-36.pyc 120B
loss.cpython-36.pyc 6KB
autoanchor.cpython-38.pyc 6KB
autoanchor.cpython-36.pyc 6KB
metrics.cpython-36.pyc 7KB
__init__.cpython-38.pyc 128B
plots.cpython-38.pyc 16KB
torch_utils.py 12KB
game.jpg 3.93MB
tmpimg
haha.jpg 7.91MB
requirements.txt 677B
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 7KB
yolov5m.yaml 1KB
yolov5s.yaml 1KB
yolov5l.yaml 1KB
common.py 16KB
experimental.py 5KB
__pycache__
experimental.cpython-38.pyc 6KB
experimental.cpython-36.pyc 6KB
yolo.cpython-36.pyc 11KB
common.cpython-36.pyc 19KB
__init__.cpython-36.pyc 121B
common.cpython-38.pyc 18KB
yolo.cpython-38.pyc 11KB
__init__.cpython-38.pyc 129B
yolov5x.yaml 1KB
yolo.py 13KB
detect.py 9KB
__pycache__
detect.cpython-38.pyc 6KB
README.md 1KB
共 86 条
- 1
资源评论
hakesashou
- 粉丝: 6722
- 资源: 1675
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功