Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,11 +23,11 @@ results = processor.post_process_object_detection(outputs, target_sizes=target_s
|
|
| 23 |
persons = 0
|
| 24 |
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
| 25 |
box = [round(i, 2) for i in box.tolist()]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if model.config.id2label[label.item()] == 'person':
|
| 27 |
-
print(
|
| 28 |
-
f"Detected {model.config.id2label[label.item()]} with confidence "
|
| 29 |
-
f"{round(score.item(), 3)} at location {box}"
|
| 30 |
-
)
|
| 31 |
persons += 1 # Incrémentation correcte
|
| 32 |
|
| 33 |
print(f"Total persons detected: {persons}")
|
|
|
|
| 23 |
persons = 0
|
| 24 |
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
| 25 |
box = [round(i, 2) for i in box.tolist()]
|
| 26 |
+
print(
|
| 27 |
+
f"Detected {model.config.id2label[label.item()]} with confidence "
|
| 28 |
+
f"{round(score.item(), 3)} at location {box}"
|
| 29 |
+
)
|
| 30 |
if model.config.id2label[label.item()] == 'person':
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
persons += 1 # Incrémentation correcte
|
| 32 |
|
| 33 |
print(f"Total persons detected: {persons}")
|