autovision-framework 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autovision/__init__.py +134 -0
- autovision/_compat.py +57 -0
- autovision/_license.py +13 -0
- autovision/_version.py +15 -0
- autovision/augment/__init__.py +27 -0
- autovision/augment/detection/__init__.py +42 -0
- autovision/augment/detection/args.py +168 -0
- autovision/augment/detection/box_aware_eraser.py +231 -0
- autovision/augment/detection/collate.py +294 -0
- autovision/augment/detection/oriented_transform.py +207 -0
- autovision/augment/detection/schedule.py +64 -0
- autovision/augment/detection/transform.py +411 -0
- autovision/augment/method_transform.py +38 -0
- autovision/augment/mosaic_geometry.py +113 -0
- autovision/augment/task_transform.py +57 -0
- autovision/augment/transform_args.py +112 -0
- autovision/augment/view_transform.py +102 -0
- autovision/cli/__init__.py +30 -0
- autovision/cli/_app.py +850 -0
- autovision/cli/analyze_errors.py +227 -0
- autovision/cli/common_helpers.py +266 -0
- autovision/cli/compliance_report.py +27 -0
- autovision/cli/data_check.py +159 -0
- autovision/cli/export.py +45 -0
- autovision/cli/extract_video_frames.py +81 -0
- autovision/cli/model_handle.py +400 -0
- autovision/cli/plot.py +118 -0
- autovision/cli/pseudo_label.py +90 -0
- autovision/cli/recipes.py +123 -0
- autovision/cli/system_info.py +108 -0
- autovision/cli/train.py +359 -0
- autovision/cli/train_helpers.py +170 -0
- autovision/cli/train_task/__init__.py +36 -0
- autovision/cli/train_task/depth_estimation.py +245 -0
- autovision/cli/train_task/image_classification.py +256 -0
- autovision/cli/train_task/instance_segmentation.py +280 -0
- autovision/cli/train_task/object_detection.py +510 -0
- autovision/cli/train_task/oriented_object_detection.py +310 -0
- autovision/cli/train_task/panoptic_segmentation.py +273 -0
- autovision/cli/train_task/pose_estimation.py +259 -0
- autovision/cli/train_task/semantic_segmentation.py +302 -0
- autovision/cli/train_task/task_helpers.py +35 -0
- autovision/compliance/__init__.py +24 -0
- autovision/compliance/inventory.py +162 -0
- autovision/compliance/licenses.py +170 -0
- autovision/compliance/report.py +320 -0
- autovision/config/__init__.py +22 -0
- autovision/config/base.py +64 -0
- autovision/config/registry.py +68 -0
- autovision/config/validate.py +116 -0
- autovision/data/__init__.py +7 -0
- autovision/data/coco8.py +142 -0
- autovision/data/coco_instance_segmentation_dataset.py +123 -0
- autovision/data/coco_keypoint_dataset.py +155 -0
- autovision/data/coco_object_detection_dataset.py +154 -0
- autovision/data/convert.py +653 -0
- autovision/data/depth_estimation_dataset.py +105 -0
- autovision/data/downloads.py +393 -0
- autovision/data/file_helpers.py +114 -0
- autovision/data/hard_examples.py +191 -0
- autovision/data/image_classification_dataset.py +90 -0
- autovision/data/image_dataset.py +71 -0
- autovision/data/interchange/__init__.py +15 -0
- autovision/data/interchange/common.py +129 -0
- autovision/data/interchange/cvat.py +139 -0
- autovision/data/interchange/label_studio.py +178 -0
- autovision/data/label_helpers.py +11 -0
- autovision/data/mask_panoptic_segmentation_dataset.py +207 -0
- autovision/data/mmap_helpers.py +263 -0
- autovision/data/object_detection_dataset.py +71 -0
- autovision/data/quality.py +530 -0
- autovision/data/samplers.py +150 -0
- autovision/data/semantic_segmentation_dataset.py +100 -0
- autovision/data/serialize/__init__.py +7 -0
- autovision/data/serialize/memory_mapped_sequence.py +158 -0
- autovision/data/task_dataset.py +38 -0
- autovision/data/two_view.py +45 -0
- autovision/data/versioning.py +412 -0
- autovision/data/yolo_object_detection_dataset.py +122 -0
- autovision/data/yolo_oriented_object_detection_dataset.py +107 -0
- autovision/debug/__init__.py +24 -0
- autovision/debug/debug_args.py +49 -0
- autovision/debug/nan_capture.py +145 -0
- autovision/debug/underflow_overflow.py +96 -0
- autovision/encoders/__init__.py +45 -0
- autovision/encoders/_model_helpers.py +58 -0
- autovision/encoders/_non_module_wrapper.py +93 -0
- autovision/encoders/custom/__init__.py +6 -0
- autovision/encoders/custom/custom_source.py +52 -0
- autovision/encoders/dinov2/__init__.py +7 -0
- autovision/encoders/dinov2/dinov2_source.py +277 -0
- autovision/encoders/dinov2/dinov2_wrapper.py +367 -0
- autovision/encoders/dinov3/__init__.py +10 -0
- autovision/encoders/dinov3/dinov3_source.py +416 -0
- autovision/encoders/dinov3/dinov3_wrapper.py +288 -0
- autovision/encoders/embedding_model.py +116 -0
- autovision/encoders/model_wrapper.py +139 -0
- autovision/encoders/package.py +59 -0
- autovision/encoders/package_helpers.py +153 -0
- autovision/encoders/rfdetr/__init__.py +7 -0
- autovision/encoders/rfdetr/rfdetr.py +142 -0
- autovision/encoders/rfdetr/rfdetr_source.py +225 -0
- autovision/encoders/rtdetr/__init__.py +6 -0
- autovision/encoders/rtdetr/rtdetr.py +82 -0
- autovision/encoders/super_gradients/__init__.py +14 -0
- autovision/encoders/super_gradients/super_gradients_source.py +182 -0
- autovision/encoders/timm/__init__.py +7 -0
- autovision/encoders/timm/timm_source.py +134 -0
- autovision/encoders/timm/timm_wrapper.py +383 -0
- autovision/encoders/torchvision/__init__.py +4 -0
- autovision/encoders/torchvision/torchvision_source.py +150 -0
- autovision/encoders/torchvision/wrappers.py +94 -0
- autovision/encoders/ultralytics/__init__.py +7 -0
- autovision/encoders/ultralytics/ultralytics.py +152 -0
- autovision/encoders/ultralytics/ultralytics_source.py +179 -0
- autovision/encoders/weight_hashes.py +235 -0
- autovision/encoders/weight_verification.py +495 -0
- autovision/engine/__init__.py +18 -0
- autovision/engine/engine.py +1585 -0
- autovision/errors.py +54 -0
- autovision/export/__init__.py +86 -0
- autovision/export/benchmark.py +742 -0
- autovision/export/e2e_parity.py +243 -0
- autovision/export/export_onnx.py +1144 -0
- autovision/export/int8_report.py +139 -0
- autovision/export/model_cost.py +105 -0
- autovision/export/openvino_helpers.py +163 -0
- autovision/export/postprocess.py +420 -0
- autovision/export/quantization.py +354 -0
- autovision/export/tensorrt_helpers.py +929 -0
- autovision/features/__init__.py +6 -0
- autovision/features/embed.py +185 -0
- autovision/geometry/__init__.py +65 -0
- autovision/geometry/box_ops.py +238 -0
- autovision/geometry/boxes.py +321 -0
- autovision/geometry/masks.py +267 -0
- autovision/geometry/obb.py +267 -0
- autovision/hpo/__init__.py +28 -0
- autovision/hpo/asha.py +155 -0
- autovision/hpo/search.py +635 -0
- autovision/hpo/space.py +228 -0
- autovision/inference/__init__.py +66 -0
- autovision/inference/engine.py +186 -0
- autovision/inference/multi_stream.py +524 -0
- autovision/inference/stream.py +587 -0
- autovision/inference/video.py +384 -0
- autovision/keys.py +47 -0
- autovision/metrics/classification.py +61 -0
- autovision/metrics/confusion.py +116 -0
- autovision/metrics/depth_estimation.py +111 -0
- autovision/metrics/error_analysis.py +717 -0
- autovision/metrics/instance_segmentation.py +159 -0
- autovision/metrics/map_evaluator.py +352 -0
- autovision/metrics/oriented_detection.py +195 -0
- autovision/metrics/panoptic_segmentation.py +159 -0
- autovision/metrics/pose_estimation.py +214 -0
- autovision/metrics/report.py +103 -0
- autovision/metrics/segmentation.py +62 -0
- autovision/metrics/ssl_probes.py +179 -0
- autovision/observability/__init__.py +2 -0
- autovision/observability/events/__init__.py +10 -0
- autovision/observability/events/tracker.py +170 -0
- autovision/observability/loggers/__init__.py +189 -0
- autovision/observability/loggers/jsonl.py +35 -0
- autovision/observability/otel.py +89 -0
- autovision/optim/__init__.py +33 -0
- autovision/optim/adamw8bit_args.py +41 -0
- autovision/optim/lars.py +98 -0
- autovision/optim/optimizer_args.py +149 -0
- autovision/optim/optimizer_helpers.py +203 -0
- autovision/optim/optimizer_type.py +15 -0
- autovision/optim/schedulers.py +52 -0
- autovision/optim/trainable_modules.py +23 -0
- autovision/plugins.py +208 -0
- autovision/pretext/__init__.py +9 -0
- autovision/pretext/densecl/__init__.py +10 -0
- autovision/pretext/densecl/densecl.py +259 -0
- autovision/pretext/detcon/__init__.py +24 -0
- autovision/pretext/detcon/detcon.py +586 -0
- autovision/pretext/detcon/detcon_transform.py +211 -0
- autovision/pretext/dino/__init__.py +24 -0
- autovision/pretext/dino/dino.py +615 -0
- autovision/pretext/dinov2/__init__.py +6 -0
- autovision/pretext/dinov2/dinov2.py +606 -0
- autovision/pretext/dinov3/__init__.py +11 -0
- autovision/pretext/dinov3/constrained_crop.py +271 -0
- autovision/pretext/dinov3/dinov3.py +639 -0
- autovision/pretext/dinov3/paika.py +91 -0
- autovision/pretext/distillationv2/__init__.py +20 -0
- autovision/pretext/distillationv2/distillationv2.py +333 -0
- autovision/pretext/distillationv3/__init__.py +18 -0
- autovision/pretext/distillationv3/distillationv3.py +384 -0
- autovision/pretext/knn_eval.py +273 -0
- autovision/pretext/method_args.py +43 -0
- autovision/pretext/recipe.py +167 -0
- autovision/pretext/simclr/__init__.py +20 -0
- autovision/pretext/simclr/simclr.py +202 -0
- autovision/pretext/teachers.py +81 -0
- autovision/py.typed +0 -0
- autovision/registry/__init__.py +66 -0
- autovision/registry/apache_assets.py +56 -0
- autovision/registry/assets.py +30 -0
- autovision/registry/catalog.py +431 -0
- autovision/registry/deployment_gates.py +153 -0
- autovision/registry/downloadable.py +172 -0
- autovision/registry/gtr_assets.py +267 -0
- autovision/registry/gtr_download.py +231 -0
- autovision/registry/mlflow_registry.py +442 -0
- autovision/registry/model_card.py +98 -0
- autovision/registry/model_cards.py +138 -0
- autovision/registry/model_registry.py +609 -0
- autovision/registry/spectrum_release.py +137 -0
- autovision/registry/user_held_assets.py +380 -0
- autovision/registry/warm_start.py +123 -0
- autovision/results.py +723 -0
- autovision/runtime/__init__.py +8 -0
- autovision/runtime/accelerator.py +104 -0
- autovision/runtime/checkpoint.py +155 -0
- autovision/runtime/distributed.py +109 -0
- autovision/runtime/env.py +213 -0
- autovision/runtime/fs_utils.py +66 -0
- autovision/runtime/fsdp.py +110 -0
- autovision/runtime/logging.py +71 -0
- autovision/runtime/manifest.py +183 -0
- autovision/runtime/torch_compile.py +60 -0
- autovision/scaling.py +94 -0
- autovision/serving/__init__.py +32 -0
- autovision/serving/app.py +925 -0
- autovision/serving/drift.py +294 -0
- autovision/serving/metrics.py +105 -0
- autovision/serving/ratelimit.py +71 -0
- autovision/serving/server.py +121 -0
- autovision/serving/worker.py +45 -0
- autovision/tasks/__init__.py +33 -0
- autovision/tasks/classification/__init__.py +18 -0
- autovision/tasks/classification/config.py +47 -0
- autovision/tasks/classification/task_model.py +152 -0
- autovision/tasks/classification/train_model.py +157 -0
- autovision/tasks/classification/transforms.py +42 -0
- autovision/tasks/depth_estimation/__init__.py +18 -0
- autovision/tasks/depth_estimation/gtr/__init__.py +18 -0
- autovision/tasks/depth_estimation/gtr/config.py +51 -0
- autovision/tasks/depth_estimation/gtr/dpt_head.py +136 -0
- autovision/tasks/depth_estimation/gtr/task_model.py +256 -0
- autovision/tasks/depth_estimation/gtr/train_model.py +171 -0
- autovision/tasks/depth_estimation/gtr/transforms.py +69 -0
- autovision/tasks/detection/detr/__init__.py +46 -0
- autovision/tasks/detection/detr/backbone_wrappers.py +378 -0
- autovision/tasks/detection/detr/coco_checkpoint.py +586 -0
- autovision/tasks/detection/detr/config.py +808 -0
- autovision/tasks/detection/detr/dfine_official_warm_start.py +207 -0
- autovision/tasks/detection/detr/dome_decoder.py +395 -0
- autovision/tasks/detection/detr/dome_encoder.py +154 -0
- autovision/tasks/detection/detr/gtr_teacher.py +153 -0
- autovision/tasks/detection/detr/optimizer.py +201 -0
- autovision/tasks/detection/detr/task_model.py +931 -0
- autovision/tasks/detection/detr/train_model.py +1087 -0
- autovision/tasks/detection/detr/transforms.py +75 -0
- autovision/tasks/detection/detr/variants.py +540 -0
- autovision/tasks/detection/dfine/__init__.py +18 -0
- autovision/tasks/detection/dfine/config.py +23 -0
- autovision/tasks/detection/dfine/task_model.py +72 -0
- autovision/tasks/detection/dfine/train_model.py +103 -0
- autovision/tasks/detection/picodet/__init__.py +18 -0
- autovision/tasks/detection/picodet/config.py +75 -0
- autovision/tasks/detection/picodet/csp_pan.py +83 -0
- autovision/tasks/detection/picodet/esnet.py +162 -0
- autovision/tasks/detection/picodet/losses.py +194 -0
- autovision/tasks/detection/picodet/pico_head.py +131 -0
- autovision/tasks/detection/picodet/postprocessor.py +69 -0
- autovision/tasks/detection/picodet/sim_ota_assigner.py +181 -0
- autovision/tasks/detection/picodet/task_model.py +177 -0
- autovision/tasks/detection/picodet/train_model.py +200 -0
- autovision/tasks/detection/pretrained.py +224 -0
- autovision/tasks/detection/rfdetr/__init__.py +22 -0
- autovision/tasks/detection/rfdetr/config.py +292 -0
- autovision/tasks/detection/rfdetr/task_model.py +602 -0
- autovision/tasks/detection/rfdetr/train_model.py +559 -0
- autovision/tasks/detection/rtdetr/__init__.py +18 -0
- autovision/tasks/detection/rtdetr/config.py +79 -0
- autovision/tasks/detection/rtdetr/task_model.py +234 -0
- autovision/tasks/detection/rtdetr/train_model.py +301 -0
- autovision/tasks/detection/shared/__init__.py +29 -0
- autovision/tasks/detection/shared/decode.py +57 -0
- autovision/tasks/detection/shared/defe.py +292 -0
- autovision/tasks/detection/shared/denoising.py +248 -0
- autovision/tasks/detection/shared/dfine_criterion.py +977 -0
- autovision/tasks/detection/shared/dfine_decoder.py +374 -0
- autovision/tasks/detection/shared/dfine_official_decoder.py +1329 -0
- autovision/tasks/detection/shared/dfine_utils.py +584 -0
- autovision/tasks/detection/shared/distillation.py +216 -0
- autovision/tasks/detection/shared/dynamic_nms.py +108 -0
- autovision/tasks/detection/shared/fdconv.py +106 -0
- autovision/tasks/detection/shared/gtr/__init__.py +62 -0
- autovision/tasks/detection/shared/gtr/encoder.py +346 -0
- autovision/tasks/detection/shared/gtr/obb_criterion.py +640 -0
- autovision/tasks/detection/shared/gtr/obb_decoder.py +1043 -0
- autovision/tasks/detection/shared/gtr/obb_denoising.py +154 -0
- autovision/tasks/detection/shared/gtr/pose_criterion.py +602 -0
- autovision/tasks/detection/shared/gtr/pose_decoder.py +924 -0
- autovision/tasks/detection/shared/gtr/pose_dn.py +186 -0
- autovision/tasks/detection/shared/gtr/rbox_ops.py +250 -0
- autovision/tasks/detection/shared/gtr/segmentation_head.py +225 -0
- autovision/tasks/detection/shared/gtr/spatial_swiglu.py +140 -0
- autovision/tasks/detection/shared/gtr/vit_adapter.py +1142 -0
- autovision/tasks/detection/shared/hybrid_encoder.py +340 -0
- autovision/tasks/detection/shared/matcher.py +470 -0
- autovision/tasks/detection/shared/ms_deformable_attention.py +139 -0
- autovision/tasks/detection/shared/msda.py +164 -0
- autovision/tasks/detection/shared/multistep_schedule.py +46 -0
- autovision/tasks/detection/shared/mwas.py +339 -0
- autovision/tasks/detection/shared/open_vocab.py +445 -0
- autovision/tasks/detection/shared/pseudo_label.py +331 -0
- autovision/tasks/detection/shared/rtdetrv2_criterion.py +366 -0
- autovision/tasks/detection/shared/rtdetrv2_decoder.py +1061 -0
- autovision/tasks/detection/shared/ssl_contrastive.py +1045 -0
- autovision/tasks/instance_segmentation/dinov2_eomt/__init__.py +19 -0
- autovision/tasks/instance_segmentation/dinov2_eomt/config.py +30 -0
- autovision/tasks/instance_segmentation/dinov2_eomt/task_model.py +53 -0
- autovision/tasks/instance_segmentation/dinov2_eomt/train_model.py +146 -0
- autovision/tasks/instance_segmentation/dinov3_eomt/__init__.py +18 -0
- autovision/tasks/instance_segmentation/dinov3_eomt/config.py +23 -0
- autovision/tasks/instance_segmentation/dinov3_eomt/task_model.py +45 -0
- autovision/tasks/instance_segmentation/dinov3_eomt/train_model.py +54 -0
- autovision/tasks/instance_segmentation/gtr/__init__.py +14 -0
- autovision/tasks/instance_segmentation/gtr/config.py +37 -0
- autovision/tasks/instance_segmentation/gtr/task_model.py +224 -0
- autovision/tasks/instance_segmentation/gtr/train_model.py +122 -0
- autovision/tasks/oriented_detection/gtr/__init__.py +21 -0
- autovision/tasks/oriented_detection/gtr/config.py +63 -0
- autovision/tasks/oriented_detection/gtr/task_model.py +317 -0
- autovision/tasks/oriented_detection/gtr/train_model.py +211 -0
- autovision/tasks/oriented_detection/rtdetr/__init__.py +18 -0
- autovision/tasks/oriented_detection/rtdetr/config.py +33 -0
- autovision/tasks/oriented_detection/rtdetr/task_model.py +151 -0
- autovision/tasks/oriented_detection/rtdetr/train_model.py +158 -0
- autovision/tasks/oriented_detection/shared/obb_criterion.py +202 -0
- autovision/tasks/oriented_detection/shared/obb_decoder.py +338 -0
- autovision/tasks/panoptic_segmentation/dinov2_eomt/__init__.py +19 -0
- autovision/tasks/panoptic_segmentation/dinov2_eomt/config.py +43 -0
- autovision/tasks/panoptic_segmentation/dinov2_eomt/task_model.py +83 -0
- autovision/tasks/panoptic_segmentation/dinov2_eomt/train_model.py +109 -0
- autovision/tasks/panoptic_segmentation/dinov3_eomt/__init__.py +18 -0
- autovision/tasks/panoptic_segmentation/dinov3_eomt/config.py +40 -0
- autovision/tasks/panoptic_segmentation/dinov3_eomt/task_model.py +60 -0
- autovision/tasks/panoptic_segmentation/dinov3_eomt/train_model.py +59 -0
- autovision/tasks/pose_estimation/__init__.py +18 -0
- autovision/tasks/pose_estimation/gtr/__init__.py +26 -0
- autovision/tasks/pose_estimation/gtr/config.py +99 -0
- autovision/tasks/pose_estimation/gtr/task_model.py +351 -0
- autovision/tasks/pose_estimation/gtr/train_model.py +275 -0
- autovision/tasks/pose_estimation/gtr/transforms.py +402 -0
- autovision/tasks/semantic_segmentation/dinov2_eomt/__init__.py +19 -0
- autovision/tasks/semantic_segmentation/dinov2_eomt/config.py +57 -0
- autovision/tasks/semantic_segmentation/dinov2_eomt/task_model.py +166 -0
- autovision/tasks/semantic_segmentation/dinov2_eomt/train_model.py +150 -0
- autovision/tasks/semantic_segmentation/dinov3_eomt/__init__.py +19 -0
- autovision/tasks/semantic_segmentation/dinov3_eomt/config.py +40 -0
- autovision/tasks/semantic_segmentation/dinov3_eomt/task_model.py +142 -0
- autovision/tasks/semantic_segmentation/dinov3_eomt/train_model.py +51 -0
- autovision/tasks/semantic_segmentation/gtr/__init__.py +14 -0
- autovision/tasks/semantic_segmentation/gtr/config.py +60 -0
- autovision/tasks/semantic_segmentation/gtr/segmentation_head.py +46 -0
- autovision/tasks/semantic_segmentation/gtr/task_model.py +277 -0
- autovision/tasks/semantic_segmentation/gtr/train_model.py +159 -0
- autovision/tasks/semantic_segmentation/linear/__init__.py +18 -0
- autovision/tasks/semantic_segmentation/linear/config.py +44 -0
- autovision/tasks/semantic_segmentation/linear/task_model.py +163 -0
- autovision/tasks/semantic_segmentation/linear/train_model.py +128 -0
- autovision/tasks/semantic_segmentation/linear/transforms.py +66 -0
- autovision/tasks/shared/__init__.py +11 -0
- autovision/tasks/shared/ema.py +100 -0
- autovision/tasks/shared/eomt/__init__.py +17 -0
- autovision/tasks/shared/eomt/labels.py +39 -0
- autovision/tasks/shared/eomt/modeling.py +249 -0
- autovision/tasks/shared/eomt/postprocess.py +210 -0
- autovision/tasks/shared/eomt/scheduler.py +70 -0
- autovision/tasks/shared/eomt/transforms.py +170 -0
- autovision/tasks/shared/flat_cosine.py +95 -0
- autovision/tasks/shared/gradient_checkpointing.py +74 -0
- autovision/tasks/shared/sahi.py +9 -0
- autovision/tasks/shared/tiling_utils.py +340 -0
- autovision/tasks/task_model.py +267 -0
- autovision/tasks/task_model_helpers.py +289 -0
- autovision/tasks/task_model_io.py +68 -0
- autovision/tasks/train_model.py +138 -0
- autovision/tracking/__init__.py +26 -0
- autovision/tracking/analytics.py +331 -0
- autovision/tracking/byte_track.py +477 -0
- autovision/types.py +55 -0
- autovision/visualize/__init__.py +65 -0
- autovision/visualize/annotators.py +737 -0
- autovision/visualize/detection.py +165 -0
- autovision/visualize/effects.py +694 -0
- autovision/visualize/skeletons.py +87 -0
- autovision/visualize/zones.py +104 -0
- autovision_framework-0.3.0.dist-info/METADATA +184 -0
- autovision_framework-0.3.0.dist-info/RECORD +404 -0
- autovision_framework-0.3.0.dist-info/WHEEL +5 -0
- autovision_framework-0.3.0.dist-info/entry_points.txt +2 -0
- autovision_framework-0.3.0.dist-info/licenses/LICENSE +202 -0
- autovision_framework-0.3.0.dist-info/licenses/NOTICE +178 -0
- autovision_framework-0.3.0.dist-info/licenses/THIRD_PARTY_LICENSES.md +82 -0
- autovision_framework-0.3.0.dist-info/top_level.txt +1 -0
autovision/__init__.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""AutoVision: enterprise visual model training framework.
|
|
3
|
+
|
|
4
|
+
Public API:
|
|
5
|
+
|
|
6
|
+
- :func:`autovision.pretrain` — self-supervised pretraining / distillation.
|
|
7
|
+
- :func:`autovision.detection` / :func:`autovision.load_model` — object
|
|
8
|
+
detection model handles (``train / val / predict / export``).
|
|
9
|
+
- :func:`autovision.ensure_coco8` — bundled synthetic smoke dataset.
|
|
10
|
+
- :func:`autovision.list_models` — all models exposed by registered packages.
|
|
11
|
+
- :func:`autovision.list_methods` — all registered pretraining methods.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
import torch
|
|
20
|
+
|
|
21
|
+
from autovision import errors
|
|
22
|
+
from autovision._compat import install_graphmodule_deepcopy_fix
|
|
23
|
+
from autovision._version import __version__
|
|
24
|
+
from autovision.cli import (
|
|
25
|
+
PretrainConfig,
|
|
26
|
+
PretrainResult,
|
|
27
|
+
TaskTrainResult,
|
|
28
|
+
pretrain,
|
|
29
|
+
train_depth_estimation,
|
|
30
|
+
train_image_classification,
|
|
31
|
+
train_instance_segmentation,
|
|
32
|
+
train_object_detection,
|
|
33
|
+
train_oriented_object_detection,
|
|
34
|
+
train_panoptic_segmentation,
|
|
35
|
+
train_pose_estimation,
|
|
36
|
+
train_semantic_segmentation,
|
|
37
|
+
)
|
|
38
|
+
from autovision.cli.extract_video_frames import extract_video_frames
|
|
39
|
+
from autovision.cli.model_handle import (
|
|
40
|
+
DetectionModel,
|
|
41
|
+
detection,
|
|
42
|
+
evaluate_object_detection,
|
|
43
|
+
load_model,
|
|
44
|
+
)
|
|
45
|
+
from autovision.data.coco8 import ensure_coco8
|
|
46
|
+
from autovision.encoders import list_models
|
|
47
|
+
from autovision.errors import AutoVisionError
|
|
48
|
+
from autovision.export import benchmark, measure_model_cost
|
|
49
|
+
from autovision.features import embed
|
|
50
|
+
from autovision.plugins import (
|
|
51
|
+
PluginInfo,
|
|
52
|
+
discover_plugins,
|
|
53
|
+
list_plugins,
|
|
54
|
+
register_plugin,
|
|
55
|
+
)
|
|
56
|
+
from autovision.pretext import list_methods
|
|
57
|
+
from autovision.registry.catalog import (
|
|
58
|
+
describe_model,
|
|
59
|
+
get_model_entry,
|
|
60
|
+
list_task_models,
|
|
61
|
+
)
|
|
62
|
+
from autovision.runtime.checkpoint import CHECKPOINT_AUTOVISION_KEY
|
|
63
|
+
from autovision.tasks.task_model_helpers import load_task_model
|
|
64
|
+
|
|
65
|
+
# Third-party defect shims must be installed before any model construction.
|
|
66
|
+
install_graphmodule_deepcopy_fix()
|
|
67
|
+
|
|
68
|
+
__all__ = [
|
|
69
|
+
"AutoVisionError",
|
|
70
|
+
"DetectionModel",
|
|
71
|
+
"PluginInfo",
|
|
72
|
+
"PretrainConfig",
|
|
73
|
+
"PretrainResult",
|
|
74
|
+
"__version__",
|
|
75
|
+
"detection",
|
|
76
|
+
"describe_model",
|
|
77
|
+
"discover_plugins",
|
|
78
|
+
"errors",
|
|
79
|
+
"get_model_entry",
|
|
80
|
+
"list_methods",
|
|
81
|
+
"list_models",
|
|
82
|
+
"list_plugins",
|
|
83
|
+
"list_task_models",
|
|
84
|
+
"register_plugin",
|
|
85
|
+
"embed",
|
|
86
|
+
"benchmark",
|
|
87
|
+
"measure_model_cost",
|
|
88
|
+
"ensure_coco8",
|
|
89
|
+
"evaluate_object_detection",
|
|
90
|
+
"extract_video_frames",
|
|
91
|
+
"load_embedding_model",
|
|
92
|
+
"load_model",
|
|
93
|
+
"load_task_model",
|
|
94
|
+
"pretrain",
|
|
95
|
+
"train_image_classification",
|
|
96
|
+
"train_instance_segmentation",
|
|
97
|
+
"train_object_detection",
|
|
98
|
+
"train_oriented_object_detection",
|
|
99
|
+
"train_panoptic_segmentation",
|
|
100
|
+
"train_semantic_segmentation",
|
|
101
|
+
"train_depth_estimation",
|
|
102
|
+
"train_pose_estimation",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def load_embedding_model(path: str | Path, device: str | None = None) -> Any:
|
|
107
|
+
"""Load an exported embedding model (``exported_models/*.pt``).
|
|
108
|
+
|
|
109
|
+
Rebuilds the ``FeatureExtractor`` from the exported metadata. The backbone
|
|
110
|
+
must be resolvable via ``model_name`` recorded in the export — the
|
|
111
|
+
export stores the state dict and normalization args; the backbone name
|
|
112
|
+
is part of the run config, so this loader accepts it explicitly.
|
|
113
|
+
"""
|
|
114
|
+
from autovision.encoders import FeatureExtractor, get_wrapped_model
|
|
115
|
+
from autovision.encoders._model_helpers import load_state_dict_compat
|
|
116
|
+
|
|
117
|
+
raw = torch.load(path, map_location="cpu", weights_only=True)
|
|
118
|
+
if not isinstance(raw, dict) or "kind" not in raw:
|
|
119
|
+
raise ValueError(f"File '{path}' is not an exported AutoVision model.")
|
|
120
|
+
model_name = raw.get("model_name")
|
|
121
|
+
if model_name is None:
|
|
122
|
+
raise ValueError(
|
|
123
|
+
f"Export '{path}' does not record 'model_name'; pass the model "
|
|
124
|
+
f"specification to rebuild the backbone."
|
|
125
|
+
)
|
|
126
|
+
wrapper = get_wrapped_model(model_name)
|
|
127
|
+
embedding_model = FeatureExtractor(
|
|
128
|
+
wrapped_model=wrapper, embed_dim=raw.get("embed_dim")
|
|
129
|
+
)
|
|
130
|
+
load_state_dict_compat(embedding_model, raw["state_dict"])
|
|
131
|
+
if device is not None:
|
|
132
|
+
embedding_model.to(device)
|
|
133
|
+
embedding_model.eval()
|
|
134
|
+
return embedding_model
|
autovision/_compat.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""Compatibility shims for known third-party defects.
|
|
3
|
+
|
|
4
|
+
Imported once by :mod:`autovision` (see package ``__init__``) so that every
|
|
5
|
+
``copy.deepcopy`` site in the codebase — EMA trackers, distillation teachers,
|
|
6
|
+
export benchmarks — is protected from the GraphModule defect below.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import copy
|
|
12
|
+
|
|
13
|
+
__all__ = ["install_graphmodule_deepcopy_fix"]
|
|
14
|
+
|
|
15
|
+
_PATCH_FLAG = "_autovision_graphmodule_deepcopy_fix"
|
|
16
|
+
# Plain attributes torchvision's GraphModule stores in __init__ and swaps in
|
|
17
|
+
# train(); torch.fx.GraphModule.__deepcopy__ does not carry them over.
|
|
18
|
+
_GRAPH_ATTRS = ("train_graph", "eval_graph")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def install_graphmodule_deepcopy_fix() -> None:
|
|
22
|
+
"""Keep torchvision ``GraphModule`` train/eval graphs alive across deepcopy.
|
|
23
|
+
|
|
24
|
+
``torch.fx.GraphModule.__deepcopy__`` rebuilds the copy with ``__new__``
|
|
25
|
+
plus the fx base-class ``__init__`` and only restores a fixed list of
|
|
26
|
+
hook attributes. torchvision's ``feature_extraction.GraphModule`` and
|
|
27
|
+
``DualGraphModule`` (used by the RT-DETR / DFINE hybrid encoders) store
|
|
28
|
+
``train_graph`` / ``eval_graph`` as plain attributes and swap
|
|
29
|
+
``self.graph`` inside ``train()`` — the fx copy drops them, so any
|
|
30
|
+
``.eval()`` / ``.train()`` on a deepcopied model raises
|
|
31
|
+
``AttributeError: 'GraphModule' object has no attribute 'eval_graph'``.
|
|
32
|
+
|
|
33
|
+
The fx implementation already deep-copied the full ``__dict__`` into an
|
|
34
|
+
intermediate module, so re-copying the two graphs here is served by the
|
|
35
|
+
shared memo. Idempotent; a no-op without torchvision.
|
|
36
|
+
"""
|
|
37
|
+
try:
|
|
38
|
+
from torchvision.models import feature_extraction as _fe
|
|
39
|
+
except ImportError: # torchvision is optional for pure-pretraining flows
|
|
40
|
+
return
|
|
41
|
+
for graph_module_cls in (
|
|
42
|
+
getattr(_fe, "GraphModule", None),
|
|
43
|
+
getattr(_fe, "DualGraphModule", None),
|
|
44
|
+
):
|
|
45
|
+
if graph_module_cls is None or getattr(graph_module_cls, _PATCH_FLAG, False):
|
|
46
|
+
continue
|
|
47
|
+
setattr(graph_module_cls, _PATCH_FLAG, True)
|
|
48
|
+
fx_deepcopy = graph_module_cls.__deepcopy__
|
|
49
|
+
|
|
50
|
+
def __deepcopy__(self, memo, _fx_deepcopy=fx_deepcopy): # noqa: N807
|
|
51
|
+
res = _fx_deepcopy(self, memo)
|
|
52
|
+
for attr in _GRAPH_ATTRS:
|
|
53
|
+
if attr in self.__dict__ and not hasattr(res, attr):
|
|
54
|
+
setattr(res, attr, copy.deepcopy(self.__dict__[attr], memo))
|
|
55
|
+
return res
|
|
56
|
+
|
|
57
|
+
graph_module_cls.__deepcopy__ = __deepcopy__
|
autovision/_license.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""License notice embedded into checkpoints and exported models."""
|
|
3
|
+
|
|
4
|
+
__all__ = ["LICENSE_INFO"]
|
|
5
|
+
|
|
6
|
+
LICENSE_INFO = (
|
|
7
|
+
"AutoVision License Notice\n"
|
|
8
|
+
"\n"
|
|
9
|
+
"The AutoVision framework is licensed under Apache-2.0. Trained model "
|
|
10
|
+
"weights may be subject to additional licenses: check the licenses of the "
|
|
11
|
+
"backbone models, teacher weights, and training data used for a given "
|
|
12
|
+
"run before any production use."
|
|
13
|
+
)
|
autovision/_version.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""Single source of truth for the framework version (no import cycles).
|
|
3
|
+
|
|
4
|
+
Read by three consumers, all of which must stay consistent:
|
|
5
|
+
|
|
6
|
+
- ``pyproject.toml`` packaging (``[tool.setuptools.dynamic]``, static AST
|
|
7
|
+
read — keep the assignment a plain string literal);
|
|
8
|
+
- the public ``autovision.__version__`` export;
|
|
9
|
+
- release tooling / tests (version vs ``CHANGELOG.md`` vs the ``vX.Y.Z``
|
|
10
|
+
release tag, see ``docs/release_process.md``).
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__all__ = ["__version__"]
|
|
14
|
+
|
|
15
|
+
__version__ = "0.3.0"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""Transforms: argument models, view pipelines, and method transforms."""
|
|
3
|
+
|
|
4
|
+
from autovision.augment.method_transform import MethodTransform, MultiViewTransform
|
|
5
|
+
from autovision.augment.transform_args import (
|
|
6
|
+
ColorJitterArgs,
|
|
7
|
+
GaussianBlurArgs,
|
|
8
|
+
MethodTransformArgs,
|
|
9
|
+
NormalizeArgs,
|
|
10
|
+
RandomFlipArgs,
|
|
11
|
+
RandomResizeArgs,
|
|
12
|
+
SolarizeArgs,
|
|
13
|
+
)
|
|
14
|
+
from autovision.augment.view_transform import ViewTransform
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ColorJitterArgs",
|
|
18
|
+
"GaussianBlurArgs",
|
|
19
|
+
"MethodTransform",
|
|
20
|
+
"MethodTransformArgs",
|
|
21
|
+
"MultiViewTransform",
|
|
22
|
+
"NormalizeArgs",
|
|
23
|
+
"RandomFlipArgs",
|
|
24
|
+
"RandomResizeArgs",
|
|
25
|
+
"SolarizeArgs",
|
|
26
|
+
"ViewTransform",
|
|
27
|
+
]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""Detection transform family (torchvision v2 based, step scheduled)."""
|
|
3
|
+
|
|
4
|
+
from autovision.augment.detection.args import (
|
|
5
|
+
OrientedObjectDetectionTransformArgs,
|
|
6
|
+
RTDETRDetectionTransformArgs,
|
|
7
|
+
ScaleJitterArgs,
|
|
8
|
+
)
|
|
9
|
+
from autovision.augment.detection.collate import (
|
|
10
|
+
RTDETRDetectionCollateFunction,
|
|
11
|
+
TwoViewDetectionCollateFunction,
|
|
12
|
+
)
|
|
13
|
+
from autovision.augment.detection.oriented_transform import (
|
|
14
|
+
OrientedObjectDetectionCollateFunction,
|
|
15
|
+
OrientedObjectDetectionTransform,
|
|
16
|
+
build_oriented_val_transform_args,
|
|
17
|
+
)
|
|
18
|
+
from autovision.augment.detection.schedule import (
|
|
19
|
+
StepSchedule,
|
|
20
|
+
resolve_detection_step_schedule,
|
|
21
|
+
)
|
|
22
|
+
from autovision.augment.detection.transform import (
|
|
23
|
+
RTDETRDetectionTransform,
|
|
24
|
+
StepScheduledCompose,
|
|
25
|
+
build_val_transform_args,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"OrientedObjectDetectionCollateFunction",
|
|
30
|
+
"OrientedObjectDetectionTransform",
|
|
31
|
+
"OrientedObjectDetectionTransformArgs",
|
|
32
|
+
"RTDETRDetectionCollateFunction",
|
|
33
|
+
"RTDETRDetectionTransform",
|
|
34
|
+
"RTDETRDetectionTransformArgs",
|
|
35
|
+
"ScaleJitterArgs",
|
|
36
|
+
"StepSchedule",
|
|
37
|
+
"StepScheduledCompose",
|
|
38
|
+
"TwoViewDetectionCollateFunction",
|
|
39
|
+
"build_oriented_val_transform_args",
|
|
40
|
+
"build_val_transform_args",
|
|
41
|
+
"resolve_detection_step_schedule",
|
|
42
|
+
]
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Copyright (c) 2026 AutoVision contributors. Apache-2.0.
|
|
2
|
+
"""Detection transform arguments with step-window policies."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
9
|
+
|
|
10
|
+
from autovision.augment.task_transform import TaskTransformArgs
|
|
11
|
+
from autovision.augment.transform_args import NormalizeArgs
|
|
12
|
+
from autovision.config.base import PydanticConfig
|
|
13
|
+
from autovision.types import ImageSizeTuple
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"OrientedObjectDetectionTransformArgs",
|
|
17
|
+
"RTDETRDetectionTransformArgs",
|
|
18
|
+
"ScaleJitterArgs",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ScaleJitterArgs(PydanticConfig):
|
|
23
|
+
sizes: list[int]
|
|
24
|
+
prob: float = 1.0
|
|
25
|
+
#: Step at which batch scale jitter turns OFF (the baseline disables it
|
|
26
|
+
#: for the final no-augmentation window). ``None`` keeps it on for the
|
|
27
|
+
#: whole run; ``"auto"`` resolves to the shared step schedule.
|
|
28
|
+
step_stop: int | None | str = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class OrientedObjectDetectionTransformArgs(TaskTransformArgs):
|
|
32
|
+
"""Oriented (YOLO-OBB) detection recipe.
|
|
33
|
+
|
|
34
|
+
Rotated-box pipeline: flips mirror corners, resize scales corners,
|
|
35
|
+
polygons are sanitized by px² shoelace area. IoU-crop / zoom-out /
|
|
36
|
+
scale-jitter / mixup are omitted — the torchvision v2 implementations
|
|
37
|
+
behind them are axis-aligned-box-only.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
image_size: ImageSizeTuple = (640, 640)
|
|
41
|
+
photometric_distort_prob: float | None = 0.5
|
|
42
|
+
horizontal_flip_prob: float = 0.5
|
|
43
|
+
vertical_flip_prob: float = 0.0
|
|
44
|
+
normalize: NormalizeArgs = Field(default_factory=NormalizeArgs)
|
|
45
|
+
min_bbox_size_px: float = 4.0
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class RTDETRDetectionTransformArgs(TaskTransformArgs):
|
|
49
|
+
"""Detection recipe (train defaults; the val recipe disables them)."""
|
|
50
|
+
|
|
51
|
+
image_size: ImageSizeTuple | Literal["auto"] = "auto"
|
|
52
|
+
num_channels: int | Literal["auto"] = "auto"
|
|
53
|
+
photometric_distort_prob: float | None = 0.5
|
|
54
|
+
random_zoom_out_prob: float | None = 0.5
|
|
55
|
+
random_iou_crop_prob: float | None = 0.8
|
|
56
|
+
horizontal_flip_prob: float = 0.5
|
|
57
|
+
vertical_flip_prob: float = 0.0
|
|
58
|
+
scale_jitter: ScaleJitterArgs | None = Field(
|
|
59
|
+
default_factory=lambda: ScaleJitterArgs(
|
|
60
|
+
sizes=[480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800]
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
mixup_prob: float | None = 0.5
|
|
64
|
+
#: Copy-paste blending (baseline AV-DETR CopyBlend, XOR with mixup in
|
|
65
|
+
#: the collate): paste up to ``num_objects`` object crops sampled from
|
|
66
|
+
#: the batch pool into each image, beta-blended. Default off; the
|
|
67
|
+
#: VisDrone/official recipes disable both mixup and copyblend.
|
|
68
|
+
copyblend_prob: float | None = None
|
|
69
|
+
copyblend_area_threshold: int = 100
|
|
70
|
+
copyblend_num_objects: int = 3
|
|
71
|
+
copyblend_expand_ratios: tuple[float, float] = (0.1, 0.25)
|
|
72
|
+
#: Step at which copy-paste blending turns ON (baseline CopyBlend
|
|
73
|
+
#: window is ``[step_start, step_stop)`` with the start shared with
|
|
74
|
+
#: the photometric family). An unresolved ``"auto"`` keeps it OFF —
|
|
75
|
+
#: the baseline's fail-closed gate.
|
|
76
|
+
copyblend_step_start: int | str = "auto"
|
|
77
|
+
copyblend_step_stop: int | None | str = "auto"
|
|
78
|
+
mixup_step_start: int | str = "auto"
|
|
79
|
+
mixup_step_stop: int | None | str = "auto"
|
|
80
|
+
#: Mosaic (4-tile sample-level paste; off by default — the AV-DETR
|
|
81
|
+
#: family enables it per the baseline recipe). Mosaic samples skip the
|
|
82
|
+
#: zoom-out and IoU-crop ops for that step.
|
|
83
|
+
mosaic_prob: float | None = None
|
|
84
|
+
mosaic_output_size: int = 320
|
|
85
|
+
mosaic_step_start: int | str = "auto"
|
|
86
|
+
mosaic_step_stop: int | None | str = "auto"
|
|
87
|
+
#: Box-aware background erasure (rf-detr-ssl-v2 design doc 8): erase a
|
|
88
|
+
#: uniform random subset of ``random_erase_cell``-px background cells per
|
|
89
|
+
#: view while protecting every margin-dilated GT box (any-overlap), so
|
|
90
|
+
#: Hungarian matching never sees an evidence-free box. None = off.
|
|
91
|
+
random_erase_prob: float | None = None
|
|
92
|
+
random_erase_ratio: float = Field(default=0.4, gt=0.0, le=1.0)
|
|
93
|
+
random_erase_padding: float = Field(default=0.15, ge=0.0)
|
|
94
|
+
#: Cell edge in px. On a ViT backbone this aligns with the patch size;
|
|
95
|
+
#: on ConvNeXt (stride-4 stages) 16px is an empirical granularity
|
|
96
|
+
#: choice, not a structural alignment.
|
|
97
|
+
random_erase_cell: int = Field(default=16, ge=1)
|
|
98
|
+
#: Constrained foreground erasure (design doc V2): box interiors become
|
|
99
|
+
#: erasable behind a per-box reservation, so every object keeps at least
|
|
100
|
+
#: ``random_erase_min_keep`` patches (boxes with at most that many cells
|
|
101
|
+
#: stay fully protected).
|
|
102
|
+
random_erase_interior: bool = False
|
|
103
|
+
random_erase_min_keep: int = Field(default=2, ge=1)
|
|
104
|
+
#: Step at which erasure turns OFF (the Dome aug-stop cadence: training
|
|
105
|
+
#: ends on the dense distribution it deploys with). "auto" resolves
|
|
106
|
+
#: to the shared step schedule; None keeps the constant ratio for
|
|
107
|
+
#: the whole run (the reference-recommended first setting).
|
|
108
|
+
random_erase_step_stop: int | None | str = "auto"
|
|
109
|
+
normalize: NormalizeArgs = Field(default_factory=NormalizeArgs)
|
|
110
|
+
min_bbox_size_px: float = 4.0
|
|
111
|
+
|
|
112
|
+
# Step windows (auto: resolved from the training schedule).
|
|
113
|
+
photometric_step_start: int | str = "auto"
|
|
114
|
+
photometric_step_stop: int | None | str = "auto"
|
|
115
|
+
zoom_out_step_start: int | str = "auto"
|
|
116
|
+
zoom_out_step_stop: int | None | str = "auto"
|
|
117
|
+
iou_crop_step_start: int | str = "auto"
|
|
118
|
+
iou_crop_step_stop: int | None | str = "auto"
|
|
119
|
+
|
|
120
|
+
def resolve_auto_fields(self, **kwargs) -> None:
|
|
121
|
+
num_channels = kwargs.get("num_channels")
|
|
122
|
+
if self.image_size == "auto":
|
|
123
|
+
default = kwargs.get("default_image_size", (640, 640))
|
|
124
|
+
self.image_size = tuple(default) # type: ignore[assignment]
|
|
125
|
+
if self.num_channels == "auto":
|
|
126
|
+
self.num_channels = (
|
|
127
|
+
num_channels if num_channels is not None else len(self.normalize.mean)
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
def resolve_step_schedule(
|
|
131
|
+
self, total_steps: int, train_num_batches: int, gradient_accumulation_steps: int
|
|
132
|
+
) -> None:
|
|
133
|
+
from autovision.augment.detection.schedule import (
|
|
134
|
+
resolve_detection_step_schedule,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
steps_per_epoch = max(
|
|
138
|
+
1, train_num_batches // max(1, gradient_accumulation_steps)
|
|
139
|
+
)
|
|
140
|
+
schedule = resolve_detection_step_schedule(total_steps, steps_per_epoch)
|
|
141
|
+
for op, start_attr, stop_attr in (
|
|
142
|
+
("photometric", "photometric_step_start", "photometric_step_stop"),
|
|
143
|
+
("zoom_out", "zoom_out_step_start", "zoom_out_step_stop"),
|
|
144
|
+
("iou_crop", "iou_crop_step_start", "iou_crop_step_stop"),
|
|
145
|
+
("mixup", "mixup_step_start", "mixup_step_stop"),
|
|
146
|
+
("mosaic", "mosaic_step_start", "mosaic_step_stop"),
|
|
147
|
+
):
|
|
148
|
+
start, stop = schedule.window(op)
|
|
149
|
+
if getattr(self, start_attr) == "auto":
|
|
150
|
+
setattr(self, start_attr, start)
|
|
151
|
+
if getattr(self, stop_attr) == "auto":
|
|
152
|
+
setattr(self, stop_attr, stop)
|
|
153
|
+
if self.scale_jitter is not None and self.scale_jitter.step_stop == "auto":
|
|
154
|
+
self.scale_jitter.step_stop = schedule.stop
|
|
155
|
+
if self.copyblend_step_start == "auto":
|
|
156
|
+
# Baseline CopyBlend shares the photometric family's start.
|
|
157
|
+
self.copyblend_step_start = schedule.start
|
|
158
|
+
if self.copyblend_step_stop == "auto":
|
|
159
|
+
# Same photometric-family stop window as the baseline; leaving
|
|
160
|
+
# "auto" unresolved made the collate treat it as None and kept
|
|
161
|
+
# copyblend on for the WHOLE run.
|
|
162
|
+
self.copyblend_step_stop = schedule.stop
|
|
163
|
+
if self.random_erase_step_stop == "auto":
|
|
164
|
+
self.random_erase_step_stop = schedule.stop
|
|
165
|
+
|
|
166
|
+
def resolve_incompatible(self) -> None:
|
|
167
|
+
if self.num_channels != 3:
|
|
168
|
+
self.photometric_distort_prob = None
|