Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,7 @@ model = AutoModelForObjectDetection.from_pretrained("PekingU/rtdetr_r50vd_coco_o
|
|
| 21 |
BOUNDING_BOX_ANNOTATOR = sv.BoundingBoxAnnotator()
|
| 22 |
MASK_ANNOTATOR = sv.MaskAnnotator()
|
| 23 |
LABEL_ANNOTATOR = sv.LabelAnnotator()
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def calculate_end_frame_index(source_video_path):
|
|
@@ -63,7 +64,7 @@ def process_video(
|
|
| 63 |
detections = []
|
| 64 |
|
| 65 |
detections = sv.Detections.from_transformers(results[0])
|
| 66 |
-
|
| 67 |
for label in results[0]["labels"]:
|
| 68 |
final_labels.append(model.config.id2label[label.item()])
|
| 69 |
frame = annotate_image(
|
|
|
|
| 21 |
BOUNDING_BOX_ANNOTATOR = sv.BoundingBoxAnnotator()
|
| 22 |
MASK_ANNOTATOR = sv.MaskAnnotator()
|
| 23 |
LABEL_ANNOTATOR = sv.LabelAnnotator()
|
| 24 |
+
TRACKER = sv.ByteTrack()
|
| 25 |
|
| 26 |
|
| 27 |
def calculate_end_frame_index(source_video_path):
|
|
|
|
| 64 |
detections = []
|
| 65 |
|
| 66 |
detections = sv.Detections.from_transformers(results[0])
|
| 67 |
+
detections = TRACKER.update_with_detections(detections)
|
| 68 |
for label in results[0]["labels"]:
|
| 69 |
final_labels.append(model.config.id2label[label.item()])
|
| 70 |
frame = annotate_image(
|