fcakyon commited on
Commit
61f344c
1 Parent(s): e2e070d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -25,12 +25,12 @@ model = AutoDetectionModel.from_pretrained(
25
  def sahi_yolo_inference(
26
  model_type,
27
  image,
28
- slice_height=512,
29
- slice_width=512,
30
- overlap_height_ratio=0.2,
31
- overlap_width_ratio=0.2,
32
- postprocess_type="GREEDYNMM",
33
- postprocess_match_metric="IOS",
34
  postprocess_match_threshold=0.5,
35
  postprocess_class_agnostic=False,
36
  ):
@@ -99,18 +99,18 @@ def sahi_yolo_inference(
99
  inputs = [
100
  gr.inputs.Dropdown(choices=model_types,label="Choose Model Type",type="value",),
101
  gr.inputs.Image(type="pil", label="Original Image"),
102
- gr.inputs.Number(default=512, label="slice_height"),
103
- gr.inputs.Number(default=512, label="slice_width"),
104
- gr.inputs.Number(default=0.2, label="overlap_height_ratio"),
105
- gr.inputs.Number(default=0.2, label="overlap_width_ratio"),
106
  gr.inputs.Dropdown(
107
  ["NMS", "GREEDYNMM"],
108
  type="value",
109
- default="GREEDYNMM",
110
  label="postprocess_type",
111
  ),
112
  gr.inputs.Dropdown(
113
- ["IOU", "IOS"], type="value", default="IOS", label="postprocess_type"
114
  ),
115
  gr.inputs.Number(default=0.5, label="postprocess_match_threshold"),
116
  gr.inputs.Checkbox(default=True, label="postprocess_class_agnostic"),
@@ -124,10 +124,10 @@ title = "Small Object Detection with SAHI + YOLOv5"
124
  description = "SAHI + YOLOv5 demo for small object detection. Upload an image or click an example image to use."
125
  article = "<p style='text-align: center'>SAHI is a lightweight vision library for performing large scale object detection/ instance segmentation.. <a href='https://github.com/obss/sahi'>SAHI Github</a> | <a href='https://medium.com/codable/sahi-a-vision-library-for-performing-sliced-inference-on-large-images-small-objects-c8b086af3b80'>SAHI Blog</a> | <a href='https://github.com/fcakyon/yolov5-pip'>YOLOv5 Github</a> </p>"
126
  examples = [
127
- [model_types[0],"26.jpg", 256, 256, 0.2, 0.2, "GREEDYNMM", "IOS", 0.5, True],
128
- [model_types[0],"27.jpg", 512, 512, 0.2, 0.2, "GREEDYNMM", "IOS", 0.5, True],
129
- [model_types[0],"28.jpg", 512, 512, 0.2, 0.2, "GREEDYNMM", "IOS", 0.5, True],
130
- [model_types[0],"31.jpg", 512, 512, 0.2, 0.2, "GREEDYNMM", "IOS", 0.5, True],
131
 
132
  ]
133
  gr.Interface(
 
25
  def sahi_yolo_inference(
26
  model_type,
27
  image,
28
+ slice_height=1280,
29
+ slice_width=1280,
30
+ overlap_height_ratio=0.1,
31
+ overlap_width_ratio=0.1,
32
+ postprocess_type="NMS",
33
+ postprocess_match_metric="IOU",
34
  postprocess_match_threshold=0.5,
35
  postprocess_class_agnostic=False,
36
  ):
 
99
  inputs = [
100
  gr.inputs.Dropdown(choices=model_types,label="Choose Model Type",type="value",),
101
  gr.inputs.Image(type="pil", label="Original Image"),
102
+ gr.inputs.Number(default=1920 label="slice_height"),
103
+ gr.inputs.Number(default=1920, label="slice_width"),
104
+ gr.inputs.Number(default=0.1, label="overlap_height_ratio"),
105
+ gr.inputs.Number(default=0.1, label="overlap_width_ratio"),
106
  gr.inputs.Dropdown(
107
  ["NMS", "GREEDYNMM"],
108
  type="value",
109
+ default="NMS",
110
  label="postprocess_type",
111
  ),
112
  gr.inputs.Dropdown(
113
+ ["IOU", "IOS"], type="value", default="IOU", label="postprocess_type"
114
  ),
115
  gr.inputs.Number(default=0.5, label="postprocess_match_threshold"),
116
  gr.inputs.Checkbox(default=True, label="postprocess_class_agnostic"),
 
124
  description = "SAHI + YOLOv5 demo for small object detection. Upload an image or click an example image to use."
125
  article = "<p style='text-align: center'>SAHI is a lightweight vision library for performing large scale object detection/ instance segmentation.. <a href='https://github.com/obss/sahi'>SAHI Github</a> | <a href='https://medium.com/codable/sahi-a-vision-library-for-performing-sliced-inference-on-large-images-small-objects-c8b086af3b80'>SAHI Blog</a> | <a href='https://github.com/fcakyon/yolov5-pip'>YOLOv5 Github</a> </p>"
126
  examples = [
127
+ [model_types[0],"26.jpg", 256, 256, 0.2, 0.2, "NMS", "IOU", 0.5, True],
128
+ [model_types[0],"27.jpg", 512, 512, 0.2, 0.2, "NMS", "IOU", 0.5, True],
129
+ [model_types[0],"28.jpg", 512, 512, 0.2, 0.2, "NMS", "IOU", 0.5, True],
130
+ [model_types[0],"31.jpg", 512, 512, 0.2, 0.2, "NMS", "IOU", 0.5, True],
131
 
132
  ]
133
  gr.Interface(