hafnia 0.4.2__tar.gz → 0.5.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.
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/tests.yaml +4 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.vscode/launch.json +6 -6
- {hafnia-0.4.2 → hafnia-0.5.0}/.vscode/settings.json +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/PKG-INFO +4 -4
- {hafnia-0.4.2 → hafnia-0.5.0}/README.md +2 -2
- {hafnia-0.4.2 → hafnia-0.5.0}/examples/example_hafnia_dataset.py +50 -30
- {hafnia-0.4.2 → hafnia-0.5.0}/examples/example_logger.py +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/pyproject.toml +2 -2
- hafnia-0.4.2/src/hafnia/dataset/dataset_upload_helper.py → hafnia-0.5.0/src/hafnia/dataset/dataset_details_uploader.py +148 -238
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/dataset_helpers.py +1 -15
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/dataset_names.py +43 -3
- hafnia-0.5.0/src/hafnia/dataset/format_conversions/format_coco.py +490 -0
- hafnia-0.5.0/src/hafnia/dataset/format_conversions/format_helpers.py +33 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/format_conversions/format_image_classification_folder.py +95 -14
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/format_conversions/format_yolo.py +115 -25
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/format_conversions/torchvision_datasets.py +16 -11
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/hafnia_dataset.py +119 -490
- hafnia-0.5.0/src/hafnia/dataset/hafnia_dataset_types.py +479 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/license_types.py +4 -4
- hafnia-0.5.0/src/hafnia/dataset/operations/dataset_s3_storage.py +211 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/operations/dataset_stats.py +3 -3
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/operations/dataset_transformations.py +14 -17
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/operations/table_transformations.py +22 -14
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/bbox.py +6 -2
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/bitmask.py +21 -46
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/classification.py +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/polygon.py +43 -2
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/primitive.py +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/segmentation.py +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/experiment/hafnia_logger.py +13 -4
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/http.py +2 -1
- hafnia-0.5.0/src/hafnia/platform/datasets.py +334 -0
- hafnia-0.5.0/src/hafnia/platform/s5cmd_utils.py +147 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/torch_helpers.py +48 -4
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/utils.py +38 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/visualizations/image_visualizations.py +3 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/dataset_cmds.py +18 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/profile_cmds.py +0 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/conftest.py +7 -1
- hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/train/000000000724.jpg +0 -0
- hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/train/_annotations.coco.json +2967 -0
- hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/valid/_annotations.coco.json +1423 -0
- hafnia-0.5.0/tests/data/dataset_formats/format_yolo/train/data/000000000139.jpg +0 -0
- hafnia-0.5.0/tests/data/dataset_formats/format_yolo/train/data/000000000285.jpg +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo → hafnia-0.5.0/tests/data/dataset_formats/format_yolo/train}/images.txt +0 -1
- hafnia-0.5.0/tests/data/dataset_formats/format_yolo/validation/data/000000000632.jpg +0 -0
- hafnia-0.5.0/tests/data/dataset_formats/format_yolo/validation/images.txt +1 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/dataset_image_metadata_schema.yaml +19 -4
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_convert_segmentation_to_rle_list[polygon].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_convert_segmentation_to_rle_list[rle_as_ints].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_convert_segmentation_to_rle_list[rle_compressed_bytes].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_convert_segmentation_to_rle_list[rle_compressed_str].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_from_coco_format_visualized.png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_coco/test_to_coco_format_visualized.png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_format_yolo/test_format_yolo_import_export_tiny_dataset.png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_samples/test_check_dataset[coco-2017].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_samples/test_check_dataset[tiny-dataset].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[coco-2017].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[tiny-dataset].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_blur_anonymization[micro-coco-2017].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_blur_anonymization[micro-tiny-dataset].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_draw_annotations[micro-coco-2017].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_draw_annotations[micro-tiny-dataset].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_mask_region[micro-coco-2017].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_mask_region[micro-tiny-dataset].png +0 -0
- hafnia-0.5.0/tests/data/expected_images/test_visualizations/test_polygon_to_bitmask_conversion.png +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/annotations.jsonl +3 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/annotations.parquet +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/data/253/253925d334c002ce6662d8133535dd4c.jpg +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/data/b1a/b1a09f4d922f8f6904bab0c1caf172ab.jpg +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/data/f67/f675c8a1e862b5e00203ab888ac7fff4.jpg +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-coco-2017/dataset_info.json +184 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-tiny-dataset/annotations.jsonl +3 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-tiny-dataset/annotations.parquet +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-tiny-dataset/data/25c/25c3a206e7b60ab50245ee3d52d97f11.png +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-tiny-dataset/data/962/962fd865fdd45f169d5ca8c8f284d68d.png +0 -0
- hafnia-0.5.0/tests/data/micro_test_datasets/micro-tiny-dataset/data/ec6/ec60f2f4fb854b59c97e16b45c713de0.png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/micro_test_datasets/micro-tiny-dataset/dataset_info.json +17 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/helper_testing.py +23 -6
- hafnia-0.5.0/tests/integration/test_bring_your_own_data.py +93 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_samples.py +9 -3
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_torchvision_datasets.py +1 -5
- hafnia-0.5.0/tests/unit/dataset/format_conversions/test_format_coco.py +153 -0
- hafnia-0.4.2/tests/unit/dataset/format_conversions/test_image_classification_directory.py → hafnia-0.5.0/tests/unit/dataset/format_conversions/test_format_image_classification_folder.py +6 -9
- hafnia-0.5.0/tests/unit/dataset/format_conversions/test_format_yolo.py +102 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/operations/test_dataset_transformations.py +2 -1
- hafnia-0.5.0/tests/unit/dataset/test_dataset_details_uploader.py +55 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/test_dataset_names.py +1 -1
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/test_hafnia_dataset.py +3 -19
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/test_shape_primitives.py +2 -2
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/test_hafnia_logger.py +2 -2
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/test_visualizations.py +15 -14
- {hafnia-0.4.2 → hafnia-0.5.0}/uv.lock +1290 -1176
- hafnia-0.4.2/src/hafnia/platform/datasets.py +0 -244
- hafnia-0.4.2/tests/data/expected_images/test_format_yolo/test_format_yolo_import_export_tiny_dataset.png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_samples/test_check_dataset[coco-2017].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_samples/test_check_dataset[tiny-dataset].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[coco-2017].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[tiny-dataset].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_blur_anonymization[micro-coco-2017].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_blur_anonymization[micro-tiny-dataset].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_draw_annotations[micro-coco-2017].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_draw_annotations[micro-tiny-dataset].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_mask_region[micro-coco-2017].png +0 -0
- hafnia-0.4.2/tests/data/expected_images/test_visualizations/test_mask_region[micro-tiny-dataset].png +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/annotations.jsonl +0 -3
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/annotations.parquet +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/data/657/657dff54d5175e2ae9f4b9629cf57646.jpg +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/data/825/825fa2d2d9416694b8e81a47ca38f580.jpg +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/data/aa3/aa3cc40b5cde88e5bd189c0b3e6c223c.jpg +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-coco-2017/dataset_info.json +0 -325
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-tiny-dataset/annotations.jsonl +0 -3
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-tiny-dataset/annotations.parquet +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-tiny-dataset/data/2da/2da1d8dbf2b60bdab8dff1d7f5c2dfb5.png +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-tiny-dataset/data/3dd/3ddec2275a02e79e3251d85443622e4c.png +0 -0
- hafnia-0.4.2/tests/data/micro_test_datasets/micro-tiny-dataset/data/4d8/4d8450b045e60e8f3657ababa44af9b6.png +0 -0
- hafnia-0.4.2/tests/unit/dataset/format_conversions/test_format_yolo.py +0 -85
- {hafnia-0.4.2 → hafnia-0.5.0}/.devcontainer/devcontainer.json +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.devcontainer/hooks/post_create +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/dependabot.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/Dockerfile +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/build.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/check_release.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/ci_cd.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/lint.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/publish_docker.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.github/workflows/publish_pypi.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.gitignore +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.pre-commit-config.yaml +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.python-version +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.trivyignore +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/.vscode/extensions.json +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/LICENSE +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/docs/cli.md +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/docs/release.md +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/examples/example_dataset_recipe.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/examples/example_torchvision_dataloader.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/data/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/data/factory.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/dataset_recipe/dataset_recipe.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/dataset_recipe/recipe_transforms.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/dataset_recipe/recipe_types.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/point.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/dataset/primitives/utils.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/experiment/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/log.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/builder.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/dataset_recipe.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/download.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/experiment.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/platform/trainer_package.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia/visualizations/colors.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/__init__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/__main__.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/config.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/consts.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/dataset_recipe_cmds.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/experiment_cmds.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/keychain.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/runc_cmds.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/src/hafnia_cli/trainer_package_cmds.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/__init__.py +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo/data → hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/train}/000000000632.jpg +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo/data → hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/valid}/000000000139.jpg +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo/data → hafnia-0.5.0/tests/data/dataset_formats/format_coco_roboflow/valid}/000000000285.jpg +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/dataset_formats/format_yolo/obj.names +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo → hafnia-0.5.0/tests/data/dataset_formats/format_yolo/train}/data/000000000139.txt +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo → hafnia-0.5.0/tests/data/dataset_formats/format_yolo/train}/data/000000000285.txt +0 -0
- {hafnia-0.4.2/tests/data/dataset_formats/format_yolo → hafnia-0.5.0/tests/data/dataset_formats/format_yolo/validation}/data/000000000632.txt +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_dataset_transformations/test_video_storage_format_read_image.png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_format_yolo/test_import_yolo_format_visualized.png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[caltech-101].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[caltech-256].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[cifar100].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[cifar10].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[midwest-vehicle-detection].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_check_dataset[mnist].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[caltech-101].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[caltech-256].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[cifar100].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[cifar10].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[midwest-vehicle-detection].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/data/expected_images/test_samples/test_dataset_draw_image_and_target[mnist].png +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_check_example_scripts.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_cli_integration.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_dataset_merges.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/integration/test_dataset_recipes_with_platform.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/dataset_recipe/test_dataset_recipe_helpers.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/dataset_recipe/test_dataset_recipes.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/dataset_recipe/test_recipe_transformations.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/operations/test_dataset_stats.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/operations/test_table_transformations.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/test_colors.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/dataset/test_dataset_helpers.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/test_builder.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/test_cli.py +0 -0
- {hafnia-0.4.2 → hafnia-0.5.0}/tests/unit/test_utils.py +0 -0
|
@@ -32,6 +32,10 @@ jobs:
|
|
|
32
32
|
run: |
|
|
33
33
|
mkdir -p ~/.hafnia
|
|
34
34
|
echo "$HAFNIA_CONFIG" | jq . > ~/.hafnia/config.json
|
|
35
|
+
- name: Check hafnia configured
|
|
36
|
+
run: uv run hafnia profile active
|
|
37
|
+
- name: Check hafnia by download
|
|
38
|
+
run: uv run hafnia dataset download mnist --force
|
|
35
39
|
- name: Run tests
|
|
36
40
|
run: uv run pytest tests
|
|
37
41
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"name": "debug (list profiles)",
|
|
16
16
|
"type": "debugpy",
|
|
17
17
|
"request": "launch",
|
|
18
|
-
"program": "${workspaceFolder}/src/
|
|
18
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
19
19
|
"args": [
|
|
20
20
|
"profile",
|
|
21
21
|
"ls"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"name": "cmd: hafnia runc launch-local",
|
|
26
26
|
"type": "debugpy",
|
|
27
27
|
"request": "launch",
|
|
28
|
-
"program": "${workspaceFolder}/src/
|
|
28
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
29
29
|
"args": [
|
|
30
30
|
"runc",
|
|
31
31
|
"launch-local",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"name": "cmd: hafnia runc build-local",
|
|
39
39
|
"type": "debugpy",
|
|
40
40
|
"request": "launch",
|
|
41
|
-
"program": "${workspaceFolder}/src/
|
|
41
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
42
42
|
"args": [
|
|
43
43
|
"runc",
|
|
44
44
|
"build-local",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"name": "cmd: 'hafnia dataset [X]'",
|
|
52
52
|
"type": "debugpy",
|
|
53
53
|
"request": "launch",
|
|
54
|
-
"program": "${workspaceFolder}/src/
|
|
54
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
55
55
|
"args": [
|
|
56
56
|
"dataset",
|
|
57
57
|
//"ls",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"name": "cmd: 'hafnia experiment [X]'",
|
|
65
65
|
"type": "debugpy",
|
|
66
66
|
"request": "launch",
|
|
67
|
-
"program": "${workspaceFolder}/src/
|
|
67
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
68
68
|
"args": [
|
|
69
69
|
"experiment",
|
|
70
70
|
"create",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"name": "cmd: 'hafnia train-recipe [X]'",
|
|
83
83
|
"type": "debugpy",
|
|
84
84
|
"request": "launch",
|
|
85
|
-
"program": "${workspaceFolder}/src/
|
|
85
|
+
"program": "${workspaceFolder}/src/hafnia_cli/__main__.py",
|
|
86
86
|
"args": [
|
|
87
87
|
"trainer",
|
|
88
88
|
"ls"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hafnia
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Python SDK for communication with Hafnia platform.
|
|
5
5
|
Author-email: Milestone Systems <hafniaplatform@milestone.dk>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -10,7 +10,7 @@ Requires-Dist: click>=8.1.8
|
|
|
10
10
|
Requires-Dist: emoji>=2.14.1
|
|
11
11
|
Requires-Dist: flatten-dict>=0.4.2
|
|
12
12
|
Requires-Dist: keyring>=25.6.0
|
|
13
|
-
Requires-Dist: mcp
|
|
13
|
+
Requires-Dist: mcp>=1.16.0
|
|
14
14
|
Requires-Dist: mlflow>=3.4.0
|
|
15
15
|
Requires-Dist: more-itertools>=10.7.0
|
|
16
16
|
Requires-Dist: opencv-python-headless>=4.11.0.86
|
|
@@ -209,7 +209,7 @@ DatasetInfo(
|
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
You can iterate and access samples in the dataset using the `HafniaDataset` object.
|
|
212
|
-
Each sample contain image and annotations information.
|
|
212
|
+
Each sample contain image and annotations information.
|
|
213
213
|
|
|
214
214
|
```python
|
|
215
215
|
from hafnia.dataset.hafnia_dataset import HafniaDataset, Sample
|
|
@@ -343,7 +343,7 @@ batch_size = 128
|
|
|
343
343
|
learning_rate = 0.001
|
|
344
344
|
|
|
345
345
|
# Initialize Hafnia logger
|
|
346
|
-
logger = HafniaLogger()
|
|
346
|
+
logger = HafniaLogger(project_name="my_classification_project")
|
|
347
347
|
|
|
348
348
|
# Log experiment parameters
|
|
349
349
|
logger.log_configuration({"batch_size": 128, "learning_rate": 0.001})
|
|
@@ -180,7 +180,7 @@ DatasetInfo(
|
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
You can iterate and access samples in the dataset using the `HafniaDataset` object.
|
|
183
|
-
Each sample contain image and annotations information.
|
|
183
|
+
Each sample contain image and annotations information.
|
|
184
184
|
|
|
185
185
|
```python
|
|
186
186
|
from hafnia.dataset.hafnia_dataset import HafniaDataset, Sample
|
|
@@ -314,7 +314,7 @@ batch_size = 128
|
|
|
314
314
|
learning_rate = 0.001
|
|
315
315
|
|
|
316
316
|
# Initialize Hafnia logger
|
|
317
|
-
logger = HafniaLogger()
|
|
317
|
+
logger = HafniaLogger(project_name="my_classification_project")
|
|
318
318
|
|
|
319
319
|
# Log experiment parameters
|
|
320
320
|
logger.log_configuration({"batch_size": 128, "learning_rate": 0.001})
|
|
@@ -6,7 +6,8 @@ from PIL import Image
|
|
|
6
6
|
from rich import print as rprint
|
|
7
7
|
|
|
8
8
|
from hafnia.dataset.dataset_names import SplitName
|
|
9
|
-
from hafnia.dataset.hafnia_dataset import
|
|
9
|
+
from hafnia.dataset.hafnia_dataset import HafniaDataset
|
|
10
|
+
from hafnia.dataset.hafnia_dataset_types import DatasetInfo, Sample, TaskInfo
|
|
10
11
|
from hafnia.dataset.primitives.bbox import Bbox
|
|
11
12
|
from hafnia.dataset.primitives.bitmask import Bitmask
|
|
12
13
|
from hafnia.dataset.primitives.classification import Classification
|
|
@@ -87,14 +88,18 @@ dataset.write(path_dataset)
|
|
|
87
88
|
dataset_again = HafniaDataset.from_path(path_dataset)
|
|
88
89
|
|
|
89
90
|
## Dataset importers and exporters ##
|
|
90
|
-
|
|
91
|
+
dataset_od = HafniaDataset.from_name("coco-2017").select_samples(n_samples=5, seed=42)
|
|
92
|
+
|
|
93
|
+
# Export/import dataset to YOLO format
|
|
91
94
|
path_yolo_format = Path(".data/tmp/yolo_dataset")
|
|
95
|
+
dataset_od.to_yolo_format(path_output=path_yolo_format) # Export to YOLO format
|
|
96
|
+
dataset_od_imported = HafniaDataset.from_yolo_format(path_yolo_format) # Import dataset from YOLO format
|
|
92
97
|
|
|
93
|
-
# Export dataset to YOLO format
|
|
94
|
-
dataset_coco.to_yolo_format(path_export_yolo_dataset=path_yolo_format)
|
|
95
98
|
|
|
96
|
-
#
|
|
97
|
-
|
|
99
|
+
# Export/import dataset to YOLO format
|
|
100
|
+
path_coco_format = Path(".data/tmp/coco_dataset")
|
|
101
|
+
dataset_od.to_coco_format(path_output=path_coco_format) # Export to COCO format
|
|
102
|
+
dataset_od_imported = HafniaDataset.from_coco_format(path_coco_format) # Import dataset from COCO format
|
|
98
103
|
|
|
99
104
|
## Custom dataset operations and statistics ##
|
|
100
105
|
# Want custom dataset transformations or statistics? Use the polars table (dataset.samples) directly
|
|
@@ -133,43 +138,58 @@ path_tmp.mkdir(parents=True, exist_ok=True)
|
|
|
133
138
|
Image.fromarray(image_with_annotations).save(path_tmp / "sample_with_annotations.png")
|
|
134
139
|
|
|
135
140
|
|
|
136
|
-
##
|
|
141
|
+
## Create a hafnia dataset from scratch ##
|
|
142
|
+
path_yolo_dataset = Path("tests/data/dataset_formats/format_yolo/train")
|
|
143
|
+
path_class_names = path_yolo_dataset.parent / "obj.names"
|
|
144
|
+
class_names = [line.strip() for line in path_class_names.read_text().splitlines() if line.strip()]
|
|
145
|
+
path_images_file = path_yolo_dataset / "images.txt"
|
|
146
|
+
image_files = [line.strip() for line in path_images_file.read_text().splitlines() if line.strip()]
|
|
147
|
+
|
|
137
148
|
fake_samples = []
|
|
138
|
-
for
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
for image_file in image_files:
|
|
150
|
+
path_image = path_yolo_dataset / image_file
|
|
151
|
+
path_bboxes = path_yolo_dataset / image_file.replace(".jpg", ".txt")
|
|
152
|
+
bboxes: List[Bbox] = []
|
|
153
|
+
for bboxes_line in path_bboxes.read_text().splitlines():
|
|
154
|
+
str_parts = bboxes_line.strip().split()
|
|
155
|
+
class_idx = int(str_parts[0])
|
|
156
|
+
x_center, y_center, bbox_width, bbox_height = (float(value) for value in str_parts[1:5])
|
|
157
|
+
bbox = Bbox(
|
|
158
|
+
top_left_x=x_center - bbox_width / 2,
|
|
159
|
+
top_left_y=y_center - bbox_height / 2,
|
|
160
|
+
width=bbox_width,
|
|
161
|
+
height=bbox_height,
|
|
162
|
+
class_idx=class_idx,
|
|
163
|
+
class_name=class_names[class_idx],
|
|
164
|
+
)
|
|
165
|
+
bboxes.append(bbox)
|
|
166
|
+
image = Image.open(path_image)
|
|
167
|
+
height, width = image.size[1], image.size[0]
|
|
168
|
+
sample = Sample(file_path=str(path_image), height=height, width=width, split="train", bboxes=bboxes)
|
|
150
169
|
fake_samples.append(sample)
|
|
151
170
|
|
|
152
171
|
|
|
153
172
|
fake_dataset_info = DatasetInfo(
|
|
154
|
-
dataset_name="
|
|
173
|
+
dataset_name="custom-dataset",
|
|
155
174
|
version="0.0.1",
|
|
156
|
-
tasks=[
|
|
157
|
-
TaskInfo(primitive=Bbox, class_names=["car", "truck", "bus"]),
|
|
158
|
-
TaskInfo(primitive=Classification, class_names=["vehicle", "pedestrian", "cyclist"]),
|
|
159
|
-
],
|
|
175
|
+
tasks=[TaskInfo(primitive=Bbox, class_names=class_names)],
|
|
160
176
|
)
|
|
161
|
-
|
|
177
|
+
custom_dataset = HafniaDataset.from_samples_list(samples_list=fake_samples, info=fake_dataset_info)
|
|
178
|
+
|
|
179
|
+
sample = Sample(**custom_dataset[0])
|
|
180
|
+
|
|
181
|
+
# To visualize and verify dataset is formatted correctly store image with annotations
|
|
182
|
+
image_with_annotations = sample.draw_annotations()
|
|
183
|
+
Image.fromarray(image_with_annotations).save(path_tmp / "custom_dataset_sample.png") # Save visualization to TM
|
|
162
184
|
|
|
163
|
-
#
|
|
164
|
-
#
|
|
185
|
+
# To upload the dataset to Hafnia platform
|
|
186
|
+
# custom_dataset.upload_to_platform(interactive=True, allow_version_overwrite=False)
|
|
165
187
|
|
|
166
|
-
# Coming soon! Create your own dataset details page in Hafnia
|
|
167
|
-
# fake_dataset.upload_dataset_details()
|
|
168
188
|
|
|
169
189
|
## Storing predictions: A hafnia dataset can also be used for storing predictions per sample
|
|
170
190
|
# set 'ground_truth=False' and add 'confidence'.
|
|
171
191
|
bboxes_predictions = [
|
|
172
|
-
Bbox(top_left_x=
|
|
192
|
+
Bbox(top_left_x=0.1, top_left_y=0.2, width=0.3, height=0.4, class_name="car", ground_truth=False, confidence=0.9)
|
|
173
193
|
]
|
|
174
194
|
|
|
175
195
|
classifications_predictions = [Classification(class_name="vehicle", class_idx=0, ground_truth=False, confidence=0.95)]
|
|
@@ -4,7 +4,7 @@ batch_size = 128
|
|
|
4
4
|
learning_rate = 0.001
|
|
5
5
|
|
|
6
6
|
# Initialize Hafnia logger
|
|
7
|
-
logger = HafniaLogger()
|
|
7
|
+
logger = HafniaLogger(project_name="example_classification_project")
|
|
8
8
|
|
|
9
9
|
# Log experiment parameters
|
|
10
10
|
logger.log_configuration({"batch_size": 128, "learning_rate": 0.001})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "hafnia"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
description = "Python SDK for communication with Hafnia platform."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -28,7 +28,7 @@ dependencies = [
|
|
|
28
28
|
"xxhash>=3.5.0",
|
|
29
29
|
"mlflow>=3.4.0",
|
|
30
30
|
"sagemaker-mlflow>=0.1.0",
|
|
31
|
-
"mcp
|
|
31
|
+
"mcp>=1.16.0",
|
|
32
32
|
]
|
|
33
33
|
|
|
34
34
|
[dependency-groups]
|