Spaces:
Sleeping
Sleeping
Commit
·
dced210
1
Parent(s):
cf9410f
Minor fix
Browse files
app.py
CHANGED
|
@@ -66,11 +66,7 @@ def display_false_detection_data(false_detection_data, number_of_samples):
|
|
| 66 |
|
| 67 |
def inference(input_img, conf_thres, iou_thres, is_false_detection_images=True, num_false_detection_images=10):
|
| 68 |
im0 = input_img.copy()
|
| 69 |
-
|
| 70 |
-
rgb_img = im_resized.copy()
|
| 71 |
-
transforms = albumentations.Compose([ToTensorV2()])
|
| 72 |
-
im_resized = transforms(image = im_resized)['image']
|
| 73 |
-
im_resized = im_resized.unsqueeze(0)
|
| 74 |
stride, names, pt = model.stride, model.names, model.pt
|
| 75 |
imgsz = check_img_size((640, 640), s=stride) # check image size
|
| 76 |
|
|
@@ -118,9 +114,9 @@ def inference(input_img, conf_thres, iou_thres, is_false_detection_images=True,
|
|
| 118 |
misclassified_images = None
|
| 119 |
|
| 120 |
cam = EigenCAM(model, target_layers)
|
| 121 |
-
grayscale_cam = cam(
|
| 122 |
cam_image = show_cam_on_image(rgb_img, grayscale_cam, use_rgb=True)
|
| 123 |
-
|
| 124 |
return im0, cam_image, misclassified_images
|
| 125 |
|
| 126 |
title = "YOLOv9 model to detect shirt/tshirt"
|
|
|
|
| 66 |
|
| 67 |
def inference(input_img, conf_thres, iou_thres, is_false_detection_images=True, num_false_detection_images=10):
|
| 68 |
im0 = input_img.copy()
|
| 69 |
+
rgb_img = cv2.resize(im0, (640, 640))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
stride, names, pt = model.stride, model.names, model.pt
|
| 71 |
imgsz = check_img_size((640, 640), s=stride) # check image size
|
| 72 |
|
|
|
|
| 114 |
misclassified_images = None
|
| 115 |
|
| 116 |
cam = EigenCAM(model, target_layers)
|
| 117 |
+
grayscale_cam = cam(im)[0, :]
|
| 118 |
cam_image = show_cam_on_image(rgb_img, grayscale_cam, use_rgb=True)
|
| 119 |
+
|
| 120 |
return im0, cam_image, misclassified_images
|
| 121 |
|
| 122 |
title = "YOLOv9 model to detect shirt/tshirt"
|