matheeusper commited on
Commit
f288ae6
·
verified ·
1 Parent(s): e364c05

Publica checkpoint RF-DETR de capacetes

Browse files

Adiciona o checkpoint treinado, model card, métricas, checksum e configuração de treinamento do projeto GitHub matheeusper/epi-with-keypoints.

README.md CHANGED
@@ -1,3 +1,100 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: agpl-3.0
3
+ library_name: rfdetr
4
+ pipeline_tag: object-detection
5
+ tags:
6
+ - computer-vision
7
+ - object-detection
8
+ - construction-safety
9
+ - ppe
10
+ - helmet-detection
11
+ - rf-detr
12
+ datasets:
13
+ - Ultralytics/Construction-PPE
14
  ---
15
+
16
+ # RF-DETR Small — detecção de capacetes em obras
17
+
18
+ Checkpoint do `RFDETRSmall` treinado para detectar exclusivamente a classe positiva
19
+ `helmet` em imagens de canteiros de obras. O modelo integra o projeto
20
+ [epi-with-keypoints](https://github.com/matheeusper/epi-with-keypoints), que combina
21
+ a detecção de capacete com keypoints corporais e tracking temporal para produzir
22
+ um resultado por pessoa em imagens e vídeos.
23
+
24
+ ## Arquivo
25
+
26
+ - `helmet_only_576_best.pth`: checkpoint RF-DETR em resolução 576 px.
27
+ - `training_config.yaml`: configuração usada no treinamento.
28
+ - `model_metadata.json`: classes, limiares recomendados, métricas e checksum.
29
+
30
+ ## Uso
31
+
32
+ Clone o projeto e sincronize as dependências:
33
+
34
+ ```bash
35
+ git clone https://github.com/matheeusper/epi-with-keypoints.git
36
+ cd epi-with-keypoints
37
+ uv sync
38
+ ```
39
+
40
+ O script baixa este checkpoint automaticamente quando `models/helmet_only_576_best.pth`
41
+ não está disponível:
42
+
43
+ ```bash
44
+ uv run python infer_ppe_keypoints.py --image images/image2.jpg
45
+ uv run python infer_ppe_keypoints.py --video videos/obra.mp4
46
+ ```
47
+
48
+ Também é possível baixá-lo diretamente:
49
+
50
+ ```python
51
+ from huggingface_hub import hf_hub_download
52
+
53
+ checkpoint = hf_hub_download(
54
+ repo_id="matheeusper/epi-with-keypoints",
55
+ filename="helmet_only_576_best.pth",
56
+ )
57
+ ```
58
+
59
+ ```python
60
+ from rfdetr import RFDETRSmall
61
+
62
+ model = RFDETRSmall.from_checkpoint(checkpoint)
63
+ detections = model.predict("imagem.jpg", threshold=0.35)
64
+ ```
65
+
66
+ ## Métricas
67
+
68
+ Avaliação em 141 imagens e 192 capacetes do split de teste derivado do
69
+ Construction-PPE:
70
+
71
+ | Métrica | Resultado |
72
+ | --- | ---: |
73
+ | mAP@[0.50:0.95] | 55,53% |
74
+ | mAP@0.50 | 95,00% |
75
+ | mAP@0.75 | 58,66% |
76
+ | mAR@100 | 66,30% |
77
+ | Precisão@0.50 | 93,75% |
78
+ | Recall@0.50 | 93,75% |
79
+ | F1@0.50 | 93,75% |
80
+ | Confiança no melhor F1 | 0,435 |
81
+
82
+ ## Treinamento
83
+
84
+ - Arquitetura: `RFDETRSmall`.
85
+ - Resolução: 576 px.
86
+ - Classe: `helmet` (`id=0`).
87
+ - Seed: 42.
88
+ - Batch efetivo: 16 (`batch_size=1`, `grad_accum_steps=16`).
89
+ - Checkpoint selecionado após 11 épocas e 781 passos globais.
90
+
91
+ ## Limitações e uso responsável
92
+
93
+ O modelo foi treinado em um conjunto específico de obras e pode falhar com pessoas
94
+ pequenas, iluminação extrema, ângulos incomuns, aglomerações ou oclusões prolongadas.
95
+ Ele detecta capacetes, mas não deve ser usado isoladamente para decisões disciplinares
96
+ ou outras decisões críticas de segurança. Valide e calibre o limiar com imagens do
97
+ ambiente de implantação.
98
+
99
+ O dataset de origem Construction-PPE é distribuído sob AGPL-3.0; este repositório
100
+ adota a mesma licença para o checkpoint derivado.
helmet_only_576_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7bf0a9009e7b6bdc4d1082932845e621b886c8a988c6277597f1c2105f48c690
3
+ size 127784231
model_metadata.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "RFDETRSmall",
3
+ "framework": "PyTorch",
4
+ "input_resolution": 576,
5
+ "classes": [
6
+ {
7
+ "id": 0,
8
+ "name": "helmet"
9
+ }
10
+ ],
11
+ "recommended_detection_threshold": 0.35,
12
+ "checkpoint": {
13
+ "filename": "helmet_only_576_best.pth",
14
+ "size_bytes": 127784231,
15
+ "sha256": "7bf0a9009e7b6bdc4d1082932845e621b886c8a988c6277597f1c2105f48c690"
16
+ },
17
+ "training": {
18
+ "seed": 42,
19
+ "completed_epochs": 11,
20
+ "global_steps": 781
21
+ },
22
+ "test_metrics": {
23
+ "images": 141,
24
+ "ground_truth_helmets": 192,
25
+ "map_50_95": 0.5553,
26
+ "map_50": 0.95,
27
+ "map_75": 0.5866,
28
+ "mar_100": 0.663,
29
+ "precision_50": 0.9375,
30
+ "recall_50": 0.9375,
31
+ "f1_50": 0.9375,
32
+ "confidence_at_best_f1": 0.435
33
+ },
34
+ "source_repository": "https://github.com/matheeusper/epi-with-keypoints"
35
+ }
training_config.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Treino de alta qualidade focado exclusivamente na classe positiva ``helmet``.
2
+ general:
3
+ output_dir: "output_helmet_only_576"
4
+ dataset_dir: "construction-ppe-helmet"
5
+ device: "cuda"
6
+ seed: 42
7
+
8
+ model:
9
+ resolution: 576
10
+ gradient_checkpointing: true
11
+
12
+ training:
13
+ epochs: 120
14
+ batch_size: 1
15
+ grad_accum_steps: 16
16
+ lr: 1e-4
17
+ lr_encoder: 5e-5
18
+
19
+ early_stopping:
20
+ enabled: true
21
+ patience: 20
22
+ min_delta: 0.001
23
+ use_ema: true
24
+
25
+ augmentations:
26
+ HorizontalFlip: {p: 0.5}
27
+ RandomBrightnessContrast: {p: 0.35}
28
+ ShiftScaleRotate:
29
+ shift_limit: 0.03
30
+ scale_limit: 0.10
31
+ rotate_limit: 10
32
+ p: 0.35