deepvisiontools 1.0.0__tar.gz → 1.0.2__tar.gz
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.
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/PKG-INFO +7 -2
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/README.md +5 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/pyproject.toml +1 -1
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/__init__.py +1 -1
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/datasets/base.py +374 -4
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/yolo/yolo.py +122 -26
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/yoloseg/yoloseg.py +69 -58
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/PKG-INFO +7 -2
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/requires.txt +1 -1
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/LICENSE.txt +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/setup.cfg +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/cli.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/config/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/config/config.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/data/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/data/data.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/data/data_registry.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/data/operators.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/data/ops_registry.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/datasets/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/datasets/additional_augmentations.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/datasets/coco_dataset.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/datasets/semantic_dataset.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/download_demo_datasets.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/download_tutorials.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/evaluation/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/evaluation/evaluator.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/evaluation/writers.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/nms.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/predictor.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/strategies/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/strategies/base.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/strategies/detection.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/strategies/instance.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/strategies/semantic.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/inference/tiling.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/install_dcnv3.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/accumulators.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/engines.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/factories.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/metrics_core.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/per_sample_engine.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/metrics/suites.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/base/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/base/basemodel.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/base/checkpoints.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/base/protocols.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/detector.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/detector_seg.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/backbones/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/backbones/backbones.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/commonblocks.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/headregistry.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/neckregistry.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/outputs.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/specs.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/commons/utils.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/config.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-base_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-base_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-base_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-huge_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-huge_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-huge_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-large_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-large_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_convnextv2-large_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-b-1k-224_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-b-1k-224_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-b-1k-224_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-h-22kto1k-640_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-h-22kto1k-640_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-h-22kto1k-640_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-xl-22kto1k-384_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-xl-22kto1k-384_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_detector_internimage-xl-22kto1k-384_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-base-patch16-dinov3_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-base-patch16-dinov3_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-base-patch16-dinov3_vfnet_stardcn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-giant-patch16-dinov3_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-giant-patch16-dinov3_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-huge-plus-patch16-dinov3_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/cocopretrained/default_tabdet_vit-huge-plus-patch16-dinov3_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/default_detector_cascade_maskrcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/default_detector_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/default_detector_vfnet.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/default_tabdet_cascade_rcnn.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/model_configs/default_tabdet_vfnet.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/config/yamlutils.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/facades/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/facades/detectors.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/facades/tabdets.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/heads/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/heads/headblocks.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/heads/heads.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/losses/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/losses/losses.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/losses/lossutils.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/necks/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/necks/neckblocks.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/necks/necks.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/tiling/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/models/tiling/tiling.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/tab_seg.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/detectors/tabdet.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/helpers/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/helpers/device_amp_helpers.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/helpers/preprocess_helpers.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/smp/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/smp/smp.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/yolo/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/models/yoloseg/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/configregistry.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-base_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-base_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-base_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-huge_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-huge_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-huge_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-large_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-large_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_convnextv2-large_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-b-1k-224_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-b-1k-224_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-b-1k-224_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-h-22kto1k-640_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-h-22kto1k-640_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-h-22kto1k-640_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-xl-22kto1k-384_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-xl-22kto1k-384_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/detector_internimage-xl-22kto1k-384_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-base-patch16-dinov3_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-base-patch16-dinov3_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-base-patch16-dinov3_vfnet_stardcn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-giant-patch16-gap-224_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-giant-patch16-gap-224_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-huge-plus-patch16-dinov3_cascade_maskrcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/detectors_cocopretrained/tabdet_vit-huge-plus-patch16-dinov3_cascade_rcnn_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/smp_unet_resnet50_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11l-seg_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11l_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11m-seg_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11m_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11n-seg_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11n_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11x-seg_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/availableconfigs/yolo11x_default_config.yaml +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/ema.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/hooks.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/llrd.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/loggers.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/optuna_wrapper.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/trainconfig.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/train/trainer.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/utils/__init__.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/utils/image_and_mask.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/utils/logging.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools/utils/preprocessing.py +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/SOURCES.txt +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/dependency_links.txt +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/entry_points.txt +0 -0
- {deepvisiontools-1.0.0 → deepvisiontools-1.0.2}/src/deepvisiontools.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepvisiontools
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: deepvisiontools is a library built on torch for training and inference processes for deep learning computer vision tasks.
|
|
5
5
|
Author-email: Lucas Bernigaud Samatan <lucas.bernigaud-samatan@inrae.fr>, Jordan Bernigaud Samatan <jordan.bernigaud-samatan@inrae.fr>
|
|
6
6
|
Maintainer-email: Jordan Bernigaud Samatan <jordan.bernigaud-samatan@inrae.fr>, Lucas Bernigaud Samatan <lucas.bernigaud-samatan@inrae.fr>
|
|
@@ -688,7 +688,7 @@ Requires-Dist: torch-tb-profiler<1.0,>=0.4.0
|
|
|
688
688
|
Requires-Dist: mlflow<4.0,>=3.1.0
|
|
689
689
|
Requires-Dist: fastapi!=0.136.3,<1.0
|
|
690
690
|
Requires-Dist: starlette<2.0,>=1.0.1
|
|
691
|
-
Requires-Dist: ultralytics<
|
|
691
|
+
Requires-Dist: ultralytics<8.5.0,>=8.3.28
|
|
692
692
|
Requires-Dist: transformers<6.0,>=5.0.0
|
|
693
693
|
Requires-Dist: colorcet<4.0,>=3.1.0
|
|
694
694
|
Requires-Dist: segmentation-models-pytorch<1.0,>=0.4.1
|
|
@@ -731,6 +731,11 @@ Dynamic: license-file
|
|
|
731
731
|
|
|
732
732
|
- *release 1.0.0: detector / detector-seg / tabdet / tabdet-seg model wrappers are heavy but powerful models for detection and instance segmentation. However, they are not fully pretrained (only backbone on imagenet). Therefore, on small datasets (< 1000 images ish, but depend on the dataset ...) they can be slightly less competitive than yolo models (also included in the library) that were fully pretrained on coco. We are currently pretraining some of the models but it takes time. We are goind to update the weights once done, so keep tuned for new releases. We suggest you always train a yolo model as well for a baseline comparison. However, on larger datasets they can significantly outperform yolo11x, but again it depends on the dataset ...*
|
|
733
733
|
|
|
734
|
+
### patchs
|
|
735
|
+
|
|
736
|
+
- *1.0.2: added option to concat datasets for deepvisiondataset (DeepVisionDataset.concat)*
|
|
737
|
+
- *1.0.1: fixed inconsistency for yolo wrappers due to modified behaviour in ultralytics between 8.3 and 8.4 versions. Fixed and compatible with both.*
|
|
738
|
+
|
|
734
739
|
## Scope
|
|
735
740
|
|
|
736
741
|
deepvisiontools is suitable for supervised learning computer vision tasks. Tasks currently available are:
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
- *release 1.0.0: detector / detector-seg / tabdet / tabdet-seg model wrappers are heavy but powerful models for detection and instance segmentation. However, they are not fully pretrained (only backbone on imagenet). Therefore, on small datasets (< 1000 images ish, but depend on the dataset ...) they can be slightly less competitive than yolo models (also included in the library) that were fully pretrained on coco. We are currently pretraining some of the models but it takes time. We are goind to update the weights once done, so keep tuned for new releases. We suggest you always train a yolo model as well for a baseline comparison. However, on larger datasets they can significantly outperform yolo11x, but again it depends on the dataset ...*
|
|
16
16
|
|
|
17
|
+
### patchs
|
|
18
|
+
|
|
19
|
+
- *1.0.2: added option to concat datasets for deepvisiondataset (DeepVisionDataset.concat)*
|
|
20
|
+
- *1.0.1: fixed inconsistency for yolo wrappers due to modified behaviour in ultralytics between 8.3 and 8.4 versions. Fixed and compatible with both.*
|
|
21
|
+
|
|
17
22
|
## Scope
|
|
18
23
|
|
|
19
24
|
deepvisiontools is suitable for supervised learning computer vision tasks. Tasks currently available are:
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import warnings
|
|
4
4
|
from collections.abc import Callable, Sequence
|
|
5
|
+
from copy import deepcopy
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import Any, Literal, Protocol, cast
|
|
7
8
|
|
|
@@ -334,6 +335,7 @@ class DeepVisionDataset(Dataset):
|
|
|
334
335
|
- You can call the `keep_indices` method to keep only the selected indexes
|
|
335
336
|
- You can modify the writer using the property `writer` so the `export` method returns the provided format. Note that you may need to modify the cast_to attribute to match writer requirements
|
|
336
337
|
- You can `export` a (sub)dataset to save a split and (optionally) visualizations. Caution to set preprocessing/augmentation to None if you want original images before normalization.
|
|
338
|
+
- You can concat multiple DeepVisionDatasets (including subsets etc.) using the concat static method.
|
|
337
339
|
|
|
338
340
|
???+ example "Usage"
|
|
339
341
|
```Python
|
|
@@ -581,11 +583,11 @@ class DeepVisionDataset(Dataset):
|
|
|
581
583
|
def set_writer(self, writer: AnnotationWriter) -> None:
|
|
582
584
|
self.writer = writer
|
|
583
585
|
|
|
584
|
-
def to_data_type(self, dst_key: str) ->
|
|
586
|
+
def to_data_type(self, dst_key: str) -> DeepVisionDataset:
|
|
585
587
|
"""Return a view that converts every sample's target to `dst_key` lazily."""
|
|
586
588
|
return DeepVisionSubDataset(self, cast_to=dst_key)
|
|
587
589
|
|
|
588
|
-
def split(self, proportions: Sequence[float]) -> list[
|
|
590
|
+
def split(self, proportions: Sequence[float]) -> list[DeepVisionDataset]:
|
|
589
591
|
"""
|
|
590
592
|
Randomly split the current dataset view into sub-views.
|
|
591
593
|
|
|
@@ -604,7 +606,7 @@ class DeepVisionDataset(Dataset):
|
|
|
604
606
|
n = len(positions)
|
|
605
607
|
cuts = [round(p * n) for p in proportions]
|
|
606
608
|
|
|
607
|
-
out: list[
|
|
609
|
+
out: list[DeepVisionDataset] = []
|
|
608
610
|
start = 0
|
|
609
611
|
for c in cuts[:-1]:
|
|
610
612
|
out.append(DeepVisionSubDataset(self, indices=positions[start : start + c]))
|
|
@@ -616,7 +618,7 @@ class DeepVisionDataset(Dataset):
|
|
|
616
618
|
def keep_indices(
|
|
617
619
|
self,
|
|
618
620
|
indices: list[int] | torch.Tensor | slice,
|
|
619
|
-
) ->
|
|
621
|
+
) -> DeepVisionDataset:
|
|
620
622
|
"""
|
|
621
623
|
Keep a subset of samples from the current dataset view.
|
|
622
624
|
|
|
@@ -735,6 +737,26 @@ class DeepVisionDataset(Dataset):
|
|
|
735
737
|
|
|
736
738
|
return image, target, img_name
|
|
737
739
|
|
|
740
|
+
@staticmethod
|
|
741
|
+
def concat(
|
|
742
|
+
datasets: Sequence[DeepVisionDataset],
|
|
743
|
+
writer: AnnotationWriter | str | None = None,
|
|
744
|
+
*,
|
|
745
|
+
prefix_names: bool = True,
|
|
746
|
+
) -> DeepVisionConcatDataset:
|
|
747
|
+
"""
|
|
748
|
+
Concatenate several DeepVisionDataset views into one DeepVision-compatible view.
|
|
749
|
+
|
|
750
|
+
The returned dataset can be indexed, split, loaded with DeepVisionLoader,
|
|
751
|
+
and exported with the configured writer. Input datasets are deep-copied so
|
|
752
|
+
later edits on the concatenated view do not mutate the original datasets.
|
|
753
|
+
"""
|
|
754
|
+
return DeepVisionConcatDataset(
|
|
755
|
+
datasets,
|
|
756
|
+
writer=writer,
|
|
757
|
+
prefix_names=prefix_names,
|
|
758
|
+
)
|
|
759
|
+
|
|
738
760
|
|
|
739
761
|
class DeepVisionSubDataset(DeepVisionDataset):
|
|
740
762
|
"""A thin view over a base dataset with its own index list and optional cast override."""
|
|
@@ -772,6 +794,354 @@ class DeepVisionSubDataset(DeepVisionDataset):
|
|
|
772
794
|
self.cast_to = cast_to
|
|
773
795
|
|
|
774
796
|
|
|
797
|
+
class DeepVisionConcatDataset(DeepVisionDataset):
|
|
798
|
+
"""
|
|
799
|
+
Concatenation view over several DeepVisionDataset instances.
|
|
800
|
+
Modifying preprocessing, augmentation etc. property modifies internal
|
|
801
|
+
deepcopies of the composition datasets.
|
|
802
|
+
|
|
803
|
+
Args:
|
|
804
|
+
datasets: Dataset views to concatenate. DeepVisionSubDataset instances are
|
|
805
|
+
supported.
|
|
806
|
+
writer: Optional writer used by export. If None, a deep copy of the first
|
|
807
|
+
child dataset writer is used.
|
|
808
|
+
prefix_names: Prefix returned image names with the child dataset index.
|
|
809
|
+
This is recommended to avoid filename collisions during export.
|
|
810
|
+
indices: Optional global indices used internally for concat sub-views.
|
|
811
|
+
"""
|
|
812
|
+
|
|
813
|
+
def __init__(
|
|
814
|
+
self,
|
|
815
|
+
datasets: Sequence[DeepVisionDataset],
|
|
816
|
+
writer: AnnotationWriter | str | None = None,
|
|
817
|
+
*,
|
|
818
|
+
prefix_names: bool = True,
|
|
819
|
+
indices: Sequence[int] | None = None,
|
|
820
|
+
) -> None:
|
|
821
|
+
if len(datasets) == 0:
|
|
822
|
+
raise ValueError("DeepVisionConcatDataset requires at least one dataset.")
|
|
823
|
+
|
|
824
|
+
self._validate_compatible_datasets(datasets)
|
|
825
|
+
self._warn_if_runtime_transforms_differ(datasets)
|
|
826
|
+
|
|
827
|
+
self.datasets = [deepcopy(dataset) for dataset in datasets]
|
|
828
|
+
self.prefix_names = bool(prefix_names)
|
|
829
|
+
|
|
830
|
+
self._cumulative_sizes = self._build_cumulative_sizes(self.datasets)
|
|
831
|
+
self._cat_ids = dict(self.datasets[0].category_ids)
|
|
832
|
+
self._declared_reader_type = self.datasets[0]._effective_type()
|
|
833
|
+
|
|
834
|
+
# Compatibility attributes. They are not used for loading by this class,
|
|
835
|
+
# but keeping them available makes the object behave like a DeepVisionDataset.
|
|
836
|
+
self.root = self.datasets[0].root
|
|
837
|
+
self.image_dir = self.datasets[0].image_dir
|
|
838
|
+
self.reader = self.datasets[0].reader
|
|
839
|
+
|
|
840
|
+
self._scan = self._build_scan()
|
|
841
|
+
|
|
842
|
+
total_length = self._cumulative_sizes[-1]
|
|
843
|
+
if indices is None:
|
|
844
|
+
self._indices = list(range(total_length))
|
|
845
|
+
else:
|
|
846
|
+
self._indices = self._normalize_global_indices(indices, total_length)
|
|
847
|
+
|
|
848
|
+
self._writer: AnnotationWriter | None = None
|
|
849
|
+
if writer is None:
|
|
850
|
+
first_writer = self.datasets[0].writer
|
|
851
|
+
self.writer = deepcopy(first_writer) if first_writer is not None else None
|
|
852
|
+
else:
|
|
853
|
+
self.writer = writer
|
|
854
|
+
|
|
855
|
+
@staticmethod
|
|
856
|
+
def _build_cumulative_sizes(
|
|
857
|
+
datasets: Sequence[DeepVisionDataset],
|
|
858
|
+
) -> list[int]:
|
|
859
|
+
cumulative_sizes: list[int] = []
|
|
860
|
+
total = 0
|
|
861
|
+
|
|
862
|
+
for dataset in datasets:
|
|
863
|
+
total += len(dataset)
|
|
864
|
+
cumulative_sizes.append(total)
|
|
865
|
+
|
|
866
|
+
return cumulative_sizes
|
|
867
|
+
|
|
868
|
+
@staticmethod
|
|
869
|
+
def _category_label_ids(dataset: DeepVisionDataset) -> tuple[int, ...]:
|
|
870
|
+
return tuple(sorted(int(label_id) for label_id in dataset.category_ids))
|
|
871
|
+
|
|
872
|
+
@classmethod
|
|
873
|
+
def _validate_compatible_datasets(
|
|
874
|
+
cls,
|
|
875
|
+
datasets: Sequence[DeepVisionDataset],
|
|
876
|
+
) -> None:
|
|
877
|
+
first = datasets[0]
|
|
878
|
+
first_type = first._effective_type()
|
|
879
|
+
first_labels = cls._category_label_ids(first)
|
|
880
|
+
first_device = first.device
|
|
881
|
+
|
|
882
|
+
for dataset_index, dataset in enumerate(datasets[1:], start=1):
|
|
883
|
+
data_type = dataset._effective_type()
|
|
884
|
+
if data_type != first_type:
|
|
885
|
+
raise ValueError(
|
|
886
|
+
"Cannot concatenate datasets with different effective data types: "
|
|
887
|
+
f"dataset 0 has {first_type!r}, "
|
|
888
|
+
f"dataset {dataset_index} has {data_type!r}."
|
|
889
|
+
)
|
|
890
|
+
|
|
891
|
+
if dataset.device != first_device:
|
|
892
|
+
raise ValueError(
|
|
893
|
+
"Cannot concatenate datasets on different devices: "
|
|
894
|
+
f"dataset 0 has {first_device!r}, "
|
|
895
|
+
f"dataset {dataset_index} has {dataset.device!r}."
|
|
896
|
+
)
|
|
897
|
+
|
|
898
|
+
labels = cls._category_label_ids(dataset)
|
|
899
|
+
if labels != first_labels:
|
|
900
|
+
raise ValueError(
|
|
901
|
+
"Cannot concatenate datasets with different category label ids: "
|
|
902
|
+
f"dataset 0 has {first_labels}, "
|
|
903
|
+
f"dataset {dataset_index} has {labels}. "
|
|
904
|
+
"Only label ids are checked; category names are assumed to be "
|
|
905
|
+
"semantically consistent by the user."
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
@staticmethod
|
|
909
|
+
def _preprocessing_signature(preprocessing: Callable | None) -> str:
|
|
910
|
+
if preprocessing is None:
|
|
911
|
+
return "None"
|
|
912
|
+
|
|
913
|
+
module = getattr(preprocessing, "__module__", "")
|
|
914
|
+
qualname = getattr(preprocessing, "__qualname__", "")
|
|
915
|
+
if module or qualname:
|
|
916
|
+
return f"{module}.{qualname}"
|
|
917
|
+
|
|
918
|
+
return repr(preprocessing)
|
|
919
|
+
|
|
920
|
+
@staticmethod
|
|
921
|
+
def _augmentation_signature(augmentation: Sequence[Transform]) -> tuple[str, ...]:
|
|
922
|
+
return tuple(repr(transform) for transform in augmentation)
|
|
923
|
+
|
|
924
|
+
@classmethod
|
|
925
|
+
def _warn_if_runtime_transforms_differ(
|
|
926
|
+
cls,
|
|
927
|
+
datasets: Sequence[DeepVisionDataset],
|
|
928
|
+
) -> None:
|
|
929
|
+
first_preprocessing = cls._preprocessing_signature(datasets[0].preprocessing)
|
|
930
|
+
first_augmentation = cls._augmentation_signature(datasets[0].augmentation)
|
|
931
|
+
|
|
932
|
+
different_preprocessing = any(
|
|
933
|
+
cls._preprocessing_signature(dataset.preprocessing) != first_preprocessing
|
|
934
|
+
for dataset in datasets[1:]
|
|
935
|
+
)
|
|
936
|
+
different_augmentation = any(
|
|
937
|
+
cls._augmentation_signature(dataset.augmentation) != first_augmentation
|
|
938
|
+
for dataset in datasets[1:]
|
|
939
|
+
)
|
|
940
|
+
|
|
941
|
+
if different_preprocessing:
|
|
942
|
+
warnings.warn(
|
|
943
|
+
"DeepVisionConcatDataset received datasets with different "
|
|
944
|
+
"preprocessing callables. This is allowed, but samples from "
|
|
945
|
+
"different child datasets will be preprocessed differently unless "
|
|
946
|
+
"you reassign concat_dataset.preprocessing.",
|
|
947
|
+
UserWarning,
|
|
948
|
+
stacklevel=3,
|
|
949
|
+
)
|
|
950
|
+
|
|
951
|
+
if different_augmentation:
|
|
952
|
+
warnings.warn(
|
|
953
|
+
"DeepVisionConcatDataset received datasets with different "
|
|
954
|
+
"augmentation pipelines. This is allowed, but samples from "
|
|
955
|
+
"different child datasets will be augmented differently unless "
|
|
956
|
+
"you reassign concat_dataset.augmentation.",
|
|
957
|
+
UserWarning,
|
|
958
|
+
stacklevel=3,
|
|
959
|
+
)
|
|
960
|
+
|
|
961
|
+
def _build_scan(self) -> list[str]:
|
|
962
|
+
names: list[str] = []
|
|
963
|
+
|
|
964
|
+
for dataset_index, dataset in enumerate(self.datasets):
|
|
965
|
+
for local_index in range(len(dataset)):
|
|
966
|
+
base_index = dataset._indices[local_index]
|
|
967
|
+
image_name = dataset._scan[base_index]
|
|
968
|
+
names.append(self._format_image_name(dataset_index, image_name))
|
|
969
|
+
|
|
970
|
+
return names
|
|
971
|
+
|
|
972
|
+
@staticmethod
|
|
973
|
+
def _normalize_global_indices(
|
|
974
|
+
indices: Sequence[int],
|
|
975
|
+
total_length: int,
|
|
976
|
+
) -> list[int]:
|
|
977
|
+
out: list[int] = []
|
|
978
|
+
|
|
979
|
+
for index in indices:
|
|
980
|
+
ii = int(index)
|
|
981
|
+
if ii < 0:
|
|
982
|
+
ii += total_length
|
|
983
|
+
if ii < 0 or ii >= total_length:
|
|
984
|
+
raise IndexError(
|
|
985
|
+
f"Concat index {index} is out of range for dataset "
|
|
986
|
+
f"of length {total_length}."
|
|
987
|
+
)
|
|
988
|
+
out.append(ii)
|
|
989
|
+
|
|
990
|
+
return out
|
|
991
|
+
|
|
992
|
+
@property
|
|
993
|
+
def preprocessing(self) -> Callable | None:
|
|
994
|
+
return self.datasets[0].preprocessing
|
|
995
|
+
|
|
996
|
+
@preprocessing.setter
|
|
997
|
+
def preprocessing(self, preprocessing: Callable | None) -> None:
|
|
998
|
+
for dataset in self.datasets:
|
|
999
|
+
dataset.preprocessing = preprocessing
|
|
1000
|
+
|
|
1001
|
+
@property
|
|
1002
|
+
def augmentation(self) -> list[Transform]:
|
|
1003
|
+
return self.datasets[0].augmentation
|
|
1004
|
+
|
|
1005
|
+
@augmentation.setter
|
|
1006
|
+
def augmentation(self, augmentation: list[Transform] | None) -> None:
|
|
1007
|
+
normalized = augmentation or []
|
|
1008
|
+
for dataset in self.datasets:
|
|
1009
|
+
dataset.augmentation = list(normalized)
|
|
1010
|
+
|
|
1011
|
+
@property
|
|
1012
|
+
def device(self) -> str:
|
|
1013
|
+
return self.datasets[0].device
|
|
1014
|
+
|
|
1015
|
+
@device.setter
|
|
1016
|
+
def device(self, device: str) -> None:
|
|
1017
|
+
for dataset in self.datasets:
|
|
1018
|
+
dataset.device = device
|
|
1019
|
+
|
|
1020
|
+
@property
|
|
1021
|
+
def cast_to(self) -> str | None:
|
|
1022
|
+
return self.datasets[0].cast_to
|
|
1023
|
+
|
|
1024
|
+
@cast_to.setter
|
|
1025
|
+
def cast_to(self, cast_to: str | None) -> None:
|
|
1026
|
+
for dataset in self.datasets:
|
|
1027
|
+
dataset.cast_to = cast_to
|
|
1028
|
+
|
|
1029
|
+
@property
|
|
1030
|
+
def data_type(self) -> str:
|
|
1031
|
+
return self._effective_type()
|
|
1032
|
+
|
|
1033
|
+
def _effective_type(self) -> str:
|
|
1034
|
+
return self.cast_to or self._declared_reader_type or self.reader.out_type
|
|
1035
|
+
|
|
1036
|
+
def to_data_type(self, dst_key: str) -> DeepVisionConcatDataset:
|
|
1037
|
+
"""Return a concat view that converts every sample's target to dst_key lazily."""
|
|
1038
|
+
out = self.keep_indices(slice(0, len(self)))
|
|
1039
|
+
out.cast_to = dst_key
|
|
1040
|
+
return out
|
|
1041
|
+
|
|
1042
|
+
def split(self, proportions: Sequence[float]) -> list[DeepVisionDataset]:
|
|
1043
|
+
"""
|
|
1044
|
+
Randomly split the current concat view into concat sub-views.
|
|
1045
|
+
|
|
1046
|
+
Indices are interpreted relative to the current concat view.
|
|
1047
|
+
"""
|
|
1048
|
+
s = sum(proportions)
|
|
1049
|
+
assert round(s, 6) == 1.0, f"Split proportions must sum to 1, got {proportions}"
|
|
1050
|
+
|
|
1051
|
+
import random
|
|
1052
|
+
|
|
1053
|
+
positions = list(range(len(self)))
|
|
1054
|
+
random.shuffle(positions)
|
|
1055
|
+
|
|
1056
|
+
n = len(positions)
|
|
1057
|
+
cuts = [round(p * n) for p in proportions]
|
|
1058
|
+
|
|
1059
|
+
out: list[DeepVisionDataset] = []
|
|
1060
|
+
start = 0
|
|
1061
|
+
|
|
1062
|
+
for c in cuts[:-1]:
|
|
1063
|
+
out.append(self.keep_indices(positions[start : start + c]))
|
|
1064
|
+
start += c
|
|
1065
|
+
|
|
1066
|
+
out.append(self.keep_indices(positions[start:]))
|
|
1067
|
+
return out
|
|
1068
|
+
|
|
1069
|
+
def keep_indices(
|
|
1070
|
+
self,
|
|
1071
|
+
indices: list[int] | torch.Tensor | slice,
|
|
1072
|
+
) -> DeepVisionConcatDataset:
|
|
1073
|
+
"""
|
|
1074
|
+
Keep a subset of samples from the current concat view.
|
|
1075
|
+
|
|
1076
|
+
The provided indices are positions relative to this concat view, not raw
|
|
1077
|
+
child-dataset indices.
|
|
1078
|
+
"""
|
|
1079
|
+
if isinstance(indices, torch.Tensor):
|
|
1080
|
+
if indices.ndim != 1:
|
|
1081
|
+
raise ValueError(f"indices must be a 1-D tensor, got {indices.shape}")
|
|
1082
|
+
index_list = [int(i) for i in indices.tolist()]
|
|
1083
|
+
elif isinstance(indices, slice):
|
|
1084
|
+
index_list = list(range(len(self)))[indices]
|
|
1085
|
+
else:
|
|
1086
|
+
index_list = [int(i) for i in indices]
|
|
1087
|
+
|
|
1088
|
+
selected_global_indices: list[int] = []
|
|
1089
|
+
|
|
1090
|
+
for index in index_list:
|
|
1091
|
+
ii = int(index)
|
|
1092
|
+
if ii < 0:
|
|
1093
|
+
ii += len(self)
|
|
1094
|
+
if ii < 0 or ii >= len(self):
|
|
1095
|
+
raise IndexError(
|
|
1096
|
+
f"Index {index} is out of range for concat view "
|
|
1097
|
+
f"of length {len(self)}."
|
|
1098
|
+
)
|
|
1099
|
+
selected_global_indices.append(self._indices[ii])
|
|
1100
|
+
|
|
1101
|
+
return DeepVisionConcatDataset(
|
|
1102
|
+
self.datasets,
|
|
1103
|
+
writer=deepcopy(self.writer),
|
|
1104
|
+
prefix_names=self.prefix_names,
|
|
1105
|
+
indices=selected_global_indices,
|
|
1106
|
+
)
|
|
1107
|
+
|
|
1108
|
+
def _locate_global_index(self, global_index: int) -> tuple[int, int]:
|
|
1109
|
+
previous_size = 0
|
|
1110
|
+
|
|
1111
|
+
for dataset_index, cumulative_size in enumerate(self._cumulative_sizes):
|
|
1112
|
+
if global_index < cumulative_size:
|
|
1113
|
+
local_index = global_index - previous_size
|
|
1114
|
+
return dataset_index, local_index
|
|
1115
|
+
|
|
1116
|
+
previous_size = cumulative_size
|
|
1117
|
+
|
|
1118
|
+
raise RuntimeError("Failed to locate sample in DeepVisionConcatDataset.")
|
|
1119
|
+
|
|
1120
|
+
def _format_image_name(self, dataset_index: int, image_name: str) -> str:
|
|
1121
|
+
if not self.prefix_names:
|
|
1122
|
+
return image_name
|
|
1123
|
+
|
|
1124
|
+
return f"dataset_{dataset_index}__{image_name}"
|
|
1125
|
+
|
|
1126
|
+
def __len__(self) -> int:
|
|
1127
|
+
return len(self._indices)
|
|
1128
|
+
|
|
1129
|
+
def __getitem__(self, index: int) -> tuple[torch.Tensor, BaseData, str]:
|
|
1130
|
+
if index < 0:
|
|
1131
|
+
index += len(self)
|
|
1132
|
+
|
|
1133
|
+
if index < 0 or index >= len(self):
|
|
1134
|
+
raise IndexError(
|
|
1135
|
+
f"Index {index} is out of range for concat view of length {len(self)}."
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
global_index = self._indices[index]
|
|
1139
|
+
dataset_index, local_index = self._locate_global_index(global_index)
|
|
1140
|
+
|
|
1141
|
+
image, target, image_name = self.datasets[dataset_index][local_index]
|
|
1142
|
+
return image, target, self._format_image_name(dataset_index, image_name)
|
|
1143
|
+
|
|
1144
|
+
|
|
775
1145
|
def _pad_to(img: torch.Tensor, target_shape: tuple[int, int]) -> torch.Tensor:
|
|
776
1146
|
tarh, tarw = target_shape
|
|
777
1147
|
h, w = img.shape[-2:]
|