Spaces:
Sleeping
Sleeping
Commit
·
94627ea
1
Parent(s):
609e92c
Updated readme and other optimization
Browse files
README.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1 |
---
|
2 |
-
license: mit
|
3 |
title: Shirt Detection
|
|
|
|
|
|
|
|
|
|
|
4 |
sdk: gradio
|
5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
|
|
2 |
title: Shirt Detection
|
3 |
+
colorFrom: red
|
4 |
+
colorTo: gray
|
5 |
+
app_file: app.py
|
6 |
+
pinned: false
|
7 |
+
license: mit
|
8 |
sdk: gradio
|
9 |
+
---
|
10 |
+
|
11 |
+
# App for shirt/tshirt detection using YOLOv9
|
12 |
+
|
13 |
+
## Features
|
14 |
+
- Image input/output: Upload image and check predictions
|
15 |
+
- Confidence Thresold: Confidence Thresold from NMS
|
16 |
+
- IoU Thresold: IoU thresold to remove overlapping detection boxes
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
- Upload an image
|
20 |
+
- Change settings as requied
|
21 |
+
- Hit submit and view results
|
22 |
+
|
23 |
+
## Features
|
24 |
+
- GradCAM: To understand what models has actully learned. Adjust opacity and model layer for grad-cam.
|
25 |
+
- Miss classified images: Plot of images missclassified by model
|
26 |
+
- Image input/output: Upload image and check predictions
|
27 |
+
- Top classes: Show top n classes with high prediction confidence.
|
28 |
+
|
29 |
+
## Usage
|
30 |
+
- Upload an image
|
31 |
+
- Change settings as requied
|
32 |
+
- Hit submit and view results
|
app.py
CHANGED
@@ -10,6 +10,9 @@ from utils.general import check_img_size, Profile, non_max_suppression, scale_bo
|
|
10 |
|
11 |
weights = "runs/train/best_striped.pt"
|
12 |
data = "data.yaml"
|
|
|
|
|
|
|
13 |
|
14 |
def resize_image_pil(image, new_width, new_height):
|
15 |
|
@@ -34,9 +37,6 @@ def resize_image_pil(image, new_width, new_height):
|
|
34 |
|
35 |
def inference(input_img, conf_thres, iou_thres):
|
36 |
im0 = input_img.copy()
|
37 |
-
# Load model
|
38 |
-
device = select_device('cpu')
|
39 |
-
model = DetectMultiBackend(weights, device=device, dnn=False, data=data, fp16=False)
|
40 |
stride, names, pt = model.stride, model.names, model.pt
|
41 |
imgsz = check_img_size((640, 640), s=stride) # check image size
|
42 |
|
@@ -89,7 +89,7 @@ examples = [["image_1.jpg", 0.25, 0.45], ["image_2.jpg", 0.25, 0.45],
|
|
89 |
|
90 |
demo = gr.Interface(inference,
|
91 |
inputs = [gr.Image(width=320, height=320, label="Input Image"),
|
92 |
-
gr.Slider(0, 1, 0.25, label="
|
93 |
gr.Slider(0, 1, 0.45, label="IoU Thresold")],
|
94 |
outputs= [gr.Image(width=640, height=640, label="Output")],
|
95 |
title=title,
|
|
|
10 |
|
11 |
weights = "runs/train/best_striped.pt"
|
12 |
data = "data.yaml"
|
13 |
+
# Load model
|
14 |
+
device = select_device('cpu')
|
15 |
+
model = DetectMultiBackend(weights, device=device, dnn=False, data=data, fp16=False)
|
16 |
|
17 |
def resize_image_pil(image, new_width, new_height):
|
18 |
|
|
|
37 |
|
38 |
def inference(input_img, conf_thres, iou_thres):
|
39 |
im0 = input_img.copy()
|
|
|
|
|
|
|
40 |
stride, names, pt = model.stride, model.names, model.pt
|
41 |
imgsz = check_img_size((640, 640), s=stride) # check image size
|
42 |
|
|
|
89 |
|
90 |
demo = gr.Interface(inference,
|
91 |
inputs = [gr.Image(width=320, height=320, label="Input Image"),
|
92 |
+
gr.Slider(0, 1, 0.25, label="Confidence Threshold"),
|
93 |
gr.Slider(0, 1, 0.45, label="IoU Thresold")],
|
94 |
outputs= [gr.Image(width=640, height=640, label="Output")],
|
95 |
title=title,
|