mblt-vision-python 0.0.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.
- mblt_vision/__init__.py +86 -0
- mblt_vision/_api.py +53 -0
- mblt_vision/_compat.py +227 -0
- mblt_vision/_model_paths.py +137 -0
- mblt_vision/_tasks.py +30 -0
- mblt_vision/benchmark/__init__.py +1 -0
- mblt_vision/benchmark/argparse_utils.py +106 -0
- mblt_vision/benchmark/chart_utils.py +146 -0
- mblt_vision/benchmark/io_utils.py +64 -0
- mblt_vision/benchmark/summary_utils.py +770 -0
- mblt_vision/cli/__init__.py +5 -0
- mblt_vision/cli/__main__.py +5 -0
- mblt_vision/cli/_vision.py +337 -0
- mblt_vision/cli/compile.py +117 -0
- mblt_vision/cli/main.py +35 -0
- mblt_vision/cli/predict.py +64 -0
- mblt_vision/cli/val.py +562 -0
- mblt_vision/compile/__init__.py +21 -0
- mblt_vision/compile/vision.py +1120 -0
- mblt_vision/datasets/__init__.py +15 -0
- mblt_vision/datasets/ade20k.yaml +164 -0
- mblt_vision/datasets/cityscapes.yaml +54 -0
- mblt_vision/datasets/coco.yaml +178 -0
- mblt_vision/datasets/dotav1.yaml +28 -0
- mblt_vision/datasets/imagenet.yaml +1019 -0
- mblt_vision/datasets/imagenet_synsets.txt +1000 -0
- mblt_vision/datasets/nyu-depth.yaml +7 -0
- mblt_vision/datasets/registry.py +158 -0
- mblt_vision/datasets/widerface.yaml +9 -0
- mblt_vision/depth_estimation/__init__.py +19 -0
- mblt_vision/face_detection/__init__.py +43 -0
- mblt_vision/image_classification/__init__.py +311 -0
- mblt_vision/instance_segmentation/__init__.py +65 -0
- mblt_vision/models/AlexNet.yaml +23 -0
- mblt_vision/models/CAFormer_B36.yaml +22 -0
- mblt_vision/models/CAFormer_M36.yaml +22 -0
- mblt_vision/models/CAFormer_S18.yaml +22 -0
- mblt_vision/models/CAFormer_S36.yaml +22 -0
- mblt_vision/models/CoAtNet_0_RW_224.yaml +22 -0
- mblt_vision/models/CoAtNet_1_RW_224.yaml +22 -0
- mblt_vision/models/CoAtNet_2_RW_224.yaml +22 -0
- mblt_vision/models/ConvFormer_B36.yaml +22 -0
- mblt_vision/models/ConvFormer_M36.yaml +22 -0
- mblt_vision/models/ConvFormer_S18.yaml +22 -0
- mblt_vision/models/ConvFormer_S36.yaml +22 -0
- mblt_vision/models/ConvNext_Base.yaml +23 -0
- mblt_vision/models/ConvNext_Large.yaml +23 -0
- mblt_vision/models/ConvNext_Small.yaml +23 -0
- mblt_vision/models/ConvNext_Tiny.yaml +23 -0
- mblt_vision/models/DeiT3_Base_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT3_Base_Patch16_384.yaml +22 -0
- mblt_vision/models/DeiT3_Large_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT3_Large_Patch16_384.yaml +22 -0
- mblt_vision/models/DeiT3_Medium_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT3_Small_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT3_Small_Patch16_384.yaml +22 -0
- mblt_vision/models/DeiT_Base_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT_Base_Patch16_384.yaml +22 -0
- mblt_vision/models/DeiT_Small_Patch16_224.yaml +22 -0
- mblt_vision/models/DeiT_Tiny_Patch16_224.yaml +22 -0
- mblt_vision/models/DenseNet121.yaml +23 -0
- mblt_vision/models/DenseNet161.yaml +23 -0
- mblt_vision/models/DenseNet169.yaml +23 -0
- mblt_vision/models/DenseNet201.yaml +23 -0
- mblt_vision/models/EfficientFormer_L1.yaml +22 -0
- mblt_vision/models/EfficientFormer_L3.yaml +22 -0
- mblt_vision/models/EfficientFormer_L7.yaml +22 -0
- mblt_vision/models/EfficientNet_B0.yaml +23 -0
- mblt_vision/models/EfficientNet_B1.yaml +32 -0
- mblt_vision/models/EfficientNet_B2.yaml +23 -0
- mblt_vision/models/EfficientNet_B3.yaml +23 -0
- mblt_vision/models/EfficientNet_B4.yaml +23 -0
- mblt_vision/models/EfficientNet_B5.yaml +23 -0
- mblt_vision/models/EfficientNet_B6.yaml +23 -0
- mblt_vision/models/EfficientNet_B7.yaml +23 -0
- mblt_vision/models/EfficientNet_V2_L.yaml +23 -0
- mblt_vision/models/EfficientNet_V2_M.yaml +23 -0
- mblt_vision/models/EfficientNet_V2_S.yaml +23 -0
- mblt_vision/models/FlexiVit_Base.yaml +22 -0
- mblt_vision/models/FlexiVit_Large.yaml +22 -0
- mblt_vision/models/FlexiVit_Small.yaml +22 -0
- mblt_vision/models/GELANc-seg.yaml +29 -0
- mblt_vision/models/GELANc.yaml +28 -0
- mblt_vision/models/GELANe.yaml +28 -0
- mblt_vision/models/GELANm.yaml +28 -0
- mblt_vision/models/GELANs.yaml +28 -0
- mblt_vision/models/GoogLeNet.yaml +23 -0
- mblt_vision/models/Inception_V3.yaml +23 -0
- mblt_vision/models/LeViT_Conv_128.yaml +22 -0
- mblt_vision/models/LeViT_Conv_128S.yaml +22 -0
- mblt_vision/models/LeViT_Conv_192.yaml +22 -0
- mblt_vision/models/LeViT_Conv_256.yaml +22 -0
- mblt_vision/models/LeViT_Conv_384.yaml +22 -0
- mblt_vision/models/MNASNet0_5.yaml +23 -0
- mblt_vision/models/MNASNet0_75.yaml +23 -0
- mblt_vision/models/MNASNet1_0.yaml +23 -0
- mblt_vision/models/MNASNet1_3.yaml +23 -0
- mblt_vision/models/MobileNet_V2.yaml +32 -0
- mblt_vision/models/MobileNet_V3_Large.yaml +32 -0
- mblt_vision/models/MobileNet_V3_Small.yaml +23 -0
- mblt_vision/models/RegNet_X_16GF.yaml +32 -0
- mblt_vision/models/RegNet_X_1_6GF.yaml +32 -0
- mblt_vision/models/RegNet_X_32GF.yaml +32 -0
- mblt_vision/models/RegNet_X_3_2GF.yaml +32 -0
- mblt_vision/models/RegNet_X_400MF.yaml +32 -0
- mblt_vision/models/RegNet_X_800MF.yaml +32 -0
- mblt_vision/models/RegNet_X_8GF.yaml +32 -0
- mblt_vision/models/RegNet_Y_16GF.yaml +76 -0
- mblt_vision/models/RegNet_Y_1_6GF.yaml +32 -0
- mblt_vision/models/RegNet_Y_32GF.yaml +76 -0
- mblt_vision/models/RegNet_Y_3_2GF.yaml +32 -0
- mblt_vision/models/RegNet_Y_400MF.yaml +32 -0
- mblt_vision/models/RegNet_Y_800MF.yaml +32 -0
- mblt_vision/models/RegNet_Y_8GF.yaml +32 -0
- mblt_vision/models/RepViT_M0_9.yaml +22 -0
- mblt_vision/models/RepViT_M1.yaml +22 -0
- mblt_vision/models/RepViT_M1_0.yaml +22 -0
- mblt_vision/models/RepViT_M1_1.yaml +22 -0
- mblt_vision/models/RepViT_M1_5.yaml +22 -0
- mblt_vision/models/RepViT_M2.yaml +22 -0
- mblt_vision/models/RepViT_M2_3.yaml +22 -0
- mblt_vision/models/RepViT_M3.yaml +22 -0
- mblt_vision/models/ResNeXt101_32X8D.yaml +32 -0
- mblt_vision/models/ResNeXt101_64X4D.yaml +23 -0
- mblt_vision/models/ResNeXt50_32X4D.yaml +32 -0
- mblt_vision/models/ResNet101.yaml +32 -0
- mblt_vision/models/ResNet152.yaml +32 -0
- mblt_vision/models/ResNet18.yaml +23 -0
- mblt_vision/models/ResNet34.yaml +23 -0
- mblt_vision/models/ResNet50.yaml +32 -0
- mblt_vision/models/ShuffleNet_V2_X0_5.yaml +23 -0
- mblt_vision/models/ShuffleNet_V2_X1_0.yaml +23 -0
- mblt_vision/models/ShuffleNet_V2_X1_5.yaml +23 -0
- mblt_vision/models/ShuffleNet_V2_X2_0.yaml +23 -0
- mblt_vision/models/SqueezeNet1_0.yaml +23 -0
- mblt_vision/models/SqueezeNet1_1.yaml +23 -0
- mblt_vision/models/Swin_B.yaml +23 -0
- mblt_vision/models/Swin_S.yaml +23 -0
- mblt_vision/models/Swin_T.yaml +23 -0
- mblt_vision/models/VGG11.yaml +23 -0
- mblt_vision/models/VGG11_BN.yaml +23 -0
- mblt_vision/models/VGG13.yaml +23 -0
- mblt_vision/models/VGG13_BN.yaml +23 -0
- mblt_vision/models/VGG16.yaml +23 -0
- mblt_vision/models/VGG16_BN.yaml +23 -0
- mblt_vision/models/VGG19.yaml +23 -0
- mblt_vision/models/VGG19_BN.yaml +23 -0
- mblt_vision/models/ViT_B_16.yaml +67 -0
- mblt_vision/models/ViT_B_32.yaml +23 -0
- mblt_vision/models/ViT_Base_Patch16_224.yaml +22 -0
- mblt_vision/models/ViT_Base_Patch16_384.yaml +22 -0
- mblt_vision/models/ViT_Base_Patch32_224.yaml +22 -0
- mblt_vision/models/ViT_Base_Patch32_384.yaml +22 -0
- mblt_vision/models/ViT_Base_Patch8_224.yaml +22 -0
- mblt_vision/models/ViT_L_16.yaml +67 -0
- mblt_vision/models/ViT_L_32.yaml +23 -0
- mblt_vision/models/ViT_Large_Patch16_224.yaml +22 -0
- mblt_vision/models/ViT_Large_Patch16_384.yaml +22 -0
- mblt_vision/models/ViT_Large_Patch32_384.yaml +22 -0
- mblt_vision/models/ViT_Small_Patch16_224.yaml +22 -0
- mblt_vision/models/ViT_Small_Patch16_384.yaml +22 -0
- mblt_vision/models/ViT_Small_Patch32_224.yaml +22 -0
- mblt_vision/models/ViT_Small_Patch32_384.yaml +22 -0
- mblt_vision/models/ViT_Tiny_Patch16_224.yaml +22 -0
- mblt_vision/models/ViT_Tiny_Patch16_384.yaml +22 -0
- mblt_vision/models/VisFormer_Small.yaml +22 -0
- mblt_vision/models/VisFormer_Tiny.yaml +22 -0
- mblt_vision/models/Wide_ResNet101_2.yaml +32 -0
- mblt_vision/models/Wide_ResNet50_2.yaml +32 -0
- mblt_vision/models/YOLO11l-cls.yaml +23 -0
- mblt_vision/models/YOLO11l-face.yaml +27 -0
- mblt_vision/models/YOLO11l-obb.yaml +28 -0
- mblt_vision/models/YOLO11l-pose.yaml +28 -0
- mblt_vision/models/YOLO11l-seg.yaml +28 -0
- mblt_vision/models/YOLO11l.yaml +27 -0
- mblt_vision/models/YOLO11m-cls.yaml +23 -0
- mblt_vision/models/YOLO11m-face.yaml +27 -0
- mblt_vision/models/YOLO11m-obb.yaml +28 -0
- mblt_vision/models/YOLO11m-pose.yaml +28 -0
- mblt_vision/models/YOLO11m-seg.yaml +28 -0
- mblt_vision/models/YOLO11m.yaml +27 -0
- mblt_vision/models/YOLO11n-cls.yaml +23 -0
- mblt_vision/models/YOLO11n-face.yaml +27 -0
- mblt_vision/models/YOLO11n-obb.yaml +28 -0
- mblt_vision/models/YOLO11n-pose.yaml +28 -0
- mblt_vision/models/YOLO11n-seg.yaml +28 -0
- mblt_vision/models/YOLO11n.yaml +27 -0
- mblt_vision/models/YOLO11s-cls.yaml +23 -0
- mblt_vision/models/YOLO11s-face.yaml +27 -0
- mblt_vision/models/YOLO11s-obb.yaml +28 -0
- mblt_vision/models/YOLO11s-pose.yaml +28 -0
- mblt_vision/models/YOLO11s-seg.yaml +28 -0
- mblt_vision/models/YOLO11s.yaml +27 -0
- mblt_vision/models/YOLO11x-cls.yaml +23 -0
- mblt_vision/models/YOLO11x-obb.yaml +28 -0
- mblt_vision/models/YOLO11x-pose.yaml +28 -0
- mblt_vision/models/YOLO11x-seg.yaml +28 -0
- mblt_vision/models/YOLO11x.yaml +27 -0
- mblt_vision/models/YOLO12l-face.yaml +27 -0
- mblt_vision/models/YOLO12l-seg.yaml +28 -0
- mblt_vision/models/YOLO12l.yaml +27 -0
- mblt_vision/models/YOLO12m-face.yaml +27 -0
- mblt_vision/models/YOLO12m-seg.yaml +28 -0
- mblt_vision/models/YOLO12m.yaml +27 -0
- mblt_vision/models/YOLO12n-face.yaml +27 -0
- mblt_vision/models/YOLO12n-seg.yaml +28 -0
- mblt_vision/models/YOLO12n.yaml +27 -0
- mblt_vision/models/YOLO12s-face.yaml +27 -0
- mblt_vision/models/YOLO12s-seg.yaml +28 -0
- mblt_vision/models/YOLO12s.yaml +27 -0
- mblt_vision/models/YOLO12x-seg.yaml +28 -0
- mblt_vision/models/YOLO12x.yaml +27 -0
- mblt_vision/models/YOLO26l-cls.yaml +23 -0
- mblt_vision/models/YOLO26l-depth.yaml +17 -0
- mblt_vision/models/YOLO26l-distill.yaml +27 -0
- mblt_vision/models/YOLO26l-obb.yaml +28 -0
- mblt_vision/models/YOLO26l-pose.yaml +28 -0
- mblt_vision/models/YOLO26l-seg.yaml +28 -0
- mblt_vision/models/YOLO26l-sem-ade20k.yaml +17 -0
- mblt_vision/models/YOLO26l-sem.yaml +17 -0
- mblt_vision/models/YOLO26l.yaml +27 -0
- mblt_vision/models/YOLO26m-cls.yaml +23 -0
- mblt_vision/models/YOLO26m-depth.yaml +17 -0
- mblt_vision/models/YOLO26m-distill.yaml +27 -0
- mblt_vision/models/YOLO26m-obb.yaml +28 -0
- mblt_vision/models/YOLO26m-pose.yaml +28 -0
- mblt_vision/models/YOLO26m-seg.yaml +28 -0
- mblt_vision/models/YOLO26m-sem-ade20k.yaml +17 -0
- mblt_vision/models/YOLO26m-sem.yaml +17 -0
- mblt_vision/models/YOLO26m.yaml +27 -0
- mblt_vision/models/YOLO26n-cls.yaml +23 -0
- mblt_vision/models/YOLO26n-depth.yaml +17 -0
- mblt_vision/models/YOLO26n-distill.yaml +27 -0
- mblt_vision/models/YOLO26n-obb.yaml +28 -0
- mblt_vision/models/YOLO26n-pose.yaml +28 -0
- mblt_vision/models/YOLO26n-seg.yaml +28 -0
- mblt_vision/models/YOLO26n-sem-ade20k.yaml +17 -0
- mblt_vision/models/YOLO26n-sem.yaml +17 -0
- mblt_vision/models/YOLO26n.yaml +27 -0
- mblt_vision/models/YOLO26s-cls.yaml +23 -0
- mblt_vision/models/YOLO26s-depth.yaml +17 -0
- mblt_vision/models/YOLO26s-distill.yaml +27 -0
- mblt_vision/models/YOLO26s-obb.yaml +28 -0
- mblt_vision/models/YOLO26s-pose.yaml +28 -0
- mblt_vision/models/YOLO26s-seg.yaml +28 -0
- mblt_vision/models/YOLO26s-sem-ade20k.yaml +17 -0
- mblt_vision/models/YOLO26s-sem.yaml +17 -0
- mblt_vision/models/YOLO26s.yaml +27 -0
- mblt_vision/models/YOLO26x-cls.yaml +23 -0
- mblt_vision/models/YOLO26x-depth.yaml +17 -0
- mblt_vision/models/YOLO26x-distill.yaml +27 -0
- mblt_vision/models/YOLO26x-obb.yaml +28 -0
- mblt_vision/models/YOLO26x-pose.yaml +28 -0
- mblt_vision/models/YOLO26x-seg.yaml +28 -0
- mblt_vision/models/YOLO26x-sem-ade20k.yaml +17 -0
- mblt_vision/models/YOLO26x-sem.yaml +17 -0
- mblt_vision/models/YOLO26x.yaml +27 -0
- mblt_vision/models/YOLOv10b.yaml +28 -0
- mblt_vision/models/YOLOv10l-face.yaml +28 -0
- mblt_vision/models/YOLOv10l.yaml +28 -0
- mblt_vision/models/YOLOv10m-face.yaml +28 -0
- mblt_vision/models/YOLOv10m.yaml +28 -0
- mblt_vision/models/YOLOv10n-face.yaml +28 -0
- mblt_vision/models/YOLOv10n.yaml +28 -0
- mblt_vision/models/YOLOv10s-face.yaml +28 -0
- mblt_vision/models/YOLOv10s.yaml +28 -0
- mblt_vision/models/YOLOv10x.yaml +28 -0
- mblt_vision/models/YOLOv3-spp.yaml +44 -0
- mblt_vision/models/YOLOv3-sppu.yaml +27 -0
- mblt_vision/models/YOLOv3-tiny.yaml +38 -0
- mblt_vision/models/YOLOv3-tinyu.yaml +27 -0
- mblt_vision/models/YOLOv3.yaml +44 -0
- mblt_vision/models/YOLOv3u.yaml +27 -0
- mblt_vision/models/YOLOv5l-cls.yaml +22 -0
- mblt_vision/models/YOLOv5l-seg.yaml +45 -0
- mblt_vision/models/YOLOv5l.yaml +44 -0
- mblt_vision/models/YOLOv5l6.yaml +50 -0
- mblt_vision/models/YOLOv5l6u.yaml +27 -0
- mblt_vision/models/YOLOv5lu.yaml +27 -0
- mblt_vision/models/YOLOv5m-cls.yaml +22 -0
- mblt_vision/models/YOLOv5m-seg.yaml +45 -0
- mblt_vision/models/YOLOv5m.yaml +45 -0
- mblt_vision/models/YOLOv5m6.yaml +50 -0
- mblt_vision/models/YOLOv5m6u.yaml +27 -0
- mblt_vision/models/YOLOv5mu.yaml +27 -0
- mblt_vision/models/YOLOv5n-cls.yaml +22 -0
- mblt_vision/models/YOLOv5n-seg.yaml +45 -0
- mblt_vision/models/YOLOv5n.yaml +44 -0
- mblt_vision/models/YOLOv5n6.yaml +50 -0
- mblt_vision/models/YOLOv5n6u.yaml +27 -0
- mblt_vision/models/YOLOv5nu.yaml +27 -0
- mblt_vision/models/YOLOv5s-cls.yaml +22 -0
- mblt_vision/models/YOLOv5s-seg.yaml +45 -0
- mblt_vision/models/YOLOv5s.yaml +44 -0
- mblt_vision/models/YOLOv5s6.yaml +50 -0
- mblt_vision/models/YOLOv5s6u.yaml +27 -0
- mblt_vision/models/YOLOv5su.yaml +27 -0
- mblt_vision/models/YOLOv5x-cls.yaml +22 -0
- mblt_vision/models/YOLOv5x-seg.yaml +45 -0
- mblt_vision/models/YOLOv5x.yaml +44 -0
- mblt_vision/models/YOLOv5x6.yaml +50 -0
- mblt_vision/models/YOLOv5x6u.yaml +27 -0
- mblt_vision/models/YOLOv5xu.yaml +27 -0
- mblt_vision/models/YOLOv6m-face.yaml +27 -0
- mblt_vision/models/YOLOv6n-face.yaml +27 -0
- mblt_vision/models/YOLOv7.yaml +44 -0
- mblt_vision/models/YOLOv7d6.yaml +50 -0
- mblt_vision/models/YOLOv7e6.yaml +50 -0
- mblt_vision/models/YOLOv7e6e.yaml +50 -0
- mblt_vision/models/YOLOv7w6.yaml +50 -0
- mblt_vision/models/YOLOv7x.yaml +44 -0
- mblt_vision/models/YOLOv8l-cls.yaml +23 -0
- mblt_vision/models/YOLOv8l-face.yaml +27 -0
- mblt_vision/models/YOLOv8l-obb.yaml +28 -0
- mblt_vision/models/YOLOv8l-pose.yaml +28 -0
- mblt_vision/models/YOLOv8l-seg.yaml +28 -0
- mblt_vision/models/YOLOv8l.yaml +27 -0
- mblt_vision/models/YOLOv8m-cls.yaml +23 -0
- mblt_vision/models/YOLOv8m-face.yaml +27 -0
- mblt_vision/models/YOLOv8m-obb.yaml +28 -0
- mblt_vision/models/YOLOv8m-pose.yaml +28 -0
- mblt_vision/models/YOLOv8m-seg.yaml +28 -0
- mblt_vision/models/YOLOv8m.yaml +27 -0
- mblt_vision/models/YOLOv8n-cls.yaml +23 -0
- mblt_vision/models/YOLOv8n-face.yaml +27 -0
- mblt_vision/models/YOLOv8n-obb.yaml +28 -0
- mblt_vision/models/YOLOv8n-pose.yaml +28 -0
- mblt_vision/models/YOLOv8n-seg.yaml +28 -0
- mblt_vision/models/YOLOv8n.yaml +27 -0
- mblt_vision/models/YOLOv8s-cls.yaml +23 -0
- mblt_vision/models/YOLOv8s-obb.yaml +28 -0
- mblt_vision/models/YOLOv8s-pose.yaml +28 -0
- mblt_vision/models/YOLOv8s-seg.yaml +28 -0
- mblt_vision/models/YOLOv8s.yaml +27 -0
- mblt_vision/models/YOLOv8x-cls.yaml +23 -0
- mblt_vision/models/YOLOv8x-obb.yaml +28 -0
- mblt_vision/models/YOLOv8x-pose-p6.yaml +28 -0
- mblt_vision/models/YOLOv8x-pose.yaml +28 -0
- mblt_vision/models/YOLOv8x-seg.yaml +28 -0
- mblt_vision/models/YOLOv8x.yaml +27 -0
- mblt_vision/models/YOLOv9c-seg.yaml +28 -0
- mblt_vision/models/YOLOv9c.yaml +27 -0
- mblt_vision/models/YOLOv9e-seg.yaml +28 -0
- mblt_vision/models/YOLOv9e.yaml +27 -0
- mblt_vision/models/YOLOv9m.yaml +27 -0
- mblt_vision/models/YOLOv9s.yaml +27 -0
- mblt_vision/models/YOLOv9t.yaml +27 -0
- mblt_vision/obb/__init__.py +39 -0
- mblt_vision/object_detection/__init__.py +153 -0
- mblt_vision/pose_estimation/__init__.py +41 -0
- mblt_vision/py.typed +1 -0
- mblt_vision/semantic_segmentation/__init__.py +29 -0
- mblt_vision/utils/__init__.py +0 -0
- mblt_vision/utils/datasets/__init__.py +85 -0
- mblt_vision/utils/datasets/ade20k.py +41 -0
- mblt_vision/utils/datasets/cityscapes.py +66 -0
- mblt_vision/utils/datasets/coco.py +243 -0
- mblt_vision/utils/datasets/dataloader.py +1016 -0
- mblt_vision/utils/datasets/dotav1.py +59 -0
- mblt_vision/utils/datasets/imagenet.py +29 -0
- mblt_vision/utils/datasets/organizer.py +2145 -0
- mblt_vision/utils/datasets/readiness.py +1063 -0
- mblt_vision/utils/evaluation/__init__.py +51 -0
- mblt_vision/utils/evaluation/_result.py +22 -0
- mblt_vision/utils/evaluation/eval_ade20k.py +302 -0
- mblt_vision/utils/evaluation/eval_cityscapes.py +32 -0
- mblt_vision/utils/evaluation/eval_coco.py +465 -0
- mblt_vision/utils/evaluation/eval_dota.py +878 -0
- mblt_vision/utils/evaluation/eval_imagenet.py +151 -0
- mblt_vision/utils/evaluation/eval_nyu_depth.py +189 -0
- mblt_vision/utils/evaluation/eval_widerface.py +440 -0
- mblt_vision/utils/letterbox.py +118 -0
- mblt_vision/utils/postprocess/__init__.py +9 -0
- mblt_vision/utils/postprocess/_letterbox.py +102 -0
- mblt_vision/utils/postprocess/base.py +743 -0
- mblt_vision/utils/postprocess/build_post.py +120 -0
- mblt_vision/utils/postprocess/cls_post.py +117 -0
- mblt_vision/utils/postprocess/common.py +1571 -0
- mblt_vision/utils/postprocess/depth_post.py +106 -0
- mblt_vision/utils/postprocess/semantic_seg_post.py +192 -0
- mblt_vision/utils/postprocess/yolo_anchor_post.py +469 -0
- mblt_vision/utils/postprocess/yolo_anchorless_post.py +952 -0
- mblt_vision/utils/postprocess/yolo_dflfree_post.py +983 -0
- mblt_vision/utils/postprocess/yolo_nmsfree_post.py +176 -0
- mblt_vision/utils/preprocess/__init__.py +27 -0
- mblt_vision/utils/preprocess/_validation.py +66 -0
- mblt_vision/utils/preprocess/base.py +157 -0
- mblt_vision/utils/preprocess/build_pre.py +48 -0
- mblt_vision/utils/preprocess/center_crop.py +75 -0
- mblt_vision/utils/preprocess/letterbox.py +123 -0
- mblt_vision/utils/preprocess/normalize.py +94 -0
- mblt_vision/utils/preprocess/order.py +74 -0
- mblt_vision/utils/preprocess/reader.py +94 -0
- mblt_vision/utils/preprocess/resize.py +202 -0
- mblt_vision/utils/preprocess/yolo_pre.py +7 -0
- mblt_vision/utils/results.py +725 -0
- mblt_vision/utils/types.py +15 -0
- mblt_vision/wrapper.py +1121 -0
- mblt_vision_python-0.0.0.dist-info/METADATA +152 -0
- mblt_vision_python-0.0.0.dist-info/RECORD +404 -0
- mblt_vision_python-0.0.0.dist-info/WHEEL +5 -0
- mblt_vision_python-0.0.0.dist-info/entry_points.txt +2 -0
- mblt_vision_python-0.0.0.dist-info/licenses/LICENSE +28 -0
- mblt_vision_python-0.0.0.dist-info/top_level.txt +1 -0
mblt_vision/cli/val.py
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
"""Vision validation CLI command."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from mblt_vision._tasks import normalize_vision_task
|
|
11
|
+
from mblt_vision.benchmark.argparse_utils import parse_positive_int
|
|
12
|
+
from mblt_vision.datasets import get_dataset_config, get_dataset_config_for_task
|
|
13
|
+
from mblt_vision.utils.datasets.readiness import dataset_ready
|
|
14
|
+
from mblt_vision.wrapper import get_mobilint_cache_dir
|
|
15
|
+
|
|
16
|
+
from ._vision import (
|
|
17
|
+
add_e2e_arg,
|
|
18
|
+
add_threshold_args,
|
|
19
|
+
create_vision_engine,
|
|
20
|
+
parse_target_clusters,
|
|
21
|
+
parse_target_cores,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
DEFAULT_IMAGENET_IMAGE_SOURCE = get_dataset_config("imagenet")["download"]["images"]
|
|
25
|
+
DEFAULT_IMAGENET_XML_SOURCE = get_dataset_config("imagenet")["download"]["annotations"]
|
|
26
|
+
DEFAULT_COCO_IMAGE_SOURCE = get_dataset_config("coco")["download"]["images"]
|
|
27
|
+
DEFAULT_COCO_ANNOTATION_SOURCE = get_dataset_config("coco")["download"]["annotations"]
|
|
28
|
+
DEFAULT_WIDERFACE_IMAGE_SOURCE = get_dataset_config("widerface")["download"]["images"]
|
|
29
|
+
DEFAULT_WIDERFACE_ANNOTATION_SOURCE = get_dataset_config("widerface")["download"][
|
|
30
|
+
"annotations"
|
|
31
|
+
]
|
|
32
|
+
DEFAULT_DOTAV1_SOURCE = get_dataset_config("dotav1")["download"]["url"]
|
|
33
|
+
DEFAULT_NYU_DEPTH_SOURCE = get_dataset_config("nyu-depth")["download"]["url"]
|
|
34
|
+
DEFAULT_ADE20K_SOURCE = get_dataset_config("ade20k")["download"]["url"]
|
|
35
|
+
CITYSCAPES_DOWNLOAD_CONFIG = get_dataset_config("cityscapes")["download"]
|
|
36
|
+
CITYSCAPES_IMAGE_ARCHIVE = CITYSCAPES_DOWNLOAD_CONFIG["images_archive"]
|
|
37
|
+
CITYSCAPES_ANNOTATION_ARCHIVE = CITYSCAPES_DOWNLOAD_CONFIG["annotations_archive"]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _candidate_search_roots(data_path: str) -> list[Path]:
|
|
41
|
+
"""Returns directories to inspect for existing raw dataset sources."""
|
|
42
|
+
|
|
43
|
+
root = Path(data_path).expanduser()
|
|
44
|
+
candidates = [root, root.parent, Path.cwd()]
|
|
45
|
+
ordered: list[Path] = []
|
|
46
|
+
seen: set[Path] = set()
|
|
47
|
+
for candidate in candidates:
|
|
48
|
+
resolved = candidate.resolve()
|
|
49
|
+
if resolved in seen:
|
|
50
|
+
continue
|
|
51
|
+
seen.add(resolved)
|
|
52
|
+
ordered.append(resolved)
|
|
53
|
+
return ordered
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _find_existing_source(data_path: str, candidate_names: list[str]) -> str | None:
|
|
57
|
+
"""Finds a nearby raw archive or extracted dataset directory."""
|
|
58
|
+
|
|
59
|
+
for root in _candidate_search_roots(data_path):
|
|
60
|
+
for name in candidate_names:
|
|
61
|
+
candidate = root / name
|
|
62
|
+
if candidate.exists():
|
|
63
|
+
return str(candidate)
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _normalize_coco_annotation_source(annotation_dir: str | None) -> str | None:
|
|
68
|
+
"""Normalizes a COCO annotation source for the organizer contract.
|
|
69
|
+
|
|
70
|
+
The COCO organizer expects either the annotation archive or the extracted
|
|
71
|
+
parent directory that contains an ``annotations`` subdirectory. When source
|
|
72
|
+
discovery finds the extracted leaf ``annotations`` directory directly,
|
|
73
|
+
return its parent so downstream code does not resolve ``annotations``
|
|
74
|
+
twice.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
if annotation_dir is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
candidate = Path(annotation_dir).expanduser()
|
|
81
|
+
if candidate.is_dir() and candidate.name == "annotations":
|
|
82
|
+
return str(candidate.parent)
|
|
83
|
+
return annotation_dir
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _resolve_imagenet_sources(
|
|
87
|
+
args: argparse.Namespace, data_path: str
|
|
88
|
+
) -> tuple[str, str]:
|
|
89
|
+
"""Resolves local or remote sources for ImageNet organization."""
|
|
90
|
+
|
|
91
|
+
image_dir = args.image_dir
|
|
92
|
+
xml_dir = args.xml_dir
|
|
93
|
+
if not args.force_organize:
|
|
94
|
+
image_dir = image_dir or _find_existing_source(
|
|
95
|
+
data_path, ["ILSVRC2012_img_val.tar", "ILSVRC2012_img_val"]
|
|
96
|
+
)
|
|
97
|
+
xml_dir = xml_dir or _find_existing_source(
|
|
98
|
+
data_path, ["ILSVRC2012_bbox_val_v3.tgz", "ILSVRC2012_bbox_val_v3"]
|
|
99
|
+
)
|
|
100
|
+
return (
|
|
101
|
+
image_dir or DEFAULT_IMAGENET_IMAGE_SOURCE,
|
|
102
|
+
xml_dir or DEFAULT_IMAGENET_XML_SOURCE,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _resolve_coco_sources(args: argparse.Namespace, data_path: str) -> tuple[str, str]:
|
|
107
|
+
"""Resolves local or remote sources for COCO organization."""
|
|
108
|
+
|
|
109
|
+
image_dir = args.image_dir
|
|
110
|
+
annotation_dir = _normalize_coco_annotation_source(args.annotation_dir)
|
|
111
|
+
if not args.force_organize:
|
|
112
|
+
image_dir = image_dir or _find_existing_source(
|
|
113
|
+
data_path, ["val2017.zip", "val2017"]
|
|
114
|
+
)
|
|
115
|
+
annotation_dir = annotation_dir or _normalize_coco_annotation_source(
|
|
116
|
+
_find_existing_source(
|
|
117
|
+
data_path,
|
|
118
|
+
[
|
|
119
|
+
"annotations_trainval2017.zip",
|
|
120
|
+
"annotations_trainval2017",
|
|
121
|
+
"annotations",
|
|
122
|
+
],
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
return (
|
|
126
|
+
image_dir or DEFAULT_COCO_IMAGE_SOURCE,
|
|
127
|
+
annotation_dir or DEFAULT_COCO_ANNOTATION_SOURCE,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _resolve_widerface_sources(
|
|
132
|
+
args: argparse.Namespace, data_path: str
|
|
133
|
+
) -> tuple[str, str]:
|
|
134
|
+
"""Resolves local or remote sources for WiderFace organization."""
|
|
135
|
+
|
|
136
|
+
image_dir = args.image_dir
|
|
137
|
+
annotation_dir = args.annotation_dir
|
|
138
|
+
if not args.force_organize:
|
|
139
|
+
image_dir = image_dir or _find_existing_source(
|
|
140
|
+
data_path, ["WIDER_val.zip", "WIDER_val"]
|
|
141
|
+
)
|
|
142
|
+
annotation_dir = annotation_dir or _find_existing_source(
|
|
143
|
+
data_path,
|
|
144
|
+
["wider_face_split.zip", "wider_face_split"],
|
|
145
|
+
)
|
|
146
|
+
return (
|
|
147
|
+
image_dir or DEFAULT_WIDERFACE_IMAGE_SOURCE,
|
|
148
|
+
annotation_dir or DEFAULT_WIDERFACE_ANNOTATION_SOURCE,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _resolve_dotav1_source(args: argparse.Namespace, data_path: str) -> str:
|
|
153
|
+
"""Resolves a local or remote source for DOTAv1 organization."""
|
|
154
|
+
|
|
155
|
+
dataset_path = args.annotation_dir or args.image_dir
|
|
156
|
+
if not args.force_organize:
|
|
157
|
+
dataset_path = dataset_path or _find_existing_source(
|
|
158
|
+
data_path, ["DOTAv1.zip", "DOTAv1"]
|
|
159
|
+
)
|
|
160
|
+
return dataset_path or DEFAULT_DOTAV1_SOURCE
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _resolve_nyu_depth_source(args: argparse.Namespace, data_path: str) -> str:
|
|
164
|
+
"""Resolve a local archive or URL for NYU Depth organization."""
|
|
165
|
+
|
|
166
|
+
dataset_path = args.annotation_dir or args.image_dir
|
|
167
|
+
if not args.force_organize:
|
|
168
|
+
dataset_path = dataset_path or _find_existing_source(
|
|
169
|
+
data_path, ["nyu-depth.zip", "nyu-depth"]
|
|
170
|
+
)
|
|
171
|
+
return dataset_path or DEFAULT_NYU_DEPTH_SOURCE
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _resolve_ade20k_source(args: argparse.Namespace, data_path: str) -> str:
|
|
175
|
+
"""Resolve a local archive, extracted directory, or URL for ADE20K organization."""
|
|
176
|
+
|
|
177
|
+
dataset_path = args.annotation_dir or args.image_dir
|
|
178
|
+
if not args.force_organize:
|
|
179
|
+
dataset_path = dataset_path or _find_existing_source(
|
|
180
|
+
data_path,
|
|
181
|
+
["ADEChallengeData2016.zip", "ADEChallengeData2016"],
|
|
182
|
+
)
|
|
183
|
+
return dataset_path or DEFAULT_ADE20K_SOURCE
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _resolve_cityscapes_sources(
|
|
187
|
+
args: argparse.Namespace, data_path: str
|
|
188
|
+
) -> tuple[str, str]:
|
|
189
|
+
"""Resolve the two manually downloaded official Cityscapes archives.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
args: Parsed validation CLI arguments.
|
|
193
|
+
data_path: Organized Cityscapes output path used as a discovery anchor.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
Image and annotation ZIP paths.
|
|
197
|
+
|
|
198
|
+
Raises:
|
|
199
|
+
SystemExit: If either required archive cannot be found.
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
image_dir = args.image_dir or _find_existing_source(
|
|
203
|
+
data_path, [CITYSCAPES_IMAGE_ARCHIVE]
|
|
204
|
+
)
|
|
205
|
+
annotation_dir = args.annotation_dir or _find_existing_source(
|
|
206
|
+
data_path, [CITYSCAPES_ANNOTATION_ARCHIVE]
|
|
207
|
+
)
|
|
208
|
+
if image_dir is None or annotation_dir is None:
|
|
209
|
+
raise SystemExit(
|
|
210
|
+
"Cityscapes organization requires the official image and annotation ZIP archives. "
|
|
211
|
+
"Register at https://www.cityscapes-dataset.com/, then download them with:\n"
|
|
212
|
+
" csDownload -d <download-dir> gtFine_trainvaltest.zip leftImg8bit_trainvaltest.zip\n"
|
|
213
|
+
"Pass the resulting files with --image-dir and --annotation-dir, or place them near the dataset path."
|
|
214
|
+
)
|
|
215
|
+
return image_dir, annotation_dir
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _default_data_path_for_task(task: str, dataset: str | None = None) -> str:
|
|
219
|
+
"""Returns the default organized dataset path for a vision task."""
|
|
220
|
+
|
|
221
|
+
try:
|
|
222
|
+
configured_path = Path(get_dataset_config_for_task(task, dataset)["path"])
|
|
223
|
+
except ValueError as exc:
|
|
224
|
+
raise SystemExit(f"Unsupported vision task for validation: {task}") from exc
|
|
225
|
+
|
|
226
|
+
configured_path = configured_path.expanduser()
|
|
227
|
+
default_cache_root = Path.home() / ".mblt_model_zoo"
|
|
228
|
+
try:
|
|
229
|
+
relative_path = configured_path.relative_to(default_cache_root)
|
|
230
|
+
except ValueError:
|
|
231
|
+
return str(configured_path)
|
|
232
|
+
return str(Path(get_mobilint_cache_dir()) / relative_path)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _dataset_ready(task: str, data_path: str, dataset: str | None = None) -> bool:
|
|
236
|
+
"""Checks whether the organized dataset appears ready for validation."""
|
|
237
|
+
|
|
238
|
+
return dataset_ready(data_path, task, dataset)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def _ensure_dataset(
|
|
242
|
+
args: argparse.Namespace, task: str, dataset: str | None = None
|
|
243
|
+
) -> str:
|
|
244
|
+
"""Organizes the dataset automatically when the expected layout is missing."""
|
|
245
|
+
|
|
246
|
+
task = normalize_vision_task(task)
|
|
247
|
+
data_path = os.path.expanduser(
|
|
248
|
+
args.data_path or _default_data_path_for_task(task, dataset)
|
|
249
|
+
)
|
|
250
|
+
if _dataset_ready(task, data_path, dataset) and not args.force_organize:
|
|
251
|
+
print(f"Using organized dataset at {data_path}")
|
|
252
|
+
return data_path
|
|
253
|
+
|
|
254
|
+
try:
|
|
255
|
+
from mblt_vision.utils.datasets import (
|
|
256
|
+
organize_ade20k,
|
|
257
|
+
organize_cityscapes,
|
|
258
|
+
organize_coco,
|
|
259
|
+
organize_dotav1,
|
|
260
|
+
organize_imagenet,
|
|
261
|
+
organize_nyu_depth,
|
|
262
|
+
organize_widerface,
|
|
263
|
+
)
|
|
264
|
+
except ImportError as exc:
|
|
265
|
+
print(
|
|
266
|
+
f"Missing dependencies for vision dataset organization: {exc}",
|
|
267
|
+
file=sys.stderr,
|
|
268
|
+
)
|
|
269
|
+
raise SystemExit(2) from exc
|
|
270
|
+
|
|
271
|
+
print(f"Preparing validation dataset for task `{task}` at {data_path}...")
|
|
272
|
+
if task == "image_classification":
|
|
273
|
+
image_dir, xml_dir = _resolve_imagenet_sources(args, data_path)
|
|
274
|
+
organize_imagenet(
|
|
275
|
+
image_dir=image_dir,
|
|
276
|
+
xml_dir=xml_dir,
|
|
277
|
+
output_dir=data_path,
|
|
278
|
+
)
|
|
279
|
+
elif task in {"object_detection", "instance_segmentation", "pose_estimation"}:
|
|
280
|
+
image_dir, annotation_dir = _resolve_coco_sources(args, data_path)
|
|
281
|
+
organize_coco(
|
|
282
|
+
image_dir=image_dir,
|
|
283
|
+
annotation_dir=annotation_dir,
|
|
284
|
+
output_dir=data_path,
|
|
285
|
+
)
|
|
286
|
+
elif task == "face_detection":
|
|
287
|
+
image_dir, annotation_dir = _resolve_widerface_sources(args, data_path)
|
|
288
|
+
organize_widerface(
|
|
289
|
+
image_dir=image_dir,
|
|
290
|
+
annotation_dir=annotation_dir,
|
|
291
|
+
output_dir=data_path,
|
|
292
|
+
)
|
|
293
|
+
elif task == "obb":
|
|
294
|
+
organize_dotav1(
|
|
295
|
+
dataset_path=_resolve_dotav1_source(args, data_path),
|
|
296
|
+
output_dir=data_path,
|
|
297
|
+
)
|
|
298
|
+
elif task == "depth_estimation":
|
|
299
|
+
organize_nyu_depth(
|
|
300
|
+
dataset_path=_resolve_nyu_depth_source(args, data_path),
|
|
301
|
+
output_dir=data_path,
|
|
302
|
+
)
|
|
303
|
+
elif task == "semantic_segmentation":
|
|
304
|
+
if dataset == "cityscapes":
|
|
305
|
+
image_dir, annotation_dir = _resolve_cityscapes_sources(args, data_path)
|
|
306
|
+
organize_cityscapes(
|
|
307
|
+
image_dir=image_dir,
|
|
308
|
+
annotation_dir=annotation_dir,
|
|
309
|
+
output_dir=data_path,
|
|
310
|
+
)
|
|
311
|
+
else:
|
|
312
|
+
organize_ade20k(
|
|
313
|
+
dataset_path=_resolve_ade20k_source(args, data_path),
|
|
314
|
+
output_dir=data_path,
|
|
315
|
+
)
|
|
316
|
+
else:
|
|
317
|
+
raise SystemExit(f"Unsupported vision task for validation: {task}")
|
|
318
|
+
|
|
319
|
+
if not _dataset_ready(task, data_path, dataset):
|
|
320
|
+
raise SystemExit(
|
|
321
|
+
f"Organized validation dataset at {data_path} is incomplete or does not match "
|
|
322
|
+
f"the expected {dataset or task} dataset."
|
|
323
|
+
)
|
|
324
|
+
return data_path
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def _run_validation(args: argparse.Namespace) -> float:
|
|
328
|
+
"""Runs model validation on the dataset associated with the model task."""
|
|
329
|
+
|
|
330
|
+
try:
|
|
331
|
+
from mblt_vision.utils.evaluation import (
|
|
332
|
+
eval_ade20k,
|
|
333
|
+
eval_cityscapes,
|
|
334
|
+
eval_coco_metrics,
|
|
335
|
+
eval_dota,
|
|
336
|
+
eval_imagenet_metrics,
|
|
337
|
+
eval_nyu_depth,
|
|
338
|
+
eval_widerface,
|
|
339
|
+
)
|
|
340
|
+
except ImportError as exc:
|
|
341
|
+
print(f"Missing dependencies for vision CLI: {exc}", file=sys.stderr)
|
|
342
|
+
raise SystemExit(2) from exc
|
|
343
|
+
|
|
344
|
+
model = create_vision_engine(args)
|
|
345
|
+
try:
|
|
346
|
+
if not getattr(getattr(model, "postprocessor", None), "e2e", True):
|
|
347
|
+
raise SystemExit(
|
|
348
|
+
"Validation requires end-to-end YOLO postprocessing. Use `--e2e true` or omit the option."
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
task = normalize_vision_task(model.post_cfg.get("task", ""))
|
|
352
|
+
dataset = model.post_cfg.get("dataset")
|
|
353
|
+
taxonomy = str(dataset).lower() if isinstance(dataset, str) else None
|
|
354
|
+
if task == "semantic_segmentation" and taxonomy not in {"ade20k", "cityscapes"}:
|
|
355
|
+
raise SystemExit(
|
|
356
|
+
f"Unsupported semantic segmentation taxonomy for validation: {taxonomy!r}. "
|
|
357
|
+
"Expected `ade20k` or `cityscapes`."
|
|
358
|
+
)
|
|
359
|
+
data_path = _ensure_dataset(args, task, taxonomy)
|
|
360
|
+
|
|
361
|
+
if task == "image_classification":
|
|
362
|
+
imagenet_result = eval_imagenet_metrics(
|
|
363
|
+
model=model, data_path=data_path, batch_size=args.batch_size
|
|
364
|
+
)
|
|
365
|
+
print(
|
|
366
|
+
"Validation score "
|
|
367
|
+
f"(Top-1 accuracy): {imagenet_result.top1:.5f}, "
|
|
368
|
+
f"(Top-5 accuracy): {imagenet_result.top5:.5f}"
|
|
369
|
+
)
|
|
370
|
+
return imagenet_result.primary_score
|
|
371
|
+
|
|
372
|
+
if task == "depth_estimation":
|
|
373
|
+
depth_result = eval_nyu_depth(
|
|
374
|
+
model=model, data_path=data_path, batch_size=args.batch_size
|
|
375
|
+
)
|
|
376
|
+
print(
|
|
377
|
+
"Validation score "
|
|
378
|
+
f"(delta1): {depth_result.delta1:.5f}, "
|
|
379
|
+
f"(abs_rel): {depth_result.abs_rel:.5f}, "
|
|
380
|
+
f"(rmse): {depth_result.rmse:.5f}"
|
|
381
|
+
)
|
|
382
|
+
return depth_result.primary_score
|
|
383
|
+
|
|
384
|
+
if task == "semantic_segmentation":
|
|
385
|
+
if taxonomy == "cityscapes":
|
|
386
|
+
semantic_result = eval_cityscapes(
|
|
387
|
+
model=model, data_path=data_path, batch_size=args.batch_size
|
|
388
|
+
)
|
|
389
|
+
elif taxonomy == "ade20k":
|
|
390
|
+
semantic_result = eval_ade20k(
|
|
391
|
+
model=model, data_path=data_path, batch_size=args.batch_size
|
|
392
|
+
)
|
|
393
|
+
else:
|
|
394
|
+
raise AssertionError(
|
|
395
|
+
f"Unexpected validated semantic taxonomy: {taxonomy!r}"
|
|
396
|
+
)
|
|
397
|
+
print(
|
|
398
|
+
"Validation score "
|
|
399
|
+
f"(mIoU): {semantic_result.miou:.5f}, "
|
|
400
|
+
f"(pixel accuracy): {semantic_result.pixel_accuracy:.5f}"
|
|
401
|
+
)
|
|
402
|
+
return semantic_result.primary_score
|
|
403
|
+
|
|
404
|
+
if task in {"object_detection", "instance_segmentation", "pose_estimation"}:
|
|
405
|
+
coco_result = eval_coco_metrics(
|
|
406
|
+
model=model,
|
|
407
|
+
data_path=data_path,
|
|
408
|
+
batch_size=args.batch_size,
|
|
409
|
+
conf_thres=args.conf_thres,
|
|
410
|
+
iou_thres=args.iou_thres,
|
|
411
|
+
)
|
|
412
|
+
print(
|
|
413
|
+
f"Validation score (mAP50-95): {coco_result.map5095:.5f}, (mAP50): {coco_result.map50:.5f}"
|
|
414
|
+
)
|
|
415
|
+
return coco_result.primary_score
|
|
416
|
+
|
|
417
|
+
if task == "obb":
|
|
418
|
+
dota_result = eval_dota(
|
|
419
|
+
model=model,
|
|
420
|
+
data_path=data_path,
|
|
421
|
+
batch_size=args.batch_size,
|
|
422
|
+
conf_thres=args.conf_thres,
|
|
423
|
+
iou_thres=args.iou_thres,
|
|
424
|
+
)
|
|
425
|
+
print(
|
|
426
|
+
"Validation score "
|
|
427
|
+
f"(rotated mAP50-95): {dota_result.map5095:.5f}, "
|
|
428
|
+
f"(rotated mAP50): {dota_result.map50:.5f}"
|
|
429
|
+
)
|
|
430
|
+
return dota_result.primary_score
|
|
431
|
+
|
|
432
|
+
if task == "face_detection":
|
|
433
|
+
widerface_result = eval_widerface(
|
|
434
|
+
model=model,
|
|
435
|
+
data_path=data_path,
|
|
436
|
+
batch_size=args.batch_size,
|
|
437
|
+
conf_thres=args.conf_thres,
|
|
438
|
+
iou_thres=args.iou_thres,
|
|
439
|
+
)
|
|
440
|
+
print(
|
|
441
|
+
"Validation score "
|
|
442
|
+
f"(Easy AP): {widerface_result.easy_ap:.5f}, "
|
|
443
|
+
f"(Medium AP): {widerface_result.medium_ap:.5f}, "
|
|
444
|
+
f"(Hard AP): {widerface_result.hard_ap:.5f}, "
|
|
445
|
+
f"(Mean AP): {widerface_result.mean_ap:.5f}"
|
|
446
|
+
)
|
|
447
|
+
return widerface_result.primary_score
|
|
448
|
+
|
|
449
|
+
raise SystemExit(f"Unsupported vision task for validation: {task}")
|
|
450
|
+
finally:
|
|
451
|
+
model.dispose()
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def _cmd_val(args: argparse.Namespace) -> int:
|
|
455
|
+
"""Runs vision validation on the task-appropriate benchmark dataset."""
|
|
456
|
+
|
|
457
|
+
_run_validation(args)
|
|
458
|
+
return 0
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def add_val_parser(
|
|
462
|
+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
|
|
463
|
+
) -> None:
|
|
464
|
+
"""Registers the unified vision validation CLI command."""
|
|
465
|
+
|
|
466
|
+
parser = subparsers.add_parser(
|
|
467
|
+
"val", help="Validate a vision model on its benchmark dataset."
|
|
468
|
+
)
|
|
469
|
+
parser.set_defaults(_handler=_cmd_val)
|
|
470
|
+
parser.add_argument(
|
|
471
|
+
"--model",
|
|
472
|
+
required=True,
|
|
473
|
+
help="Vision model name, for example `resnet50` or `yolo11m`.",
|
|
474
|
+
)
|
|
475
|
+
parser.add_argument(
|
|
476
|
+
"--framework",
|
|
477
|
+
default=None,
|
|
478
|
+
choices=["mxq", "onnx"],
|
|
479
|
+
help="Inference framework to use. When omitted, `--model-path` suffix is used first, then `mxq`.",
|
|
480
|
+
)
|
|
481
|
+
parser.add_argument(
|
|
482
|
+
"--model-path",
|
|
483
|
+
dest="model_path",
|
|
484
|
+
default="",
|
|
485
|
+
help="Optional generic local model path for MXQ or ONNX inference.",
|
|
486
|
+
)
|
|
487
|
+
parser.add_argument(
|
|
488
|
+
"--mxq-path",
|
|
489
|
+
dest="mxq_path",
|
|
490
|
+
default="",
|
|
491
|
+
help="Optional local MXQ model path. Preserved as a compatibility alias.",
|
|
492
|
+
)
|
|
493
|
+
parser.add_argument(
|
|
494
|
+
"--onnx-path",
|
|
495
|
+
dest="onnx_path",
|
|
496
|
+
default="",
|
|
497
|
+
help="Optional local ONNX model path.",
|
|
498
|
+
)
|
|
499
|
+
parser.add_argument(
|
|
500
|
+
"--model-type",
|
|
501
|
+
default="DEFAULT",
|
|
502
|
+
help="Model variant from the YAML configuration.",
|
|
503
|
+
)
|
|
504
|
+
parser.add_argument(
|
|
505
|
+
"--core-mode",
|
|
506
|
+
default=None,
|
|
507
|
+
choices=["single", "multi", "global4", "global8"],
|
|
508
|
+
help="NPU core execution mode. Defaults to global8 on Aries and single on Regulus.",
|
|
509
|
+
)
|
|
510
|
+
parser.add_argument("--dev-no", type=int, default=0, help="NPU device number.")
|
|
511
|
+
parser.add_argument(
|
|
512
|
+
"--target-device",
|
|
513
|
+
default="aries-rb",
|
|
514
|
+
choices=["aries-rb", "regulus-ra", "regulus-rb"],
|
|
515
|
+
help="NPU board target. Determines the backend implementation.",
|
|
516
|
+
)
|
|
517
|
+
parser.add_argument(
|
|
518
|
+
"--target-cores",
|
|
519
|
+
type=parse_target_cores,
|
|
520
|
+
help="Optional semicolon-separated core list for single-core mode, for example `0:0;0:1`.",
|
|
521
|
+
)
|
|
522
|
+
parser.add_argument(
|
|
523
|
+
"--target-clusters",
|
|
524
|
+
type=parse_target_clusters,
|
|
525
|
+
help="Optional semicolon-separated cluster list for multi/global modes, for example `0;1`.",
|
|
526
|
+
)
|
|
527
|
+
parser.add_argument(
|
|
528
|
+
"--batch-size",
|
|
529
|
+
type=parse_positive_int,
|
|
530
|
+
default=1,
|
|
531
|
+
help="Positive batch size for validation.",
|
|
532
|
+
)
|
|
533
|
+
parser.add_argument(
|
|
534
|
+
"--data-path",
|
|
535
|
+
help="Path to an already organized validation dataset. If omitted, the default cache path is used.",
|
|
536
|
+
)
|
|
537
|
+
parser.add_argument(
|
|
538
|
+
"--force-organize",
|
|
539
|
+
"--force",
|
|
540
|
+
"--reload",
|
|
541
|
+
action="store_true",
|
|
542
|
+
dest="force_organize",
|
|
543
|
+
help="Rebuild the organized dataset even when the target directory already looks ready.",
|
|
544
|
+
)
|
|
545
|
+
parser.add_argument(
|
|
546
|
+
"--image-dir",
|
|
547
|
+
help=(
|
|
548
|
+
"Local archive path or download URL for dataset images. Cityscapes requires leftImg8bit_trainvaltest.zip."
|
|
549
|
+
),
|
|
550
|
+
)
|
|
551
|
+
parser.add_argument(
|
|
552
|
+
"--xml-dir",
|
|
553
|
+
help="Local archive path or download URL for ImageNet annotations used by automatic organization.",
|
|
554
|
+
)
|
|
555
|
+
parser.add_argument(
|
|
556
|
+
"--annotation-dir",
|
|
557
|
+
help=(
|
|
558
|
+
"Local archive path or download URL for dataset annotations. Cityscapes requires gtFine_trainvaltest.zip."
|
|
559
|
+
),
|
|
560
|
+
)
|
|
561
|
+
add_threshold_args(parser, conf_default=None, iou_default=None)
|
|
562
|
+
add_e2e_arg(parser)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Vision model compilation and calibration-data preparation."""
|
|
2
|
+
|
|
3
|
+
from .vision import (
|
|
4
|
+
compile_vision_model,
|
|
5
|
+
copy_calibration_subset,
|
|
6
|
+
ensure_calibration_dataset,
|
|
7
|
+
make_calibration_subset,
|
|
8
|
+
prepare_calibration_arrays,
|
|
9
|
+
resolve_quantization_values,
|
|
10
|
+
select_calibration_images,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"compile_vision_model",
|
|
15
|
+
"copy_calibration_subset",
|
|
16
|
+
"ensure_calibration_dataset",
|
|
17
|
+
"make_calibration_subset",
|
|
18
|
+
"prepare_calibration_arrays",
|
|
19
|
+
"resolve_quantization_values",
|
|
20
|
+
"select_calibration_images",
|
|
21
|
+
]
|