File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
luxonis_ml/data/augmentations Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,33 @@ def apply_to_array(
241241 ...
242242 """
243243
244+ def _should_skip_augmentation (
245+ self , config_item : dict [str , Any ], available_target_types : set
246+ ) -> bool :
247+ skip_rules = {
248+ "keypoints" : ["Flip" ],
249+ }
250+ augmentation_name = config_item ["name" ]
251+ skipped_for = [
252+ target_type
253+ for target_type , skip_list in skip_rules .items ()
254+ if target_type in available_target_types
255+ and augmentation_name in skip_list
256+ ]
257+ if skipped_for :
258+ extra_msg = ""
259+ if "keypoints" in skipped_for and augmentation_name in [
260+ "HorizontalFlip" ,
261+ "VerticalFlip" ,
262+ "Flip" ,
263+ ]:
264+ extra_msg = " For keypoints, please use 'HorizontalSymetricKeypointsFlip' or 'VerticalSymetricKeypointsFlip'."
265+ logger .warning (
266+ f"Skipping augmentation '{ augmentation_name } ' due to known issues for { skipped_for } target types. { extra_msg } "
267+ )
268+ return True
269+ return False
270+
244271 @override
245272 def __init__ (
246273 self ,
@@ -338,6 +365,16 @@ def __init__(
338365 if is_validation_pipeline :
339366 config = (a for a in config if a ["name" ] == "Normalize" )
340367
368+ available_target_types = set (self .targets .values ())
369+
370+ for config_item in config :
371+ if self ._should_skip_augmentation (
372+ config_item , available_target_types
373+ ):
374+ continue
375+
376+ cfg = AlbumentationConfigItem (** config_item ) # type: ignore
377+
341378 for config_item in config :
342379 cfg = AlbumentationConfigItem (** config_item ) # type: ignore
343380
You can’t perform that action at this time.
0 commit comments