-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.py
More file actions
41 lines (32 loc) · 1.4 KB
/
run_all.py
File metadata and controls
41 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# run_all.py
"""
Script para executar o workflow completo do captcha_solver, exceto a coleta manual (collector.py).
Etapas:
1. Augmentação dos dados (opcional, se desejar aumentar dataset)
2. Treinamento dos modelos (CNN e CRNN)
3. Avaliação dos modelos
4. Exportação para TFLite
5. Interface gráfica (opcional)
Execute: python run_all.py
"""
import subprocess
import sys
import os
# Caminho base
SRC = os.path.join(os.path.dirname(__file__), 'src')
# 1. Augmentação (opcional, depende de implementação de script de augmentação em lote)
# subprocess.run([sys.executable, os.path.join(SRC, 'augment.py')])
# 2. Treinamento dos modelos
print('Treinando modelo CNN...')
subprocess.run([sys.executable, "-m", "src.train"], check=True, cwd=os.path.dirname(__file__))
print('Treinando modelo CRNN (CTC)...')
subprocess.run([sys.executable, "-m", "src.train_ctc"], check=True, cwd=os.path.dirname(__file__))
# 3. Avaliação dos modelos
print('Avaliando modelo CNN...')
subprocess.run([sys.executable, "-m", "src.evaluate"], check=True, cwd=os.path.dirname(__file__))
# 4. Exportação para TFLite
print('Exportando modelo CNN para TFLite...')
subprocess.run([sys.executable, "-m", "src.export"], check=True, cwd=os.path.dirname(__file__))
print('\nWorkflow finalizado!')
print('Para interface gráfica, execute: python -m src.gui_app')
print('Para predição individual: python -m src.predict caminho/da/imagem.png')