Skip to content

Commit 91a0bec

Browse files
authored
Fix bug that Unable to print for prediction time when verbose=2 (#521)
* Fix bug that Unable to print for prediction time when verbose=2 * Black, isort code formatter verification completed by code modification
1 parent ff9bda9 commit 91a0bec

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ line-length = 120
33

44
[tool.isort]
55
line_length = 120
6-
profile = "black"
6+
profile = "black"

sahi/predict.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ def get_sliced_prediction(
255255
)
256256
object_prediction_list.extend(prediction_result.object_prediction_list)
257257

258+
# merge matching predictions
259+
if len(object_prediction_list) > 1:
260+
object_prediction_list = postprocess(object_prediction_list)
261+
262+
time_end = time.time() - time_start
263+
durations_in_seconds["prediction"] = time_end
264+
258265
if verbose == 2:
259266
print(
260267
"Slicing performed in",
@@ -267,13 +274,6 @@ def get_sliced_prediction(
267274
"seconds.",
268275
)
269276

270-
# merge matching predictions
271-
if len(object_prediction_list) > 1:
272-
object_prediction_list = postprocess(object_prediction_list)
273-
274-
time_end = time.time() - time_start
275-
durations_in_seconds["prediction"] = time_end
276-
277277
return PredictionResult(
278278
image=image, object_prediction_list=object_prediction_list, durations_in_seconds=durations_in_seconds
279279
)

0 commit comments

Comments
 (0)