@@ -125,8 +125,6 @@ def get_prediction(
125125def get_sliced_prediction (
126126 image ,
127127 detection_model = None ,
128- output_file_name = None , # ADDED OUTPUT FILE NAME TO (OPTIONALLY) SAVE SLICES
129- interim_dir = "slices/" , # ADDED INTERIM DIRECTORY TO (OPTIONALLY) SAVE SLICES
130128 slice_height : int = None ,
131129 slice_width : int = None ,
132130 overlap_height_ratio : float = 0.2 ,
@@ -139,6 +137,8 @@ def get_sliced_prediction(
139137 verbose : int = 1 ,
140138 merge_buffer_length : int = None ,
141139 auto_slice_resolution : bool = True ,
140+ slice_export_prefix : str = None ,
141+ slice_dir : str = None ,
142142) -> PredictionResult :
143143 """
144144 Function for slice image + get predicion for each slice + combine predictions in full image.
@@ -184,6 +184,10 @@ def get_sliced_prediction(
184184 auto_slice_resolution: bool
185185 if slice parameters (slice_height, slice_width) are not given,
186186 it enables automatically calculate these params from image resolution and orientation.
187+ slice_export_prefix: str
188+ Prefix for the exported slices. Defaults to None.
189+ slice_dir: str
190+ Directory to save the slices. Defaults to None.
187191
188192 Returns:
189193 A Dict with fields:
@@ -201,8 +205,8 @@ def get_sliced_prediction(
201205 time_start = time .time ()
202206 slice_image_result = slice_image (
203207 image = image ,
204- output_file_name = output_file_name , # ADDED OUTPUT FILE NAME TO (OPTIONALLY) SAVE SLICES
205- output_dir = interim_dir , # ADDED INTERIM DIRECTORY TO (OPTIONALLY) SAVE SLICES
208+ output_file_name = slice_export_prefix ,
209+ output_dir = slice_dir ,
206210 slice_height = slice_height ,
207211 slice_width = slice_width ,
208212 overlap_height_ratio = overlap_height_ratio ,
0 commit comments