Update detect_bubbles.py
Browse files- detect_bubbles.py +5 -4
detect_bubbles.py
CHANGED
|
@@ -6,7 +6,7 @@ def safe_load_model(model_path):
|
|
| 6 |
Manually loads the YOLO model weights with 'weights_only' set to False
|
| 7 |
to avoid the security check issue with PyTorch.
|
| 8 |
"""
|
| 9 |
-
model =
|
| 10 |
return model
|
| 11 |
|
| 12 |
def detect_bubbles(model_path, image_path):
|
|
@@ -19,7 +19,8 @@ def detect_bubbles(model_path, image_path):
|
|
| 19 |
list: A list containing the coordinates, score, and class_id of
|
| 20 |
the detected bubbles.
|
| 21 |
"""
|
| 22 |
-
model = safe_load_model(model_path)
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
return bubbles
|
|
|
|
| 6 |
Manually loads the YOLO model weights with 'weights_only' set to False
|
| 7 |
to avoid the security check issue with PyTorch.
|
| 8 |
"""
|
| 9 |
+
model = YOLO(model_path)
|
| 10 |
return model
|
| 11 |
|
| 12 |
def detect_bubbles(model_path, image_path):
|
|
|
|
| 19 |
list: A list containing the coordinates, score, and class_id of
|
| 20 |
the detected bubbles.
|
| 21 |
"""
|
| 22 |
+
model = safe_load_model(model_path)
|
| 23 |
+
results = model(image_path)
|
| 24 |
+
bubbles = results[0].boxes.data.tolist()
|
| 25 |
|
| 26 |
+
return bubbles
|