wangjin2000
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,6 @@ def detect_objects(image_path):
|
|
70 |
img, img0 = preprocess_image(dicom_image)
|
71 |
pred = infer(model, img)
|
72 |
results = postprocess(pred, dicom_image, img)
|
73 |
-
#return results, dicom_image
|
74 |
return results, dicom_image, dicom_meta
|
75 |
|
76 |
def draw_bounding_boxes(img, results, dicom_meta):
|
@@ -81,11 +80,9 @@ def draw_bounding_boxes(img, results, dicom_meta):
|
|
81 |
xc = x1+(x2-x1)/2
|
82 |
yc = y1+(y2-y1)/2
|
83 |
conf = round(conf.detach().item(), 4)
|
84 |
-
#print("results in draw_bounding box:",[(x1, y1, x2, y2), conf, cls])
|
85 |
|
86 |
-
#dets.append([(x1, y1, x2, y2), conf, cls])
|
87 |
dets.append([(xc, yc, zc), conf, cls])
|
88 |
-
cv2.rectangle(img, (x1, y1), (x2, y2), (
|
89 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
90 |
return img, dets
|
91 |
|
|
|
70 |
img, img0 = preprocess_image(dicom_image)
|
71 |
pred = infer(model, img)
|
72 |
results = postprocess(pred, dicom_image, img)
|
|
|
73 |
return results, dicom_image, dicom_meta
|
74 |
|
75 |
def draw_bounding_boxes(img, results, dicom_meta):
|
|
|
80 |
xc = x1+(x2-x1)/2
|
81 |
yc = y1+(y2-y1)/2
|
82 |
conf = round(conf.detach().item(), 4)
|
|
|
83 |
|
|
|
84 |
dets.append([(xc, yc, zc), conf, cls])
|
85 |
+
cv2.rectangle(img, (x1, y1), (x2, y2), (0, 0, 255), 2)
|
86 |
cv2.putText(img, f'{model.names[int(cls)]} {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
|
87 |
return img, dets
|
88 |
|