fix: corrige grade de sessões oculta quando status é concluido_rollback

This commit is contained in:
Davi Dias
2026-06-23 20:48:15 -03:00
parent 43079049bd
commit 3f375ec8d5
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -32,9 +32,9 @@ Form-data: `ambiente` (str), `file` (imagem). Confidence threshold: 0.25.
Body JSON: `{ "ambiente": "gondola", "pular_triagem": false }`
1. Lista `treinamento/{ambiente}/novos-treinamentos/` no S3
2. Triagem (salvo `pular_triagem: true`): conf média ≥ 0.30 ou == 0 → `base-oficial`, < 0.30 → `descartados`
2. Triagem (salvo `pular_triagem: true`): conf média ≥ 0.15 ou == 0 → `base-oficial`, < 0.15 → `descartados`
3. Baixa `base-oficial`, redimensiona imagens > 4096px
4. Treina: 30 épocas, imgsz=640, batch=16, device=cpu
4. Treina: 20 épocas fine-tuning / 30 épocas do zero, imgsz=640, batch=8, device=cpu
5. Salva `best.pt` em `modelos/{ambiente}/atual/cerebro.pt` + histórico versionado
## Organização S3
+3 -3
View File
@@ -115,7 +115,7 @@ def _executar_treino_sync(ambiente: str, pular_triagem: bool) -> dict:
pred = modelo_base(img_data, conf=0.1, verbose=False)
confs = [float(b.conf) for r in pred for b in r.boxes]
media = sum(confs)/len(confs) if confs else 0
decisao = "base-oficial" if media >= 0.30 or media == 0 else "descartados"
decisao = "base-oficial" if media >= 0.15 or media == 0 else "descartados"
log_print(f"{os.path.basename(img_key)}: Conf. {media:.2f} -> {decisao}")
for k in [img_key, txt_key]:
try:
@@ -156,9 +156,9 @@ def _executar_treino_sync(ambiente: str, pular_triagem: bool) -> dict:
# Fine-tuning: LR baixo preserva o que o modelo já aprendeu.
# Primeiro treino: LR padrão + mais épocas para convergir do zero.
if is_fine_tuning:
modelo_base.train(data=yaml_path, epochs=20, imgsz=640, batch=16, device='cpu', plots=True, lr0=0.001, lrf=0.01)
modelo_base.train(data=yaml_path, epochs=20, imgsz=640, batch=8, device='cpu', plots=True, lr0=0.001, lrf=0.01)
else:
modelo_base.train(data=yaml_path, epochs=30, imgsz=640, batch=16, device='cpu', plots=True, lr0=0.01, lrf=0.01)
modelo_base.train(data=yaml_path, epochs=30, imgsz=640, batch=8, device='cpu', plots=True, lr0=0.01, lrf=0.01)
modelo_base.reset_callbacks()
best = "runs/detect/train/weights/best.pt"