@@ -50,6 +50,8 @@ class MakeCropsDetectThem:
5050 image size (ps: slow operation).
5151 class_names_dict (dict): Dictionary containing class names of the YOLO model.
5252 memory_optimize (bool): Memory optimization option for segmentation (less accurate results)
53+ batch_inference (bool): Batch inference of image crops through a neural network instead of
54+ sequential passes of crops (ps: Faster inference, higher memory use)
5355 inference_extra_args (dict): Dictionary with extra ultralytics inference parameters
5456 """
5557 def __init__ (
@@ -92,7 +94,7 @@ def __init__(
9294 self .memory_optimize = memory_optimize # memory opimization option for segmentation
9395 self .class_names_dict = self .model .names # dict with human-readable class names
9496 self .inference_extra_args = inference_extra_args # dict with extra ultralytics inference parameters
95- self .batch_inference = batch_inference
97+ self .batch_inference = batch_inference # batch inference of image crops through a neural network
9698
9799 self .crops = self .get_crops_xy (
98100 self .image ,
@@ -221,7 +223,7 @@ def _detect_objects(self):
221223
222224 def _detect_objects_batch (self ):
223225 """
224- Method to detect objects in batch of crop .
226+ Method to detect objects in batch of image crops .
225227
226228 This method performs batch inference using the YOLO model,
227229 calculates real values, and optionally resizes the results.
@@ -261,7 +263,7 @@ def _calculate_batch_inference(
261263 memory_optimize = False ,
262264 extra_args = None ,
263265 ):
264- # Perform inference
266+ # Perform batch inference of image crops through a neural network
265267 extra_args = {} if extra_args is None else extra_args
266268 predictions = model .predict (
267269 batch ,
0 commit comments