Spaces:
Running
Running
Fatih
commited on
Commit
•
ff2c3d6
1
Parent(s):
13daaa9
fix image_size usage
Browse files
utils.py
CHANGED
@@ -14,15 +14,16 @@ def sahi_mmdet_inference(
|
|
14 |
overlap_height_ratio=0.2,
|
15 |
overlap_width_ratio=0.2,
|
16 |
image_size=640,
|
17 |
-
postprocess_type="
|
18 |
postprocess_match_metric="IOS",
|
19 |
postprocess_match_threshold=0.5,
|
20 |
postprocess_class_agnostic=False,
|
21 |
):
|
22 |
|
23 |
# standard inference
|
|
|
24 |
prediction_result_1 = sahi.predict.get_prediction(
|
25 |
-
image=image, detection_model=detection_model
|
26 |
)
|
27 |
visual_result_1 = sahi.utils.cv.visualize_object_predictions(
|
28 |
image=numpy.array(image),
|
@@ -34,7 +35,6 @@ def sahi_mmdet_inference(
|
|
34 |
prediction_result_2 = sahi.predict.get_sliced_prediction(
|
35 |
image=image,
|
36 |
detection_model=detection_model,
|
37 |
-
image_size=image_size,
|
38 |
slice_height=slice_height,
|
39 |
slice_width=slice_width,
|
40 |
overlap_height_ratio=overlap_height_ratio,
|
|
|
14 |
overlap_height_ratio=0.2,
|
15 |
overlap_width_ratio=0.2,
|
16 |
image_size=640,
|
17 |
+
postprocess_type="GREEDYNMM",
|
18 |
postprocess_match_metric="IOS",
|
19 |
postprocess_match_threshold=0.5,
|
20 |
postprocess_class_agnostic=False,
|
21 |
):
|
22 |
|
23 |
# standard inference
|
24 |
+
detection_model.image_size = image_size
|
25 |
prediction_result_1 = sahi.predict.get_prediction(
|
26 |
+
image=image, detection_model=detection_model
|
27 |
)
|
28 |
visual_result_1 = sahi.utils.cv.visualize_object_predictions(
|
29 |
image=numpy.array(image),
|
|
|
35 |
prediction_result_2 = sahi.predict.get_sliced_prediction(
|
36 |
image=image,
|
37 |
detection_model=detection_model,
|
|
|
38 |
slice_height=slice_height,
|
39 |
slice_width=slice_width,
|
40 |
overlap_height_ratio=overlap_height_ratio,
|