Commit
·
3db91f6
1
Parent(s):
a2b5362
feat: update model paths and dependencies
Browse files- .env.example +3 -3
- .gitignore +152 -0
- README.md +74 -4
- requirements.txt +7 -7
.env.example
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
YOLO_CFG_PATH=
|
| 2 |
-
YOLO_WEIGHTS_PATH=
|
| 3 |
-
YOLO_NAMES_PATH=
|
| 4 |
YOLO_CONF_THRESHOLD=0.5
|
| 5 |
YOLO_NMS_THRESHOLD=0.4
|
| 6 |
YOLO_USE_GPU=false
|
|
|
|
| 1 |
+
YOLO_CFG_PATH=models/yolov3-tiny.cfg
|
| 2 |
+
YOLO_WEIGHTS_PATH=models/yolov3-tiny.weights
|
| 3 |
+
YOLO_NAMES_PATH=models/coco.names
|
| 4 |
YOLO_CONF_THRESHOLD=0.5
|
| 5 |
YOLO_NMS_THRESHOLD=0.4
|
| 6 |
YOLO_USE_GPU=false
|
.gitignore
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
share/python-wheels/
|
| 24 |
+
*.egg-info/
|
| 25 |
+
.installed.cfg
|
| 26 |
+
*.egg
|
| 27 |
+
MANIFEST
|
| 28 |
+
|
| 29 |
+
# PyInstaller
|
| 30 |
+
# Usually these files are written by a python script from a template
|
| 31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 32 |
+
*.manifest
|
| 33 |
+
*.spec
|
| 34 |
+
|
| 35 |
+
# Installer logs
|
| 36 |
+
pip-log.txt
|
| 37 |
+
pip-delete-this-directory.txt
|
| 38 |
+
|
| 39 |
+
# Unit test / coverage reports
|
| 40 |
+
htmlcov/
|
| 41 |
+
.toml
|
| 42 |
+
.cache
|
| 43 |
+
.pytest_cache/
|
| 44 |
+
.hypothesis/
|
| 45 |
+
.noseids
|
| 46 |
+
.coverage
|
| 47 |
+
.coverage.*
|
| 48 |
+
.cache
|
| 49 |
+
nosetests.xml
|
| 50 |
+
coverage.xml
|
| 51 |
+
*.cover
|
| 52 |
+
*.py,cover
|
| 53 |
+
.hypothesis/
|
| 54 |
+
.pytest_cache/
|
| 55 |
+
cover/
|
| 56 |
+
|
| 57 |
+
# Translations
|
| 58 |
+
*.mo
|
| 59 |
+
*.pot
|
| 60 |
+
|
| 61 |
+
# Django stuff:
|
| 62 |
+
*.log
|
| 63 |
+
local_settings.py
|
| 64 |
+
db.sqlite3
|
| 65 |
+
db.sqlite3-journal
|
| 66 |
+
|
| 67 |
+
# Flask stuff:
|
| 68 |
+
instance/
|
| 69 |
+
.webassets-cache
|
| 70 |
+
|
| 71 |
+
# Scrapy stuff:
|
| 72 |
+
.scrapy
|
| 73 |
+
|
| 74 |
+
# Sphinx documentation
|
| 75 |
+
docs/_build/
|
| 76 |
+
|
| 77 |
+
# PyBuilder
|
| 78 |
+
.pybuilder/
|
| 79 |
+
target/
|
| 80 |
+
|
| 81 |
+
# Jupyter Notebook
|
| 82 |
+
.ipynb_checkpoints
|
| 83 |
+
|
| 84 |
+
# IPython
|
| 85 |
+
profile_default/
|
| 86 |
+
ipython_config.py
|
| 87 |
+
|
| 88 |
+
# pyenv
|
| 89 |
+
# For a library or package, you might want to ignore these files since the Python version is individual.
|
| 90 |
+
# .python-version
|
| 91 |
+
|
| 92 |
+
# pipenv
|
| 93 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 94 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 95 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or even
|
| 96 |
+
# fail to install them.
|
| 97 |
+
# Pipfile.lock
|
| 98 |
+
|
| 99 |
+
# poetry
|
| 100 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 101 |
+
# poetry.lock
|
| 102 |
+
|
| 103 |
+
# pdm
|
| 104 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 105 |
+
# pdm.lock
|
| 106 |
+
|
| 107 |
+
# PEP 582; used by e.g. github.com/pdm-project/pdm
|
| 108 |
+
__pypackages__/
|
| 109 |
+
|
| 110 |
+
# Celery stuff
|
| 111 |
+
celerybeat-schedule
|
| 112 |
+
celerybeat.pid
|
| 113 |
+
|
| 114 |
+
# SageMath parsed files
|
| 115 |
+
*.sage.py
|
| 116 |
+
|
| 117 |
+
# Environments
|
| 118 |
+
.env
|
| 119 |
+
.venv
|
| 120 |
+
env/
|
| 121 |
+
venv/
|
| 122 |
+
ENV/
|
| 123 |
+
env.bak/
|
| 124 |
+
venv.bak/
|
| 125 |
+
|
| 126 |
+
# Spyder project settings
|
| 127 |
+
.spyderproject
|
| 128 |
+
.spyproject
|
| 129 |
+
|
| 130 |
+
# Rope project settings
|
| 131 |
+
.ropeproject
|
| 132 |
+
|
| 133 |
+
# mkdocs documentation
|
| 134 |
+
/site
|
| 135 |
+
|
| 136 |
+
# mypy
|
| 137 |
+
.mypy_cache/
|
| 138 |
+
.dmypy.json
|
| 139 |
+
dmypy.json
|
| 140 |
+
|
| 141 |
+
# Pyre type checker
|
| 142 |
+
.pyre/
|
| 143 |
+
|
| 144 |
+
# pytype static type analyzer
|
| 145 |
+
.pytype/
|
| 146 |
+
|
| 147 |
+
# Cython debug symbols
|
| 148 |
+
cython_debug/
|
| 149 |
+
|
| 150 |
+
# OS
|
| 151 |
+
.DS_Store
|
| 152 |
+
Thumbs.db
|
README.md
CHANGED
|
@@ -12,9 +12,79 @@ short_description: Streamlit template space
|
|
| 12 |
license: mit
|
| 13 |
---
|
| 14 |
|
| 15 |
-
#
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
| 20 |
-
forums](https://discuss.streamlit.io).
|
|
|
|
| 12 |
license: mit
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# YOLO Detection & Transfer Learning
|
| 16 |
|
| 17 |
+
Este projeto é uma aplicação Streamlit para detecção de objetos utilizando o modelo YOLOv3-Tiny com OpenCV DNN. O projeto está configurado para ser executado localmente ou no Hugging Face Spaces via Docker.
|
| 18 |
+
|
| 19 |
+
## 🚀 Funcionalidades
|
| 20 |
+
|
| 21 |
+
- Detecção de objetos em tempo real em imagens carregadas.
|
| 22 |
+
- Suporte a 80 classes do dataset COCO.
|
| 23 |
+
- Interface amigável com Streamlit.
|
| 24 |
+
- Configuração via variáveis de ambiente.
|
| 25 |
+
- Suporte a Git LFS para arquivos de pesos do modelo.
|
| 26 |
+
|
| 27 |
+
## 🛠️ Instalação
|
| 28 |
+
|
| 29 |
+
### Pré-requisitos
|
| 30 |
+
|
| 31 |
+
- Python 3.9+
|
| 32 |
+
- Git LFS
|
| 33 |
+
|
| 34 |
+
### Passo a Passo
|
| 35 |
+
|
| 36 |
+
1. **Clone o repositório:**
|
| 37 |
+
```bash
|
| 38 |
+
git clone https://huggingface.co/spaces/PedroM2626/YOLO-Detection-Transfer_Learning
|
| 39 |
+
cd YOLO-Detection-Transfer_Learning
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
2. **Instale o Git LFS e puxe os arquivos grandes:**
|
| 43 |
+
```bash
|
| 44 |
+
git lfs install
|
| 45 |
+
git lfs pull
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
3. **Crie um ambiente virtual e instale as dependências:**
|
| 49 |
+
```bash
|
| 50 |
+
python -m venv venv
|
| 51 |
+
source venv/bin/activate # No Windows: venv\Scripts\activate
|
| 52 |
+
pip install -r requirements.txt
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
4. **Configure as variáveis de ambiente:**
|
| 56 |
+
Copie o arquivo `.env.example` para `.env` e ajuste se necessário.
|
| 57 |
+
```bash
|
| 58 |
+
cp .env.example .env
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## 💻 Uso
|
| 62 |
+
|
| 63 |
+
Para rodar a aplicação localmente:
|
| 64 |
+
```bash
|
| 65 |
+
streamlit run streamlit_app.py
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## 🧪 Testes
|
| 69 |
+
|
| 70 |
+
O projeto inclui testes unitários, de integração e de aceitação.
|
| 71 |
+
|
| 72 |
+
Para executar os testes:
|
| 73 |
+
```bash
|
| 74 |
+
pytest
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## 📁 Estrutura do Projeto
|
| 78 |
+
|
| 79 |
+
- `models/`: Contém os arquivos de configuração, pesos e nomes das classes do YOLO.
|
| 80 |
+
- `tests/`: Testes automatizados.
|
| 81 |
+
- `streamlit_app.py`: Interface principal da aplicação.
|
| 82 |
+
- `yolo_inference.py`: Lógica de inferência do modelo.
|
| 83 |
+
- `Dockerfile`: Configuração para deploy no Hugging Face Spaces.
|
| 84 |
+
- `.env.example`: Modelo de variáveis de ambiente.
|
| 85 |
+
- `.gitattributes`: Configuração do Git LFS.
|
| 86 |
+
|
| 87 |
+
## 📄 Licença
|
| 88 |
+
|
| 89 |
+
Este projeto está sob a licença MIT. Veja o arquivo [LICENSE](LICENSE) para mais detalhes.
|
| 90 |
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
opencv-python>=4.
|
| 2 |
-
numpy>=1.
|
| 3 |
python-dotenv>=1.0.0
|
| 4 |
jupyter>=1.0.0
|
| 5 |
ipywidgets>=8.0.0
|
| 6 |
matplotlib>=3.7.0
|
| 7 |
pytest>=7.0.0
|
| 8 |
-
ultralytics>=8.
|
| 9 |
-
PyYAML>=6.0.
|
| 10 |
-
requests>=2.
|
| 11 |
tqdm>=4.66.0
|
| 12 |
-
streamlit>=1.
|
| 13 |
-
pillow>=10.
|
|
|
|
| 1 |
+
opencv-python>=4.10.0
|
| 2 |
+
numpy>=2.1.0
|
| 3 |
python-dotenv>=1.0.0
|
| 4 |
jupyter>=1.0.0
|
| 5 |
ipywidgets>=8.0.0
|
| 6 |
matplotlib>=3.7.0
|
| 7 |
pytest>=7.0.0
|
| 8 |
+
ultralytics>=8.2.0
|
| 9 |
+
PyYAML>=6.0.1
|
| 10 |
+
requests>=2.32.0
|
| 11 |
tqdm>=4.66.0
|
| 12 |
+
streamlit>=1.35.0
|
| 13 |
+
pillow>=10.3.0
|