basilshaji
commited on
Delete YOLOv5-Streamlit-Deployment
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- YOLOv5-Streamlit-Deployment/.gitignore +0 -255
- YOLOv5-Streamlit-Deployment/.pre-commit-config.yaml +0 -67
- YOLOv5-Streamlit-Deployment/LICENSE +0 -21
- YOLOv5-Streamlit-Deployment/README.md +0 -74
- YOLOv5-Streamlit-Deployment/app.py +0 -182
- YOLOv5-Streamlit-Deployment/data/.DS_Store +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/.DS_Store +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/.gitignore +0 -1
- YOLOv5-Streamlit-Deployment/data/example_images/example_1.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_10.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_11.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_12.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_13.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_14.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_15.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_16.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_17.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_18.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_19.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_2.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_20.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_21.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_22.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_23.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_24.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_25.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_26.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_27.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_28.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_29.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_3.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_30.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_31.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_32.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_33.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_34.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_35.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_36.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_37.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_38.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_39.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_4.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_5.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_6.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_7.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_8.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_images/example_9.jpg +0 -0
- YOLOv5-Streamlit-Deployment/data/example_videos/.DS_Store +0 -0
- YOLOv5-Streamlit-Deployment/data/example_videos/.gitignore +0 -1
- YOLOv5-Streamlit-Deployment/data/images/1027_png.rf.cda5c3b663ae9d3ffd8c0afdbfb5e9fc.jpg +0 -0
YOLOv5-Streamlit-Deployment/.gitignore
DELETED
@@ -1,255 +0,0 @@
|
|
1 |
-
# Repo-specific GitIgnore ----------------------------------------------------------------------------------------------
|
2 |
-
*.jpg
|
3 |
-
*.jpeg
|
4 |
-
*.png
|
5 |
-
*.bmp
|
6 |
-
*.tif
|
7 |
-
*.tiff
|
8 |
-
*.heic
|
9 |
-
*.JPG
|
10 |
-
*.JPEG
|
11 |
-
*.PNG
|
12 |
-
*.BMP
|
13 |
-
*.TIF
|
14 |
-
*.TIFF
|
15 |
-
*.HEIC
|
16 |
-
*.mp4
|
17 |
-
*.mov
|
18 |
-
*.MOV
|
19 |
-
*.avi
|
20 |
-
*.data
|
21 |
-
*.json
|
22 |
-
*.cfg
|
23 |
-
!setup.cfg
|
24 |
-
!cfg/yolov3*.cfg
|
25 |
-
|
26 |
-
storage.googleapis.com
|
27 |
-
runs/*
|
28 |
-
|
29 |
-
|
30 |
-
!data/*.yaml
|
31 |
-
!data/hyps
|
32 |
-
!data/scripts
|
33 |
-
|
34 |
-
!data/*.sh
|
35 |
-
|
36 |
-
results*.csv
|
37 |
-
|
38 |
-
# Datasets -------------------------------------------------------------------------------------------------------------
|
39 |
-
coco/
|
40 |
-
coco128/
|
41 |
-
VOC/
|
42 |
-
|
43 |
-
# MATLAB GitIgnore -----------------------------------------------------------------------------------------------------
|
44 |
-
*.m~
|
45 |
-
*.mat
|
46 |
-
!targets*.mat
|
47 |
-
|
48 |
-
# Neural Network weights -----------------------------------------------------------------------------------------------
|
49 |
-
*.weights
|
50 |
-
*.pt
|
51 |
-
*.pb
|
52 |
-
*.onnx
|
53 |
-
*.engine
|
54 |
-
*.mlmodel
|
55 |
-
*.torchscript
|
56 |
-
*.tflite
|
57 |
-
*.h5
|
58 |
-
*_saved_model/
|
59 |
-
*_web_model/
|
60 |
-
*_openvino_model/
|
61 |
-
darknet53.conv.74
|
62 |
-
yolov3-tiny.conv.15
|
63 |
-
|
64 |
-
# GitHub Python GitIgnore ----------------------------------------------------------------------------------------------
|
65 |
-
# Byte-compiled / optimized / DLL files
|
66 |
-
__pycache__/
|
67 |
-
*.py[cod]
|
68 |
-
*$py.class
|
69 |
-
|
70 |
-
# C extensions
|
71 |
-
*.so
|
72 |
-
|
73 |
-
# Distribution / packaging
|
74 |
-
.Python
|
75 |
-
env/
|
76 |
-
build/
|
77 |
-
develop-eggs/
|
78 |
-
dist/
|
79 |
-
downloads/
|
80 |
-
eggs/
|
81 |
-
.eggs/
|
82 |
-
lib/
|
83 |
-
lib64/
|
84 |
-
parts/
|
85 |
-
sdist/
|
86 |
-
var/
|
87 |
-
wheels/
|
88 |
-
*.egg-info/
|
89 |
-
/wandb/
|
90 |
-
.installed.cfg
|
91 |
-
*.egg
|
92 |
-
|
93 |
-
|
94 |
-
# PyInstaller
|
95 |
-
# Usually these files are written by a python script from a template
|
96 |
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
97 |
-
*.manifest
|
98 |
-
*.spec
|
99 |
-
|
100 |
-
# Installer logs
|
101 |
-
pip-log.txt
|
102 |
-
pip-delete-this-directory.txt
|
103 |
-
|
104 |
-
# Unit test / coverage reports
|
105 |
-
htmlcov/
|
106 |
-
.tox/
|
107 |
-
.coverage
|
108 |
-
.coverage.*
|
109 |
-
.cache
|
110 |
-
nosetests.xml
|
111 |
-
coverage.xml
|
112 |
-
*.cover
|
113 |
-
.hypothesis/
|
114 |
-
|
115 |
-
# Translations
|
116 |
-
*.mo
|
117 |
-
*.pot
|
118 |
-
|
119 |
-
# Django stuff:
|
120 |
-
*.log
|
121 |
-
local_settings.py
|
122 |
-
|
123 |
-
# Flask stuff:
|
124 |
-
instance/
|
125 |
-
.webassets-cache
|
126 |
-
|
127 |
-
# Scrapy stuff:
|
128 |
-
.scrapy
|
129 |
-
|
130 |
-
# Sphinx documentation
|
131 |
-
docs/_build/
|
132 |
-
|
133 |
-
# PyBuilder
|
134 |
-
target/
|
135 |
-
|
136 |
-
# Jupyter Notebook
|
137 |
-
.ipynb_checkpoints
|
138 |
-
|
139 |
-
# pyenv
|
140 |
-
.python-version
|
141 |
-
|
142 |
-
# celery beat schedule file
|
143 |
-
celerybeat-schedule
|
144 |
-
|
145 |
-
# SageMath parsed files
|
146 |
-
*.sage.py
|
147 |
-
|
148 |
-
# dotenv
|
149 |
-
.env
|
150 |
-
|
151 |
-
# virtualenv
|
152 |
-
.venv*
|
153 |
-
venv*/
|
154 |
-
ENV*/
|
155 |
-
|
156 |
-
# Spyder project settings
|
157 |
-
.spyderproject
|
158 |
-
.spyproject
|
159 |
-
|
160 |
-
# Rope project settings
|
161 |
-
.ropeproject
|
162 |
-
|
163 |
-
# mkdocs documentation
|
164 |
-
/site
|
165 |
-
|
166 |
-
# mypy
|
167 |
-
.mypy_cache/
|
168 |
-
|
169 |
-
|
170 |
-
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -----------------------------------------------
|
171 |
-
|
172 |
-
# General
|
173 |
-
*/.DS_Store
|
174 |
-
.DS_Store
|
175 |
-
.AppleDouble
|
176 |
-
.LSOverride
|
177 |
-
|
178 |
-
# Icon must end with two \r
|
179 |
-
Icon
|
180 |
-
Icon?
|
181 |
-
|
182 |
-
# Thumbnails
|
183 |
-
._*
|
184 |
-
|
185 |
-
# Files that might appear in the root of a volume
|
186 |
-
.DocumentRevisions-V100
|
187 |
-
.fseventsd
|
188 |
-
.Spotlight-V100
|
189 |
-
.TemporaryItems
|
190 |
-
.Trashes
|
191 |
-
.VolumeIcon.icns
|
192 |
-
.com.apple.timemachine.donotpresent
|
193 |
-
|
194 |
-
# Directories potentially created on remote AFP share
|
195 |
-
.AppleDB
|
196 |
-
.AppleDesktop
|
197 |
-
Network Trash Folder
|
198 |
-
Temporary Items
|
199 |
-
.apdisk
|
200 |
-
|
201 |
-
|
202 |
-
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
|
203 |
-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
204 |
-
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
205 |
-
|
206 |
-
# User-specific stuff:
|
207 |
-
.idea/*
|
208 |
-
.idea/**/workspace.xml
|
209 |
-
.idea/**/tasks.xml
|
210 |
-
.idea/dictionaries
|
211 |
-
.html # Bokeh Plots
|
212 |
-
.pg # TensorFlow Frozen Graphs
|
213 |
-
.avi # videos
|
214 |
-
|
215 |
-
# Sensitive or high-churn files:
|
216 |
-
.idea/**/dataSources/
|
217 |
-
.idea/**/dataSources.ids
|
218 |
-
.idea/**/dataSources.local.xml
|
219 |
-
.idea/**/sqlDataSources.xml
|
220 |
-
.idea/**/dynamic.xml
|
221 |
-
.idea/**/uiDesigner.xml
|
222 |
-
|
223 |
-
# Gradle:
|
224 |
-
.idea/**/gradle.xml
|
225 |
-
.idea/**/libraries
|
226 |
-
|
227 |
-
# CMake
|
228 |
-
cmake-build-debug/
|
229 |
-
cmake-build-release/
|
230 |
-
|
231 |
-
# Mongo Explorer plugin:
|
232 |
-
.idea/**/mongoSettings.xml
|
233 |
-
|
234 |
-
## File-based project format:
|
235 |
-
*.iws
|
236 |
-
|
237 |
-
## Plugin-specific files:
|
238 |
-
|
239 |
-
# IntelliJ
|
240 |
-
out/
|
241 |
-
|
242 |
-
# mpeltonen/sbt-idea plugin
|
243 |
-
.idea_modules/
|
244 |
-
|
245 |
-
# JIRA plugin
|
246 |
-
atlassian-ide-plugin.xml
|
247 |
-
|
248 |
-
# Cursive Clojure plugin
|
249 |
-
.idea/replstate.xml
|
250 |
-
|
251 |
-
# Crashlytics plugin (for Android Studio and IntelliJ)
|
252 |
-
com_crashlytics_export_strings.xml
|
253 |
-
crashlytics.properties
|
254 |
-
crashlytics-build.properties
|
255 |
-
fabric.properties
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YOLOv5-Streamlit-Deployment/.pre-commit-config.yaml
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
# Define hooks for code formations
|
2 |
-
# Will be applied on any updated commit files if a user has installed and linked commit hook
|
3 |
-
|
4 |
-
default_language_version:
|
5 |
-
python: python3.8
|
6 |
-
|
7 |
-
# Define bot property if installed via https://github.com/marketplace/pre-commit-ci
|
8 |
-
ci:
|
9 |
-
autofix_prs: true
|
10 |
-
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
|
11 |
-
autoupdate_schedule: monthly
|
12 |
-
# submodules: true
|
13 |
-
|
14 |
-
repos:
|
15 |
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
16 |
-
rev: v4.2.0
|
17 |
-
hooks:
|
18 |
-
- id: end-of-file-fixer
|
19 |
-
- id: trailing-whitespace
|
20 |
-
- id: check-case-conflict
|
21 |
-
- id: check-yaml
|
22 |
-
- id: check-toml
|
23 |
-
- id: pretty-format-json
|
24 |
-
- id: check-docstring-first
|
25 |
-
|
26 |
-
- repo: https://github.com/asottile/pyupgrade
|
27 |
-
rev: v2.32.1
|
28 |
-
hooks:
|
29 |
-
- id: pyupgrade
|
30 |
-
name: Upgrade code
|
31 |
-
args: [ --py37-plus ]
|
32 |
-
|
33 |
-
- repo: https://github.com/PyCQA/isort
|
34 |
-
rev: 5.10.1
|
35 |
-
hooks:
|
36 |
-
- id: isort
|
37 |
-
name: Sort imports
|
38 |
-
|
39 |
-
- repo: https://github.com/pre-commit/mirrors-yapf
|
40 |
-
rev: v0.32.0
|
41 |
-
hooks:
|
42 |
-
- id: yapf
|
43 |
-
name: YAPF formatting
|
44 |
-
|
45 |
-
- repo: https://github.com/executablebooks/mdformat
|
46 |
-
rev: 0.7.14
|
47 |
-
hooks:
|
48 |
-
- id: mdformat
|
49 |
-
name: MD formatting
|
50 |
-
additional_dependencies:
|
51 |
-
- mdformat-gfm
|
52 |
-
- mdformat-black
|
53 |
-
exclude: |
|
54 |
-
(?x)^(
|
55 |
-
README.md
|
56 |
-
)$
|
57 |
-
|
58 |
-
- repo: https://github.com/asottile/yesqa
|
59 |
-
rev: v1.3.0
|
60 |
-
hooks:
|
61 |
-
- id: yesqa
|
62 |
-
|
63 |
-
- repo: https://github.com/PyCQA/flake8
|
64 |
-
rev: 4.0.1
|
65 |
-
hooks:
|
66 |
-
- id: flake8
|
67 |
-
name: PEP8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YOLOv5-Streamlit-Deployment/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
MIT License
|
2 |
-
|
3 |
-
Copyright (c) 2022 Thepbordin Jaiinsom
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in all
|
13 |
-
copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YOLOv5-Streamlit-Deployment/README.md
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
|
2 |
-
# 🚀 YOLOv5 Streamlit Deployment
|
3 |
-
[![HitCount](https://hits.dwyl.com/thepbordin/YOLOv5-Streamlit-Deployment.svg?style=flat&show=unique)](http://hits.dwyl.com/thepbordin/YOLOv5-Streamlit-Deployment)
|
4 |
-
|
5 |
-
|
6 |
-
A Easy way to deploy [YOLOv5](https://github.com/ultralytics/yolov5) object detection model with [Streamlit](https://streamlit.io/).
|
7 |
-
|
8 |
-
**Please feel free to use/edit.**
|
9 |
-
|
10 |
-
|
11 |
-
code modified by GitHub/thepbordin from GitHub/zhoroh
|
12 |
-
|
13 |
-
## ✨ Features
|
14 |
-
|
15 |
-
- YOLO Weights Source
|
16 |
-
- Load from Local
|
17 |
-
- Download Weights from URL
|
18 |
-
- Example Dataset
|
19 |
-
- Videos
|
20 |
-
- Images
|
21 |
-
- Upload Data
|
22 |
-
- Video
|
23 |
-
- Image
|
24 |
-
- Select computing device (cuda/cpu)
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
## ⚙️ Installation
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
### Local Use
|
33 |
-
1. Install Requirements
|
34 |
-
`pip install -r requirements.txt`
|
35 |
-
2. Install ffmpeg (for video inferencing)
|
36 |
-
- For Windows [read here](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/)
|
37 |
-
- For Mac (brew)
|
38 |
-
`brew install ffmpeg`
|
39 |
-
3. Strart Stremlit
|
40 |
-
```
|
41 |
-
cd YOLOv5-Streamlit-Deployment
|
42 |
-
streamlit run app.py
|
43 |
-
```
|
44 |
-
### Streamlit Cloud
|
45 |
-
1. Edit a configuration in app.py (read ⚙️ Config Instruction)
|
46 |
-
2. (Optional) Upload example datas in
|
47 |
-
- `example_images`
|
48 |
-
- `example_videos`
|
49 |
-
4. Deploy on [Streamlit](https://share.streamlit.io/deploy)
|
50 |
-
|
51 |
-
|
52 |
-
## ⚙️ Config Instruction
|
53 |
-
### Download model from URL
|
54 |
-
|
55 |
-
1. Upload model to [Internet Archive](https://archive.org/)
|
56 |
-
2. Go to your uploaded file page.
|
57 |
-
3. From `DOWNLOAD OPTIONS` select `SHOW ALL`
|
58 |
-
4. Right click at <yourmodelname>.pt and Copy link address.
|
59 |
-
5. Edit config in [app.py](https://github.com/thepbordin/YOLOv5-Streamlit-Deployment/blob/main/app.py)
|
60 |
-
|
61 |
-
```python
|
62 |
-
cfg_enable_url_download = True
|
63 |
-
url = "your_model_url"
|
64 |
-
```
|
65 |
-
|
66 |
-
### Use local .pt file:
|
67 |
-
Edit config in [app.py](https://github.com/thepbordin/YOLOv5-Streamlit-Deployment/blob/main/app.py)
|
68 |
-
```python
|
69 |
-
## CFG
|
70 |
-
cfg_model_path = "models/your_model_name.pt"
|
71 |
-
```
|
72 |
-
|
73 |
-
## Reference
|
74 |
-
[Yolov5 Real-time Inference using Streamlit](https://github.com/moaaztaha/Yolo-Interface-using-Streamlit)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YOLOv5-Streamlit-Deployment/app.py
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import torch
|
3 |
-
from PIL import Image
|
4 |
-
from io import *
|
5 |
-
import glob
|
6 |
-
from datetime import datetime
|
7 |
-
import os
|
8 |
-
import wget
|
9 |
-
from video_predict import runVideo
|
10 |
-
|
11 |
-
|
12 |
-
# Configurations
|
13 |
-
CFG_MODEL_PATH = "models/yourModel.pt"
|
14 |
-
CFG_ENABLE_URL_DOWNLOAD = True
|
15 |
-
CFG_ENABLE_VIDEO_PREDICTION = True
|
16 |
-
if CFG_ENABLE_URL_DOWNLOAD:
|
17 |
-
# Configure this if you set cfg_enable_url_download to True
|
18 |
-
url = "https://archive.org/download/yoloTrained/yoloTrained.pt"
|
19 |
-
# End of Configurations
|
20 |
-
|
21 |
-
|
22 |
-
def imageInput(model, src):
|
23 |
-
|
24 |
-
if src == 'Upload your own data.':
|
25 |
-
image_file = st.file_uploader(
|
26 |
-
"Upload An Image", type=['png', 'jpeg', 'jpg'])
|
27 |
-
col1, col2 = st.columns(2)
|
28 |
-
if image_file is not None:
|
29 |
-
img = Image.open(image_file)
|
30 |
-
with col1:
|
31 |
-
st.image(img, caption='Uploaded Image',
|
32 |
-
use_column_width='always')
|
33 |
-
ts = datetime.timestamp(datetime.now())
|
34 |
-
imgpath = os.path.join('data/uploads', str(ts)+image_file.name)
|
35 |
-
outputpath = os.path.join(
|
36 |
-
'data/outputs', os.path.basename(imgpath))
|
37 |
-
with open(imgpath, mode="wb") as f:
|
38 |
-
f.write(image_file.getbuffer())
|
39 |
-
|
40 |
-
with st.spinner(text="Predicting..."):
|
41 |
-
# Load model
|
42 |
-
pred = model(imgpath)
|
43 |
-
pred.render()
|
44 |
-
# save output to file
|
45 |
-
for im in pred.ims:
|
46 |
-
im_base64 = Image.fromarray(im)
|
47 |
-
im_base64.save(outputpath)
|
48 |
-
|
49 |
-
# Predictions
|
50 |
-
img_ = Image.open(outputpath)
|
51 |
-
with col2:
|
52 |
-
st.image(img_, caption='Model Prediction(s)',
|
53 |
-
use_column_width='always')
|
54 |
-
|
55 |
-
elif src == 'From example data.':
|
56 |
-
# Image selector slider
|
57 |
-
imgpaths = glob.glob('data/example_images/*')
|
58 |
-
if len(imgpaths) == 0:
|
59 |
-
st.write(".")
|
60 |
-
st.error(
|
61 |
-
'No images found, Please upload example images in data/example_images', icon="")
|
62 |
-
return
|
63 |
-
imgsel = st.slider('Select random images from example data.',
|
64 |
-
min_value=1, max_value=len(imgpaths), step=1)
|
65 |
-
image_file = imgpaths[imgsel-1]
|
66 |
-
submit = st.button("Predict!")
|
67 |
-
col1, col2 = st.columns(2)
|
68 |
-
with col1:
|
69 |
-
img = Image.open(image_file)
|
70 |
-
st.image(img, caption='Selected Image', use_column_width='always')
|
71 |
-
with col2:
|
72 |
-
if image_file is not None and submit:
|
73 |
-
with st.spinner(text="Predicting..."):
|
74 |
-
# Load model
|
75 |
-
|
76 |
-
pred = model(image_file)
|
77 |
-
pred.render()
|
78 |
-
# save output to file
|
79 |
-
for im in pred.ims:
|
80 |
-
im_base64 = Image.fromarray(im)
|
81 |
-
im_base64.save(os.path.join(
|
82 |
-
'data/outputs', os.path.basename(image_file)))
|
83 |
-
# Display predicton
|
84 |
-
img_ = Image.open(os.path.join(
|
85 |
-
'data/outputs', os.path.basename(image_file)))
|
86 |
-
st.image(img_, caption='Model Prediction(s)')
|
87 |
-
|
88 |
-
|
89 |
-
def videoInput(model, src):
|
90 |
-
if src == 'Upload your own data.':
|
91 |
-
uploaded_video = st.file_uploader(
|
92 |
-
"Upload A Video", type=['mp4', 'mpeg', 'mov'])
|
93 |
-
pred_view = st.empty()
|
94 |
-
warning = st.empty()
|
95 |
-
if uploaded_video != None:
|
96 |
-
|
97 |
-
# Save video to disk
|
98 |
-
ts = datetime.timestamp(datetime.now()) # timestamp a upload
|
99 |
-
uploaded_video_path = os.path.join(
|
100 |
-
'data/uploads', str(ts)+uploaded_video.name)
|
101 |
-
with open(uploaded_video_path, mode='wb') as f:
|
102 |
-
f.write(uploaded_video.read())
|
103 |
-
|
104 |
-
# Display uploaded video
|
105 |
-
with open(uploaded_video_path, 'rb') as f:
|
106 |
-
video_bytes = f.read()
|
107 |
-
st.video(video_bytes)
|
108 |
-
st.write("Uploaded Video")
|
109 |
-
submit = st.button("Run Prediction")
|
110 |
-
if submit:
|
111 |
-
runVideo(model, uploaded_video_path, pred_view, warning)
|
112 |
-
|
113 |
-
elif src == 'From example data.':
|
114 |
-
# Image selector slider
|
115 |
-
videopaths = glob.glob('data/example_videos/*')
|
116 |
-
if len(videopaths) == 0:
|
117 |
-
st.error(
|
118 |
-
'No videos found, Please upload example videos in data/example_videos', icon="⚠️")
|
119 |
-
return
|
120 |
-
imgsel = st.slider('Select random video from example data.',
|
121 |
-
min_value=1, max_value=len(videopaths), step=1)
|
122 |
-
pred_view = st.empty()
|
123 |
-
video = videopaths[imgsel-1]
|
124 |
-
submit = st.button("Predict!")
|
125 |
-
if submit:
|
126 |
-
runVideo(model, video, pred_view, warning)
|
127 |
-
|
128 |
-
|
129 |
-
def main():
|
130 |
-
if CFG_ENABLE_URL_DOWNLOAD:
|
131 |
-
downloadModel()
|
132 |
-
|
133 |
-
else:
|
134 |
-
if not os.path.exists(CFG_MODEL_PATH):
|
135 |
-
st.error(
|
136 |
-
'Model not found, please config if you wish to download model from url set `cfg_enable_url_download = True` ', icon="⚠️")
|
137 |
-
|
138 |
-
# -- Sidebar
|
139 |
-
st.sidebar.title('⚙️ Options')
|
140 |
-
datasrc = st.sidebar.radio("Select input source.", [
|
141 |
-
'From example data.', 'Upload your own data.'])
|
142 |
-
|
143 |
-
if CFG_ENABLE_VIDEO_PREDICTION:
|
144 |
-
option = st.sidebar.radio("Select input type.", ['Image', 'Video'])
|
145 |
-
else:
|
146 |
-
option = st.sidebar.radio("Select input type.", ['Image'])
|
147 |
-
if torch.cuda.is_available():
|
148 |
-
deviceoption = st.sidebar.radio("Select compute Device.", [
|
149 |
-
'cpu', 'cuda'], disabled=False, index=1)
|
150 |
-
else:
|
151 |
-
deviceoption = st.sidebar.radio("Select compute Device.", [
|
152 |
-
'cpu', 'cuda'], disabled=True, index=0)
|
153 |
-
# -- End of Sidebar
|
154 |
-
|
155 |
-
st.header('📦 YOLOv5 Streamlit Deployment Example')
|
156 |
-
st.sidebar.markdown(
|
157 |
-
"https://github.com/thepbordin/Obstacle-Detection-for-Blind-people-Deployment")
|
158 |
-
|
159 |
-
if option == "Image":
|
160 |
-
imageInput(loadmodel(deviceoption), datasrc)
|
161 |
-
elif option == "Video":
|
162 |
-
videoInput(loadmodel(deviceoption), datasrc)
|
163 |
-
|
164 |
-
|
165 |
-
# Downlaod Model from url.
|
166 |
-
@st.cache_resource
|
167 |
-
def downloadModel():
|
168 |
-
if not os.path.exists(CFG_MODEL_PATH):
|
169 |
-
wget.download(url, out="models/")
|
170 |
-
|
171 |
-
|
172 |
-
@st.cache_resource
|
173 |
-
def loadmodel(device):
|
174 |
-
if CFG_ENABLE_URL_DOWNLOAD:
|
175 |
-
CFG_MODEL_PATH = f"models/{url.split('/')[-1:][0]}"
|
176 |
-
model = torch.hub.load('ultralytics/yolov5', 'custom',
|
177 |
-
path=CFG_MODEL_PATH, force_reload=True, device=device)
|
178 |
-
return model
|
179 |
-
|
180 |
-
|
181 |
-
if __name__ == '__main__':
|
182 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YOLOv5-Streamlit-Deployment/data/.DS_Store
DELETED
Binary file (10.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/.DS_Store
DELETED
Binary file (10.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!*
|
|
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_1.jpg
DELETED
Binary file (20.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_10.jpg
DELETED
Binary file (19.9 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_11.jpg
DELETED
Binary file (18.9 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_12.jpg
DELETED
Binary file (20 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_13.jpg
DELETED
Binary file (16.8 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_14.jpg
DELETED
Binary file (18.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_15.jpg
DELETED
Binary file (16.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_16.jpg
DELETED
Binary file (28.3 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_17.jpg
DELETED
Binary file (22.4 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_18.jpg
DELETED
Binary file (25.4 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_19.jpg
DELETED
Binary file (21.9 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_2.jpg
DELETED
Binary file (30.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_20.jpg
DELETED
Binary file (27.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_21.jpg
DELETED
Binary file (24.4 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_22.jpg
DELETED
Binary file (26.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_23.jpg
DELETED
Binary file (31.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_24.jpg
DELETED
Binary file (22.6 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_25.jpg
DELETED
Binary file (22.5 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_26.jpg
DELETED
Binary file (15.8 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_27.jpg
DELETED
Binary file (24.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_28.jpg
DELETED
Binary file (17.5 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_29.jpg
DELETED
Binary file (21.2 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_3.jpg
DELETED
Binary file (31.7 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_30.jpg
DELETED
Binary file (22.3 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_31.jpg
DELETED
Binary file (24 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_32.jpg
DELETED
Binary file (24.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_33.jpg
DELETED
Binary file (29 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_34.jpg
DELETED
Binary file (28.7 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_35.jpg
DELETED
Binary file (21.8 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_36.jpg
DELETED
Binary file (27.3 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_37.jpg
DELETED
Binary file (24.9 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_38.jpg
DELETED
Binary file (21.7 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_39.jpg
DELETED
Binary file (23.4 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_4.jpg
DELETED
Binary file (21.9 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_5.jpg
DELETED
Binary file (24.5 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_6.jpg
DELETED
Binary file (16.4 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_7.jpg
DELETED
Binary file (28.1 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_8.jpg
DELETED
Binary file (26.5 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_images/example_9.jpg
DELETED
Binary file (23.3 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_videos/.DS_Store
DELETED
Binary file (6.15 kB)
|
|
YOLOv5-Streamlit-Deployment/data/example_videos/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!*
|
|
|
|
YOLOv5-Streamlit-Deployment/data/images/1027_png.rf.cda5c3b663ae9d3ffd8c0afdbfb5e9fc.jpg
DELETED
Binary file (20 kB)
|
|