datamint 2.47.0__tar.gz → 2.48.0__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.
- {datamint-2.47.0 → datamint-2.48.0}/PKG-INFO +1 -1
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/resources_api.py +1 -1
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_import.py +11 -1
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/_common.py +21 -8
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/_detect.py +41 -11
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/yolo.py +81 -53
- {datamint-2.47.0 → datamint-2.48.0}/pyproject.toml +1 -1
- {datamint-2.47.0 → datamint-2.48.0}/README.md +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/__main__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/_repr_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/base_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/client.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/dto/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/dto/annotation_dto.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/dto/inference_prompts.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/dto/save_results_options.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/annotations_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/annotationsets_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/datasetsinfo_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/deploy_model_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/inference_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/model_types.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/models_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/pod_logs_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/projects_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/users_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/endpoints/validation_studies_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/api/entity_base_api.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_config.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_download.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_example.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_inference.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_init.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_train.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/client_cmd_tools/datamint_upload.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/configs.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/annotation_processor.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/base.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/factory.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/image_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/multiframe_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/sliced_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/sliced_video_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/split_result.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/video_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/dataset/volume_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/default_project.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotation_worklist.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/annotation_spec.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/base_geometry.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/base_segmentation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/box_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/category_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/geometry.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/image_classification.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/image_segmentation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/label_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/line_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/numeric_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/point_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/region_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/text_annotation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/types.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/annotations/volume_segmentation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/base_entity.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/buildlog.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/cache_manager.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/channel.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/datasetinfo.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/deployjob.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/inferencejob.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/pod.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/project.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/project_resource_split.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/dicom_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/image_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/nifti_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/video_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/resources/volume_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/sliced_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/sliced_resource_base.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/sliced_video_resource.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/user.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/entities/validation_study.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/evaluator.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/metrics/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/metrics/classification.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/metrics/detection.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/evaluate/metrics/segmentation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/_common.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/_download.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/bccd_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/busi_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/example_projects.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/fracatlas_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/examples/synapse_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/exceptions.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/coco.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/importers/pascal_voc.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/benchmark.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/datamodule.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/base_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/classification_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/detection_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/base.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/classification_module.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/detection_modules/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/detection_modules/yolox_module.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_module.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/deeplabv3plus.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/smp_module.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/transunet.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/unetpp.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/segmentation_modules/unetrpp.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/seg2d_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/seg3d_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/segmentation_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/deeplabv3plus.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/efficientnetv2.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/_nnunet_trainer_bridge.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/data_export.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/data_import.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/inference_model.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/transunet.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/unetpp.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/unetrpp.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/yolox.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/vol_seg_trainer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/logging.yaml +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/artifact/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/artifact/datamint_artifacts_repo.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/data/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/data/datamint_dataset.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/env_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/env_vars.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/annotation_specs.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/datamint_flavor.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/model.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/model_loader.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/model_parser.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/prediction_modes.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/prediction_router.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/task_type.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/flavors/validation.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/lightning/callbacks/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/lightning/callbacks/modelcheckpoint.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/Dockerfile.template +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/__init__.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/datamint_model_store.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/docker_build.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/local_inference.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/serve.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/models/tags.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/store_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/tracking/datamint_store.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/tracking/default_experiment.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/tracking/fluent.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/mlflow/tracking/offline_buffer.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/types.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/annotation_agreement.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/collection_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/date_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/env.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/logging_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/nifti_utils.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/torchmetrics.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/uncertainty.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/urls.py +0 -0
- {datamint-2.47.0 → datamint-2.48.0}/datamint/utils/visualization.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datamint
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.48.0
|
|
4
4
|
Summary: A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows.
|
|
5
5
|
Keywords: medical-imaging,dicom,nifti,pytorch,mlflow,lightning,datasets,annotation
|
|
6
6
|
Author: SonanceAI
|
|
@@ -637,7 +637,7 @@ class ResourcesApi(CreatableEntityApi[Resource], DeletableEntityApi[Resource]):
|
|
|
637
637
|
await self.annotations_api._upload_segmentations_async(
|
|
638
638
|
resource_id,
|
|
639
639
|
file_path=f,
|
|
640
|
-
name=name,
|
|
640
|
+
name=self.annotations_api.standardize_segmentation_names(name),
|
|
641
641
|
frame_index=frame_index,
|
|
642
642
|
transpose_segmentation=transpose_segmentation,
|
|
643
643
|
model_id=model_name,
|
|
@@ -132,7 +132,8 @@ def _resolve_dataset(args: argparse.Namespace) -> tuple[DatasetFormat, dict]:
|
|
|
132
132
|
|
|
133
133
|
_USER_LOGGER.info(f"Detected a {fmt.upper()} dataset under '{path}':")
|
|
134
134
|
for key, value in base_kwargs.items():
|
|
135
|
-
|
|
135
|
+
for v in (value if isinstance(value, list) else [value]):
|
|
136
|
+
_USER_LOGGER.info(f' {key}: {v}')
|
|
136
137
|
if not args.yes:
|
|
137
138
|
answer = input(f'Import as {fmt.upper()}? (y/n): ')
|
|
138
139
|
if answer.strip().lower() != 'y':
|
|
@@ -161,6 +162,15 @@ def _resolve_dataset(args: argparse.Namespace) -> tuple[DatasetFormat, dict]:
|
|
|
161
162
|
f'Pass {flags} explicitly.'
|
|
162
163
|
)
|
|
163
164
|
|
|
165
|
+
if fmt == 'yolo':
|
|
166
|
+
n_images, n_labels = (len(v) if isinstance(v, list) else 1
|
|
167
|
+
for v in (base_kwargs['images_dir'], base_kwargs['labels_dir']))
|
|
168
|
+
if n_images != n_labels:
|
|
169
|
+
raise DatamintException(
|
|
170
|
+
f'Detected {max(n_images, n_labels)} YOLO splits under \'{path}\', so a single '
|
|
171
|
+
'--images-dir or --labels-dir is ambiguous. Pass both --images-dir and --labels-dir.'
|
|
172
|
+
)
|
|
173
|
+
|
|
164
174
|
return fmt, base_kwargs
|
|
165
175
|
|
|
166
176
|
|
|
@@ -19,12 +19,14 @@ def import_boxes_to_project(result,
|
|
|
19
19
|
imported_from: str,
|
|
20
20
|
on_error: Literal['raise', 'skip'],
|
|
21
21
|
progress_bar: bool,
|
|
22
|
-
result_cls: type
|
|
22
|
+
result_cls: type,
|
|
23
|
+
sample_tags: Callable[[object], Sequence[str]] | None = None):
|
|
23
24
|
"""Shared upload loop behind every ``*Importer.import_to_project()``.
|
|
24
25
|
|
|
25
26
|
``result`` is a parse result with ``samples``, ``missing_images``, and
|
|
26
27
|
``unsupported_annotations`` attributes. ``box_points`` maps a format's box
|
|
27
28
|
dataclass to a ``(point1, point2)`` pair for ``add_box_annotation``.
|
|
29
|
+
``sample_tags`` gives extra tags per sample (e.g. its split), added to ``tags``.
|
|
28
30
|
|
|
29
31
|
"""
|
|
30
32
|
api = api or Api()
|
|
@@ -37,13 +39,24 @@ def import_boxes_to_project(result,
|
|
|
37
39
|
f'unsupported annotation type (e.g. polygon/segmentation) and were not '
|
|
38
40
|
f'imported; only bounding boxes are supported.')
|
|
39
41
|
|
|
40
|
-
uploaded
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
42
|
+
# upload_resources applies one tag list to all files, so samples are uploaded in groups of equal tags
|
|
43
|
+
groups: dict[tuple[str, ...], list[int]] = {}
|
|
44
|
+
for i, sample in enumerate(result.samples):
|
|
45
|
+
extra = tuple(sample_tags(sample)) if sample_tags is not None else ()
|
|
46
|
+
groups.setdefault(extra, []).append(i)
|
|
47
|
+
|
|
48
|
+
uploaded: list = [None] * len(result.samples)
|
|
49
|
+
for extra, idxs in groups.items():
|
|
50
|
+
group_tags = list(tags or []) + list(extra)
|
|
51
|
+
group_ids = api.resources.upload_resources(
|
|
52
|
+
[str(result.samples[i].image_path) for i in idxs],
|
|
53
|
+
tags=group_tags or None,
|
|
54
|
+
publish_to=project,
|
|
55
|
+
on_error=on_error,
|
|
56
|
+
progress_bar=progress_bar,
|
|
57
|
+
)
|
|
58
|
+
for i, resource_id in zip(idxs, group_ids):
|
|
59
|
+
uploaded[i] = resource_id
|
|
47
60
|
|
|
48
61
|
resource_ids: list[str] = []
|
|
49
62
|
errors: list[tuple[str, Exception]] = []
|
|
@@ -15,6 +15,7 @@ from typing import Literal
|
|
|
15
15
|
DatasetFormat = Literal['coco', 'yolo', 'pascal_voc']
|
|
16
16
|
|
|
17
17
|
_IMAGE_DIR_NAMES = {'images', 'image', 'imgs', 'jpegimages', 'img'}
|
|
18
|
+
_LABEL_DIR_NAMES = {'labels', 'label'}
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
@dataclass
|
|
@@ -22,7 +23,7 @@ class DetectedDataset:
|
|
|
22
23
|
"""Result of a format sniff: which format, and the constructor kwargs
|
|
23
24
|
to feed the matching ``*Importer``."""
|
|
24
25
|
format: DatasetFormat
|
|
25
|
-
importer_kwargs: dict[str, Path] = field(default_factory=dict)
|
|
26
|
+
importer_kwargs: dict[str, Path | list[Path]] = field(default_factory=dict)
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
def _find_dir(root: Path, names: set[str]) -> Path | None:
|
|
@@ -61,19 +62,48 @@ def sniff_pascal_voc(root: Path) -> DetectedDataset | None:
|
|
|
61
62
|
return None
|
|
62
63
|
|
|
63
64
|
|
|
65
|
+
def _is_yolo_labels_dir(path: Path) -> bool:
|
|
66
|
+
txt_paths = [p for p in sorted(path.glob('*.txt')) if p.name != 'classes.txt']
|
|
67
|
+
for txt_path in txt_paths[:5]:
|
|
68
|
+
values = txt_path.read_text().split()
|
|
69
|
+
# YOLO box line: class cx cy w h
|
|
70
|
+
if values and len(values) % 5 == 0:
|
|
71
|
+
return True
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _yolo_images_dir(labels_dir: Path) -> Path:
|
|
76
|
+
"""Swap the last ``labels`` component of the path for its sibling images dir
|
|
77
|
+
(``train/labels`` -> ``train/images``, ``labels/train`` -> ``images/train``)."""
|
|
78
|
+
parts = labels_dir.parts
|
|
79
|
+
for i in reversed(range(len(parts))):
|
|
80
|
+
if parts[i].lower() not in _LABEL_DIR_NAMES:
|
|
81
|
+
continue
|
|
82
|
+
for sibling in sorted(Path(*parts[:i]).iterdir()):
|
|
83
|
+
candidate = sibling.joinpath(*parts[i + 1:])
|
|
84
|
+
if sibling.is_dir() and sibling.name.lower() in _IMAGE_DIR_NAMES and candidate.is_dir():
|
|
85
|
+
return candidate
|
|
86
|
+
break
|
|
87
|
+
return labels_dir.parent / 'images'
|
|
88
|
+
|
|
89
|
+
|
|
64
90
|
def sniff_yolo(root: Path) -> DetectedDataset | None:
|
|
65
|
-
"""Look for
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
"""Look for ``labels/`` dirs of YOLO ``.txt`` files (class + 4 normalized floats).
|
|
92
|
+
|
|
93
|
+
Every split (``train``, ``valid``, ``test``, ...) is picked up, each paired with its images dir.
|
|
94
|
+
"""
|
|
95
|
+
labels_dirs = [p for p in sorted(root.rglob('*'))
|
|
96
|
+
if p.is_dir()
|
|
97
|
+
and any(part.lower() in _LABEL_DIR_NAMES for part in p.relative_to(root).parts)
|
|
98
|
+
and _is_yolo_labels_dir(p)]
|
|
99
|
+
if not labels_dirs:
|
|
73
100
|
return None
|
|
74
101
|
|
|
75
|
-
|
|
76
|
-
kwargs: dict[str, Path] = {
|
|
102
|
+
images_dirs = [_yolo_images_dir(p) for p in labels_dirs]
|
|
103
|
+
kwargs: dict[str, Path | list[Path]] = {
|
|
104
|
+
'images_dir': images_dirs[0] if len(images_dirs) == 1 else images_dirs,
|
|
105
|
+
'labels_dir': labels_dirs[0] if len(labels_dirs) == 1 else labels_dirs,
|
|
106
|
+
}
|
|
77
107
|
|
|
78
108
|
data_yaml = next(root.glob('*.yaml'), None) or next(root.glob('*.yml'), None)
|
|
79
109
|
if data_yaml is not None:
|
|
@@ -9,6 +9,7 @@ from datamint import Api
|
|
|
9
9
|
from datamint.entities import Project
|
|
10
10
|
|
|
11
11
|
from . import _common
|
|
12
|
+
from ._detect import _LABEL_DIR_NAMES
|
|
12
13
|
|
|
13
14
|
_DEFAULT_IMAGE_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.bmp', '.tif', '.tiff', '.webp')
|
|
14
15
|
|
|
@@ -27,6 +28,7 @@ class YOLOSample:
|
|
|
27
28
|
image_path: Path
|
|
28
29
|
file_name: str
|
|
29
30
|
boxes: list[YOLOBox] = field(default_factory=list)
|
|
31
|
+
split: str | None = None
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
@dataclass
|
|
@@ -67,21 +69,43 @@ def _load_names_from_yaml(path: Path) -> dict[int, str]:
|
|
|
67
69
|
return {idx: str(name) for idx, name in enumerate(names)}
|
|
68
70
|
|
|
69
71
|
|
|
72
|
+
def _as_paths(value: str | Path | Sequence[str | Path]) -> list[Path]:
|
|
73
|
+
if isinstance(value, (str, Path)):
|
|
74
|
+
return [Path(value)]
|
|
75
|
+
return [Path(v) for v in value]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _split_name(labels_dir: Path) -> str:
|
|
79
|
+
"""``train/labels`` -> ``train``, ``labels/train`` -> ``train``."""
|
|
80
|
+
parts = labels_dir.parts
|
|
81
|
+
idxs = [i for i, part in enumerate(parts) if part.lower() in _LABEL_DIR_NAMES]
|
|
82
|
+
if not idxs:
|
|
83
|
+
return labels_dir.name
|
|
84
|
+
idx = idxs[-1]
|
|
85
|
+
return parts[idx + 1] if idx + 1 < len(parts) else parts[idx - 1]
|
|
86
|
+
|
|
87
|
+
|
|
70
88
|
class YOLOImporter:
|
|
71
89
|
"""Parse a YOLO-format (images + normalized-bbox label .txt files) dataset and
|
|
72
90
|
upload it to a Datamint project.
|
|
73
91
|
|
|
92
|
+
``images_dir`` and ``labels_dir`` take one dir each, or one per split, paired by position.
|
|
93
|
+
With several splits, each resource is tagged ``split:<name>`` (e.g. ``split:train``).
|
|
74
94
|
"""
|
|
75
95
|
|
|
76
96
|
def __init__(self,
|
|
77
|
-
images_dir: str | Path,
|
|
78
|
-
labels_dir: str | Path,
|
|
97
|
+
images_dir: str | Path | Sequence[str | Path],
|
|
98
|
+
labels_dir: str | Path | Sequence[str | Path],
|
|
79
99
|
*,
|
|
80
100
|
class_names: Sequence[str] | None = None,
|
|
81
101
|
data_yaml: str | Path | None = None,
|
|
82
102
|
image_extensions: Sequence[str] = _DEFAULT_IMAGE_EXTENSIONS):
|
|
83
|
-
|
|
84
|
-
|
|
103
|
+
images_dirs = _as_paths(images_dir)
|
|
104
|
+
labels_dirs = _as_paths(labels_dir)
|
|
105
|
+
if len(images_dirs) != len(labels_dirs):
|
|
106
|
+
raise ValueError(f'images_dir and labels_dir must have the same number of entries '
|
|
107
|
+
f'(got {len(images_dirs)} and {len(labels_dirs)}).')
|
|
108
|
+
self.splits = list(zip(images_dirs, labels_dirs))
|
|
85
109
|
self.class_names_override = list(class_names) if class_names is not None else None
|
|
86
110
|
self.data_yaml = Path(data_yaml) if data_yaml is not None else None
|
|
87
111
|
self.image_extensions = image_extensions
|
|
@@ -96,9 +120,9 @@ class YOLOImporter:
|
|
|
96
120
|
|
|
97
121
|
raise ValueError('No class names available: pass class_names or data_yaml explicitly.')
|
|
98
122
|
|
|
99
|
-
def _find_image(self, stem: str) -> Path | None:
|
|
123
|
+
def _find_image(self, images_dir: Path, stem: str) -> Path | None:
|
|
100
124
|
for ext in self.image_extensions:
|
|
101
|
-
candidate =
|
|
125
|
+
candidate = images_dir / f'{stem}{ext}'
|
|
102
126
|
if candidate.exists():
|
|
103
127
|
return candidate
|
|
104
128
|
return None
|
|
@@ -123,52 +147,55 @@ class YOLOImporter:
|
|
|
123
147
|
used_class_names: set[str] = set()
|
|
124
148
|
unsupported_annotations = 0
|
|
125
149
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
150
|
+
tag_splits = len(self.splits) > 1
|
|
151
|
+
for images_dir, labels_dir in self.splits:
|
|
152
|
+
split = _split_name(labels_dir) if tag_splits else None
|
|
153
|
+
for txt_path in sorted(labels_dir.glob('*.txt')):
|
|
154
|
+
if txt_path.name in ('classes.txt',):
|
|
155
|
+
continue
|
|
156
|
+
|
|
157
|
+
image_path = self._find_image(images_dir, txt_path.stem)
|
|
158
|
+
if image_path is None:
|
|
159
|
+
missing_images.append(txt_path.name)
|
|
160
|
+
continue
|
|
161
|
+
|
|
162
|
+
img_w, img_h = Image.open(image_path).size
|
|
163
|
+
|
|
164
|
+
sample = YOLOSample(image_path=image_path, file_name=image_path.name, split=split)
|
|
165
|
+
with open(txt_path) as f:
|
|
166
|
+
for line in f:
|
|
167
|
+
parts = line.split()
|
|
168
|
+
if not parts:
|
|
169
|
+
continue
|
|
170
|
+
if len(parts) != 5:
|
|
171
|
+
# segmentation/OBB/keypoint variants have a different field count -- not supported
|
|
172
|
+
unsupported_annotations += 1
|
|
173
|
+
continue
|
|
174
|
+
|
|
175
|
+
class_id = int(parts[0])
|
|
176
|
+
if class_id not in class_names_by_id:
|
|
177
|
+
raise ValueError(f"Label '{txt_path}' references unknown class_id {class_id}.")
|
|
178
|
+
|
|
179
|
+
cx, cy, w, h = (float(v) for v in parts[1:])
|
|
180
|
+
for coord_name, value in (('x_center', cx), ('y_center', cy), ('width', w), ('height', h)):
|
|
181
|
+
if not (0.0 <= value <= 1.0):
|
|
182
|
+
raise ValueError(f"Label '{txt_path}' has out-of-range normalized "
|
|
183
|
+
f"{coord_name}={value!r} (expected 0<=v<=1).")
|
|
184
|
+
|
|
185
|
+
cx, w = cx * img_w, w * img_w
|
|
186
|
+
cy, h = cy * img_h, h * img_h
|
|
187
|
+
|
|
188
|
+
label = class_names_by_id[class_id]
|
|
189
|
+
sample.boxes.append(YOLOBox(
|
|
190
|
+
label=label,
|
|
191
|
+
x1=cx - w / 2,
|
|
192
|
+
y1=cy - h / 2,
|
|
193
|
+
x2=cx + w / 2,
|
|
194
|
+
y2=cy + h / 2,
|
|
195
|
+
))
|
|
196
|
+
used_class_names.add(label)
|
|
197
|
+
|
|
198
|
+
samples.append(sample)
|
|
172
199
|
|
|
173
200
|
self._result = YOLOParseResult(
|
|
174
201
|
samples=samples,
|
|
@@ -195,7 +222,8 @@ class YOLOImporter:
|
|
|
195
222
|
return _common.import_boxes_to_project(
|
|
196
223
|
result, project, api,
|
|
197
224
|
box_points=lambda b: ((b.x1, b.y1), (b.x2, b.y2)),
|
|
198
|
-
source_label=str(self.
|
|
225
|
+
source_label=', '.join(str(labels_dir) for _, labels_dir in self.splits),
|
|
226
|
+
sample_tags=lambda s: [f'split:{s.split}'] if s.split else [],
|
|
199
227
|
tags=tags,
|
|
200
228
|
imported_from=imported_from,
|
|
201
229
|
on_error=on_error,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "datamint"
|
|
3
3
|
description = "A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows."
|
|
4
|
-
version = "2.
|
|
4
|
+
version = "2.48.0"
|
|
5
5
|
dynamic = ["dependencies"]
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/lightning_modules/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/deeplabv3plus.py
RENAMED
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/efficientnetv2.py
RENAMED
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/data_export.py
RENAMED
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/data_import.py
RENAMED
|
File without changes
|
|
File without changes
|
{datamint-2.47.0 → datamint-2.48.0}/datamint/lightning/trainers/specialized/nnunet/trainer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|