# Streamlit-YOLOv5-Modle2X
**Repository Path**: CV_Lab/streamlit_yolov5_modle2x
## Basic Information
- **Project Name**: Streamlit-YOLOv5-Modle2X
- **Description**: 🚀 基于Streamlit的YOLOv5模型转换可视化工具
- **Primary Language**: Python
- **License**: GPL-3.0
- **Default Branch**: master
- **Homepage**: https://gitee.com/PyCVer
- **GVP Project**: No
## Statistics
- **Stars**: 26
- **Forks**: 15
- **Created**: 2022-07-12
- **Last Updated**: 2025-03-30
## Categories & Tags
**Categories**: ai
**Tags**: YOLOv5, 模型转换, 计算机视觉, streamlit, streamlit, onnx
## README
基于Streamlit的YOLOv5模型转换可视化工具
## 🚀 作者简介
曾逸夫,从事人工智能研究与开发;主研领域:计算机视觉;[YOLOv8官方开源项目代码贡献人](https://github.com/ultralytics/ultralytics/graphs/contributors);[YOLOv5官方开源项目代码贡献人](https://github.com/ultralytics/yolov5/graphs/contributors);[YOLOv5 v6.1代码贡献人](https://github.com/ultralytics/yolov5/releases/tag/v6.1);[YOLOv5 v6.2代码贡献人](https://github.com/ultralytics/yolov5/releases/tag/v6.2);[YOLOv5 v7.0代码贡献人](https://github.com/ultralytics/yolov5/releases/tag/v7.0);[Gradio官方开源项目代码贡献人](https://github.com/gradio-app/gradio/graphs/contributors)
❤️ Github:https://github.com/Zengyf-CVer
🔥 YOLOv8 官方开源项目PR ID:
- Fix YOLOv8 Chinese introduction:https://github.com/ultralytics/ultralytics/pull/219
- Add codespell and upgrade some components:https://github.com/ultralytics/ultralytics/pull/599
- Add pycln:https://github.com/ultralytics/ultralytics/pull/7141
- Fix heatmap width and height parameter bug:https://github.com/ultralytics/ultralytics/pull/7368
- ultralytics 8.0.237 cv2.CAP_PROP fix and in_counts and out_counts displays:https://github.com/ultralytics/ultralytics/pull/7380
💡 Ultralytics v8.1.0 代码贡献链接:
- https://github.com/ultralytics/ultralytics/releases/tag/v8.1.0
🔥 YOLOv5 官方开源项目PR ID:
- Save \*.npy features on detect.py `--visualize`:https://github.com/ultralytics/yolov5/pull/5701
- Fix `detect.py --view-img` for non-ASCII paths:https://github.com/ultralytics/yolov5/pull/7093
- Fix Flask REST API:https://github.com/ultralytics/yolov5/pull/7210
- Add yesqa to precommit checks:https://github.com/ultralytics/yolov5/pull/7511
- Add mdformat to precommit checks and update other version:https://github.com/ultralytics/yolov5/pull/7529
- Add TensorRT dependencies:https://github.com/ultralytics/yolov5/pull/8553
- Add paddle tips:https://github.com/ultralytics/yolov5/pull/9502
💡 YOLOv5 v6.1 & v6.2 & v7.0 代码贡献链接:
- https://github.com/ultralytics/yolov5/releases/tag/v6.1
- https://github.com/ultralytics/yolov5/releases/tag/v6.2
- https://github.com/ultralytics/yolov5/releases/tag/v7.0
🔥 Gradio 官方开源项目PR ID:
- Create a color generator demo:https://github.com/gradio-app/gradio/pull/1872
🚀更新走势
- `2022-08-14` **⚡ [Streamlit YOLOv5 Model2X v0.3](https://gitee.com/CV_Lab/streamlit_yolov5_modle2x/releases/v0.3)正式上线**
- `2022-07-17` **⚡ [Streamlit YOLOv5 Model2X v0.2](https://gitee.com/CV_Lab/streamlit_yolov5_modle2x/releases/v0.2)正式上线**
- `2022-07-15` **⚡ [Streamlit YOLOv5 Model2X v0.1](https://gitee.com/CV_Lab/streamlit_yolov5_modle2x/releases/v0.1)正式上线**
🤗在线Demo
### ❤️ 快速体验
本项目提供了**在线demo**,点击下面的logo,进入**Hugging Face Spaces**中快速体验:
💎项目流程与用途
### 📌 项目整体流程
### 📌 项目示例
#### ❤️ 单选,单个模型转换界面与下载效果
上传界面
单选 模型界面(v0.1)
单选 模型转换与下载界面(v0.1)
#### ❤️ 多选,多项模型转换界面与下载效果
多选 模型界面(v0.2)
多选 模型操作与转换界面(v0.2)
多选 模型转换界面(v0.2)
多选 模型转换与下载界面(v0.2)
模型下载解压界面(v0.2)
❗ 注:`tflite`和`tfjs`需要分开导出;除`CoreML`外,其他`half`导出需要选中`cuda:0`
💡项目结构
```
.
├── streamlit_yolov5_modle2x # 项目名称
│ ├── models # YOLOv5官方模型文件
│ ├── model_config # YOLOv5官方工具包
│ ├── val.py # YOLOv5官方验证文件
│ ├── export.py # YOLOv5官方导出文件
│ ├── __init__.py # 初始化文件
│ ├── app_01.py # 单选,单个模型转换和下载
│ ├── app_02.py # 多选,多项模型转换和打包下载
│ ├── app_03.py # 多选,多项模型转换和打包下载
│ ├── LICENSE # 项目许可
│ ├── CodeCheck.md # 代码检查
│ ├── .gitignore # git忽略文件
│ ├── setup.cfg # pre-commit CI检查源配置文件
│ ├── .pre-commit-config.yaml # pre-commit配置文件
│ ├── yolov5_pytorch_gpu.md # YOLOv5 PyTorch GPU安装教程
│ ├── README.md # 项目说明
│ └── requirements.txt # 脚本依赖包
```
🔥安装教程
### ✅ 第一步:创建conda环境
```shell
conda create -n yolo python==3.8
conda activate yolo # 进入环境
```
### ✅ 第二步:克隆
```shell
git clone https://gitee.com/CV_Lab/streamlit_yolov5_modle2x.git
```
### ✅ 第三步:安装Streamlit YOLOv5 Model2X依赖
```shell
cd streamlit_yolov5_modle2x
pip install -r ./requirements.txt
# 注:requirements.txt中onnxruntime-gpu、tensorflow、nvidia-pyindex和nvidia-tensorrt均需要在GPU模式下安装
```
❗ 注意:yolov5默认采用pip安装PyTorch GPU版,如果采用官网安装**PyTorch GPU**版,参见[YOLOv5 PyTorch GPU安装教程](./yolov5_pytorch_gpu.md)
⚡使用教程
### 💡 多选,多个模型转换和下载
```shell
streamlit run app_04.py # v0.3 推荐(适用于cuda:0)
streamlit run app_03.py # v0.2 推荐(适用于cpu)
streamlit run app_02.py # v0.1
```
### 💡 单选,单个模型转换和下载
```shell
streamlit run app_01.py # v0.1
```
| 编号 | 格式 | 参数 | 模型 | 用途 |
| :--: | :----------------------------------------------------------: | :-----------: | :-----------------------: | :----------: |
| 01 | [PyTorch](https://pytorch.org/) | - | `yolov5s.pt` | - |
| 02 | [TorchScript](https://pytorch.org/docs/stable/jit.html) | `torchscript` | `yolov5s.torchscript` | 移动端 |
| 03 | [ONNX](https://onnx.ai/) | `onnx` | `yolov5s.onnx` | 通用 |
| 04 | [OpenVINO](https://docs.openvino.ai/latest/index.html) | `openvino` | `yolov5s_openvino_model/` | 边缘 云 |
| 05 | [TensorRT](https://developer.nvidia.com/tensorrt) | `engine` | `yolov5s.engine` | 边缘计算 |
| 06 | [CoreML](https://github.com/apple/coremltools) | `coreml` | `yolov5s.mlmodel` | Apple |
| 07 | [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) | `saved_model` | `yolov5s_saved_model/` | 完整的TF模型 |
| 08 | [TensorFlow GraphDef](https://www.tensorflow.org/api_docs/python/tf/Graph) | `pb` | `yolov5s.pb` | 数据流图 |
| 09 | [TensorFlow Lite](https://www.tensorflow.org/lite) | `tflite` | `yolov5s.tflite` | 移动端 |
| 10 | [TensorFlow Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov5s_edgetpu.tflite` | 边缘计算 |
| 11 | [TensorFlow.js](https://www.tensorflow.org/js) | `tfjs` | `yolov5s_web_model/` | web |
| 12 | [PaddlePaddle](https://www.paddlepaddle.org.cn/) | `paddle` | `yolov5s_paddle_model` | |
❗ 注:参考官方文档:https://github.com/ultralytics/yolov5/releases/tag/v6.1
### [❓相关问题解决办法](./QA.md)
❗ 注:在运行程序时可能会遇到的问题与解决办法
### 💬 技术交流
- 如果你发现任何Streamlit YOLOv5 Model2X存在的问题或者是建议, 欢迎通过[Gitee Issues](https://gitee.com/CV_Lab/streamlit_yolov5_modle2x/issues)给我提issues。
- 欢迎加入CV Lab技术交流群