dragon-ml-toolbox 14.3.0__py3-none-any.whl → 14.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dragon-ml-toolbox might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 14.3.0
3
+ Version: 14.3.1
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: "Karl L. Loza Vidaurre" <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- dragon_ml_toolbox-14.3.0.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
- dragon_ml_toolbox-14.3.0.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=gkOdNDbKYpIJezwSo2CEnISkLeYfYHv9t8b5K2-P69A,2687
1
+ dragon_ml_toolbox-14.3.1.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
+ dragon_ml_toolbox-14.3.1.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=gkOdNDbKYpIJezwSo2CEnISkLeYfYHv9t8b5K2-P69A,2687
3
3
  ml_tools/ETL_cleaning.py,sha256=2VBRllV8F-ZiPylPp8Az2gwn5ztgazN0BH5OKnRUhV0,20402
4
4
  ml_tools/ETL_engineering.py,sha256=KfYqgsxupAx6e_TxwO1LZXeu5mFkIhVXJrNjP3CzIZc,54927
5
5
  ml_tools/GUI_tools.py,sha256=Va6ig-dHULPVRwQYYtH3fvY5XPIoqRcJpRW8oXC55Hw,45413
@@ -15,7 +15,7 @@ ml_tools/ML_optimization.py,sha256=P0zkhKAwTpkorIBtR0AOIDcyexo5ngmvFUzo3DfNO-E,2
15
15
  ml_tools/ML_scaler.py,sha256=tw6onj9o8_kk3FQYb930HUzvv1zsFZe2YZJdF3LtHkU,7538
16
16
  ml_tools/ML_trainer.py,sha256=ZWI4MbUcLeBxyfoUTL96l5tjHHMp9I64h4SdXnjYmBE,49795
17
17
  ml_tools/ML_utilities.py,sha256=z6LbpbZwhn8F__fWlKi-g-cAJQXSxwg1NHfC5FBoAyc,21139
18
- ml_tools/ML_vision_datasetmaster.py,sha256=feFNUBjybzVJJrdyqToQ_mLV1uDJXHkNL0tmn_zofSY,56034
18
+ ml_tools/ML_vision_datasetmaster.py,sha256=2S7stCgGQX39Y38gfMQccwAx_QTKEmmRIqh4XJ2K_YE,58041
19
19
  ml_tools/ML_vision_evaluation.py,sha256=t12R7i1RkOCt9zu1_lxSBr8OH6A6Get0k8ftDLctn6I,10486
20
20
  ml_tools/ML_vision_inference.py,sha256=He3KV3VJAm8PwO-fOq4b9VO8UXFr-GmpuCnoHXf4VZI,20588
21
21
  ml_tools/ML_vision_models.py,sha256=G3S4jB9AE9wMpU9ZygOgOx9q1K6t6LAXBYcJ-U2XQ1M,25600
@@ -42,7 +42,7 @@ ml_tools/optimization_tools.py,sha256=TYFQ2nSnp7xxs-VyoZISWgnGJghFbsWasHjruegyJR
42
42
  ml_tools/path_manager.py,sha256=CyDU16pOKmC82jPubqJPT6EBt-u-3rGVbxyPIZCvDDY,18432
43
43
  ml_tools/serde.py,sha256=c8uDYjYry_VrLvoG4ixqDj5pij88lVn6Tu4NHcPkwDU,6943
44
44
  ml_tools/utilities.py,sha256=aWqvYzmxlD74PD5Yqu1VuTekDJeYLQrmPIU_VeVyRp0,22526
45
- dragon_ml_toolbox-14.3.0.dist-info/METADATA,sha256=TeVrfmCt4AVSweSN4Ai0yyZCJMQtSD1MHsUoEQHXLg4,6475
46
- dragon_ml_toolbox-14.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
- dragon_ml_toolbox-14.3.0.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
48
- dragon_ml_toolbox-14.3.0.dist-info/RECORD,,
45
+ dragon_ml_toolbox-14.3.1.dist-info/METADATA,sha256=dNN-vygEF2WikswJ-6XCShUDf3rD2-XRNtz0vvRg2-4,6475
46
+ dragon_ml_toolbox-14.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
+ dragon_ml_toolbox-14.3.1.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
48
+ dragon_ml_toolbox-14.3.1.dist-info/RECORD,,
@@ -10,6 +10,7 @@ import torchvision.transforms.functional as TF
10
10
  from pathlib import Path
11
11
  import random
12
12
  import json
13
+ import inspect
13
14
 
14
15
  from .ML_datasetmaster import _BaseMaker
15
16
  from .path_manager import make_fullpath
@@ -411,16 +412,58 @@ class VisionDatasetMaker(_BaseMaker):
411
412
  # validate path
412
413
  file_path = make_fullpath(filepath, make=True, enforce="file")
413
414
 
414
- # 1. Handle pre_transforms
415
+ # Handle pre_transforms
415
416
  for t in components[VisionTransformRecipeKeys.PRE_TRANSFORMS]:
416
417
  t_name = t.__class__.__name__
418
+ t_class = t.__class__
419
+ kwargs = {}
420
+
421
+ # 1. Check custom registry first
417
422
  if t_name in TRANSFORM_REGISTRY:
418
- recipe[VisionTransformRecipeKeys.PIPELINE].append({
419
- VisionTransformRecipeKeys.NAME: t_name,
420
- VisionTransformRecipeKeys.KWARGS: getattr(t, VisionTransformRecipeKeys.KWARGS, {})
421
- })
423
+ _LOGGER.debug(f"Found '{t_name}' in TRANSFORM_REGISTRY.")
424
+ kwargs = getattr(t, VisionTransformRecipeKeys.KWARGS, {})
425
+
426
+ # 2. Else, try to introspect for standard torchvision transforms
422
427
  else:
423
- _LOGGER.warning(f"Skipping unknown pre_transform '{t_name}' in recipe. Not in TRANSFORM_REGISTRY.")
428
+ _LOGGER.debug(f"'{t_name}' not in registry. Attempting introspection...")
429
+ try:
430
+ # Get the __init__ signature of the transform's class
431
+ sig = inspect.signature(t_class.__init__)
432
+
433
+ # Iterate over its __init__ parameters (e.g., 'num_output_channels')
434
+ for param in sig.parameters.values():
435
+ if param.name == 'self':
436
+ continue
437
+
438
+ # Check if the *instance* 't' has that parameter as an attribute
439
+ attr_name_public = param.name
440
+ attr_name_private = '_' + param.name
441
+
442
+ attr_to_get = ""
443
+
444
+ if hasattr(t, attr_name_public):
445
+ attr_to_get = attr_name_public
446
+ elif hasattr(t, attr_name_private):
447
+ attr_to_get = attr_name_private
448
+ else:
449
+ # Parameter in __init__ has no matching attribute
450
+ continue
451
+
452
+ # Store the value under the __init__ parameter's name
453
+ kwargs[param.name] = getattr(t, attr_to_get)
454
+
455
+ _LOGGER.debug(f"Introspection for '{t_name}' found kwargs: {kwargs}")
456
+
457
+ except (ValueError, TypeError):
458
+ # Fails on some built-ins or C-implemented __init__
459
+ _LOGGER.warning(f"Could not introspect parameters for '{t_name}'. If this transform has parameters, they will not be saved.")
460
+ kwargs = {}
461
+
462
+ # 3. Add to pipeline
463
+ recipe[VisionTransformRecipeKeys.PIPELINE].append({
464
+ VisionTransformRecipeKeys.NAME: t_name,
465
+ VisionTransformRecipeKeys.KWARGS: kwargs
466
+ })
424
467
 
425
468
  # 2. Add standard transforms
426
469
  recipe[VisionTransformRecipeKeys.PIPELINE].extend([