Update app.py
Browse files
app.py
CHANGED
|
@@ -78,13 +78,15 @@ def draw_bounding_boxes(img, results):
|
|
| 78 |
x1, y1, x2, y2, cls = map(int, [x1, y1, x2, y2, cls])
|
| 79 |
conf = round(conf.detach().item(), 4)
|
| 80 |
print("results in draw_bounding box:",[(x1, y1, x2, y2), conf, cls])
|
|
|
|
| 81 |
cv2.rectangle(img, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 82 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
| 83 |
-
return img
|
| 84 |
|
| 85 |
def show_preds_image(filepath):
|
| 86 |
results, img0, dicom_meta = detect_objects(filepath)
|
| 87 |
-
img_with_boxes = draw_bounding_boxes(img0, results)
|
|
|
|
| 88 |
#return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
|
| 89 |
return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB), results, dicom_meta
|
| 90 |
|
|
|
|
| 78 |
x1, y1, x2, y2, cls = map(int, [x1, y1, x2, y2, cls])
|
| 79 |
conf = round(conf.detach().item(), 4)
|
| 80 |
print("results in draw_bounding box:",[(x1, y1, x2, y2), conf, cls])
|
| 81 |
+
results = [(x1, y1, x2, y2), conf, cls])
|
| 82 |
cv2.rectangle(img, (x1, y1), (x2, y2), (255, 0, 0), 2)
|
| 83 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
| 84 |
+
return img, results
|
| 85 |
|
| 86 |
def show_preds_image(filepath):
|
| 87 |
results, img0, dicom_meta = detect_objects(filepath)
|
| 88 |
+
img_with_boxes, results = draw_bounding_boxes(img0, results)
|
| 89 |
+
|
| 90 |
#return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
|
| 91 |
return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB), results, dicom_meta
|
| 92 |
|