@@ -294,7 +294,7 @@ def _build_train_resize_config(
294294 * ,
295295 square : bool ,
296296 max_size : Optional [int ] = None ,
297- include_crop_branch : bool = True ,
297+ disable_augmentations : bool = False ,
298298) -> List [Dict [str , Any ]]:
299299 """Build the training resize pipeline as an Albumentations config list.
300300
@@ -317,15 +317,14 @@ def _build_train_resize_config(
317317 optional long-side cap.
318318 max_size: Maximum long-side size for non-square resizes. Defaults to
319319 ``1333`` when *square* is ``False``.
320- include_crop_branch: If ``False``, omit the resize-and-crop branch so the
321- pipeline always uses Option A (direct resize). Useful when objects
322- of interest can be partially or fully cropped out of frame.
323- Defaults to ``True`` (preserves the original two-branch behavior).
320+ disable_augmentations: If ``True``, omit the resize-and-crop branch so
321+ explicitly disabled augmentations do not still randomly crop images.
322+ Defaults to ``False`` (preserves the original two-branch behavior).
324323
325324 Returns:
326- A single-element list. When ``include_crop_branch`` is ``True `` (default)
327- the entry wraps a ``OneOf`` over both branches; when ``False`` the
328- entry is Option A directly.
325+ A single-element list. By default the entry wraps a ``OneOf `` over both
326+ branches; when augmentations are disabled, the entry is Option A
327+ directly.
329328 """
330329 if square :
331330 option_a : Dict [str , Any ] = {
@@ -371,14 +370,14 @@ def _build_train_resize_config(
371370 }
372371 }
373372
374- if not include_crop_branch :
373+ if disable_augmentations :
375374 return [option_a ]
376375
377376 return [{"OneOf" : {"transforms" : [option_a , option_b ]}}]
378377
379378
380- def _crop_branch_enabled (aug_config : Optional [Dict [str , Any ]]) -> bool :
381- """Decide whether the training resize pipeline keeps its resize-and-crop branch .
379+ def _augmentations_disabled (aug_config : Optional [Dict [str , Any ]]) -> bool :
380+ """Decide whether the user explicitly disabled augmentations .
382381
383382 ``aug_config={}`` is an explicit request to disable augmentations; it also
384383 drops the resize-and-crop branch. ``aug_config=None`` (the default) and any
@@ -390,8 +389,8 @@ def _crop_branch_enabled(aug_config: Optional[Dict[str, Any]]) -> bool:
390389 "augmentations; images will not be randomly cropped. Pass aug_config=None to keep "
391390 "the default resize pipeline."
392391 )
393- return False
394- return True
392+ return True
393+ return False
395394
396395
397396def make_coco_transforms (
@@ -468,9 +467,13 @@ def make_coco_transforms(
468467
469468 if image_set == "train" :
470469 resolved_aug_config = aug_config if aug_config is not None else AUG_CONFIG
471- include_crop_branch = _crop_branch_enabled (aug_config )
472470 resize_wrappers = AlbumentationsWrapper .from_config (
473- _build_train_resize_config (scales , square = False , max_size = 1333 , include_crop_branch = include_crop_branch )
471+ _build_train_resize_config (
472+ scales ,
473+ square = False ,
474+ max_size = 1333 ,
475+ disable_augmentations = _augmentations_disabled (aug_config ),
476+ )
474477 )
475478 pipeline = [* resize_wrappers ]
476479 if not gpu_postprocess :
@@ -556,9 +559,12 @@ def make_coco_transforms_square_div_64(
556559
557560 if image_set == "train" :
558561 resolved_aug_config = aug_config if aug_config is not None else AUG_CONFIG
559- include_crop_branch = _crop_branch_enabled (aug_config )
560562 resize_wrappers = AlbumentationsWrapper .from_config (
561- _build_train_resize_config (scales , square = True , include_crop_branch = include_crop_branch )
563+ _build_train_resize_config (
564+ scales ,
565+ square = True ,
566+ disable_augmentations = _augmentations_disabled (aug_config ),
567+ )
562568 )
563569 pipeline = [* resize_wrappers ]
564570 if not gpu_postprocess :
0 commit comments