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
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"""Shared helpers for vision CLI commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import torch
|
|
12
|
+
from mblt_vision._tasks import normalize_vision_task
|
|
13
|
+
|
|
14
|
+
DEFAULT_OUTPUT_DIR = Path("runs") / "vision"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def parse_unit_interval(value: str) -> float:
|
|
18
|
+
"""Parse a floating-point value strictly between zero and one."""
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
parsed = float(value)
|
|
22
|
+
except ValueError as exc:
|
|
23
|
+
raise argparse.ArgumentTypeError(
|
|
24
|
+
"expected a number in the open interval (0, 1)"
|
|
25
|
+
) from exc
|
|
26
|
+
if not 0 < parsed < 1:
|
|
27
|
+
raise argparse.ArgumentTypeError(
|
|
28
|
+
f"expected a number in the open interval (0, 1), got {value}"
|
|
29
|
+
)
|
|
30
|
+
return parsed
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def parse_target_cores(value: str | None) -> list[str] | None:
|
|
34
|
+
"""Parses a semicolon-separated target core list."""
|
|
35
|
+
|
|
36
|
+
if value is None:
|
|
37
|
+
return None
|
|
38
|
+
cores = [item.strip() for item in value.split(";") if item.strip()]
|
|
39
|
+
return cores or None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def parse_target_clusters(value: str | None) -> list[int] | None:
|
|
43
|
+
"""Parses a semicolon-separated target cluster list."""
|
|
44
|
+
|
|
45
|
+
if value is None:
|
|
46
|
+
return None
|
|
47
|
+
try:
|
|
48
|
+
clusters = [int(item.strip()) for item in value.split(";") if item.strip()]
|
|
49
|
+
except ValueError as exc:
|
|
50
|
+
raise argparse.ArgumentTypeError(
|
|
51
|
+
"target clusters must be semicolon-separated integers"
|
|
52
|
+
) from exc
|
|
53
|
+
return clusters or None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def add_common_vision_args(parser: argparse.ArgumentParser) -> None:
|
|
57
|
+
"""Adds arguments shared by all vision inference commands."""
|
|
58
|
+
|
|
59
|
+
parser.add_argument("--source", required=True, help="Path to the source image.")
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--model",
|
|
62
|
+
required=True,
|
|
63
|
+
help="Vision model name, for example `resnet50` or `yolo11m`.",
|
|
64
|
+
)
|
|
65
|
+
parser.add_argument(
|
|
66
|
+
"--output",
|
|
67
|
+
"--save-path",
|
|
68
|
+
dest="output",
|
|
69
|
+
help="Path to save the plotted result image.",
|
|
70
|
+
)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--framework",
|
|
73
|
+
default=None,
|
|
74
|
+
choices=["mxq", "onnx"],
|
|
75
|
+
help="Inference framework to use. When omitted, `--model-path` suffix is used first, then `mxq`.",
|
|
76
|
+
)
|
|
77
|
+
parser.add_argument(
|
|
78
|
+
"--model-path",
|
|
79
|
+
dest="model_path",
|
|
80
|
+
default="",
|
|
81
|
+
help="Optional generic local model path for MXQ or ONNX inference.",
|
|
82
|
+
)
|
|
83
|
+
parser.add_argument(
|
|
84
|
+
"--mxq-path",
|
|
85
|
+
dest="mxq_path",
|
|
86
|
+
default="",
|
|
87
|
+
help="Optional local MXQ model path. Preserved as a compatibility alias.",
|
|
88
|
+
)
|
|
89
|
+
parser.add_argument(
|
|
90
|
+
"--onnx-path",
|
|
91
|
+
dest="onnx_path",
|
|
92
|
+
default="",
|
|
93
|
+
help="Optional local ONNX model path.",
|
|
94
|
+
)
|
|
95
|
+
parser.add_argument(
|
|
96
|
+
"--model-type",
|
|
97
|
+
default="DEFAULT",
|
|
98
|
+
help="Model variant from the YAML configuration.",
|
|
99
|
+
)
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
"--core-mode",
|
|
102
|
+
default=None,
|
|
103
|
+
choices=["single", "multi", "global4", "global8"],
|
|
104
|
+
help="NPU core execution mode. Defaults to global8 on Aries and single on Regulus.",
|
|
105
|
+
)
|
|
106
|
+
parser.add_argument("--dev-no", type=int, default=0, help="NPU device number.")
|
|
107
|
+
parser.add_argument(
|
|
108
|
+
"--target-device",
|
|
109
|
+
default="aries-rb",
|
|
110
|
+
choices=["aries-rb", "regulus-ra", "regulus-rb"],
|
|
111
|
+
help="NPU board target. Determines the backend implementation.",
|
|
112
|
+
)
|
|
113
|
+
parser.add_argument(
|
|
114
|
+
"--target-cores",
|
|
115
|
+
type=parse_target_cores,
|
|
116
|
+
help="Optional semicolon-separated core list for single-core mode, for example `0:0;0:1`.",
|
|
117
|
+
)
|
|
118
|
+
parser.add_argument(
|
|
119
|
+
"--target-clusters",
|
|
120
|
+
type=parse_target_clusters,
|
|
121
|
+
help="Optional semicolon-separated cluster list for multi/global modes, for example `0;1`.",
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def add_threshold_args(
|
|
126
|
+
parser: argparse.ArgumentParser,
|
|
127
|
+
*,
|
|
128
|
+
conf_default: float | None = 0.25,
|
|
129
|
+
iou_default: float | None = None,
|
|
130
|
+
) -> None:
|
|
131
|
+
"""Adds postprocess threshold arguments for dense vision tasks."""
|
|
132
|
+
|
|
133
|
+
parser.add_argument(
|
|
134
|
+
"--conf-thres",
|
|
135
|
+
type=parse_unit_interval,
|
|
136
|
+
default=conf_default,
|
|
137
|
+
help="Confidence threshold.",
|
|
138
|
+
)
|
|
139
|
+
parser.add_argument(
|
|
140
|
+
"--iou-thres",
|
|
141
|
+
type=parse_unit_interval,
|
|
142
|
+
default=iou_default,
|
|
143
|
+
help="IoU threshold.",
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def parse_bool(value: str) -> bool:
|
|
148
|
+
"""Parses a case-insensitive boolean CLI value.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
value: Boolean text to parse.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Parsed boolean value.
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
argparse.ArgumentTypeError: If the value is not a supported boolean spelling.
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
normalized = value.strip().lower()
|
|
161
|
+
if normalized in {"true", "1", "yes", "on"}:
|
|
162
|
+
return True
|
|
163
|
+
if normalized in {"false", "0", "no", "off"}:
|
|
164
|
+
return False
|
|
165
|
+
raise argparse.ArgumentTypeError("expected a boolean value: true or false")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def add_e2e_arg(parser: argparse.ArgumentParser) -> None:
|
|
169
|
+
"""Adds an optional YOLO end-to-end postprocessing mode override.
|
|
170
|
+
|
|
171
|
+
Leaving the option unset preserves the model configuration's default.
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
parser.add_argument(
|
|
175
|
+
"--e2e",
|
|
176
|
+
nargs="?",
|
|
177
|
+
const=True,
|
|
178
|
+
type=parse_bool,
|
|
179
|
+
default=None,
|
|
180
|
+
help="Enable or disable YOLO end-to-end postprocessing (true/false). Bare `--e2e` means true.",
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def add_vision_parser(
|
|
185
|
+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
|
|
186
|
+
*,
|
|
187
|
+
command: str,
|
|
188
|
+
help_text: str,
|
|
189
|
+
handler: Any,
|
|
190
|
+
description: str | None = None,
|
|
191
|
+
epilog: str | None = None,
|
|
192
|
+
) -> argparse.ArgumentParser:
|
|
193
|
+
"""Creates a vision command parser with common arguments."""
|
|
194
|
+
|
|
195
|
+
parser = subparsers.add_parser(
|
|
196
|
+
command,
|
|
197
|
+
help=help_text,
|
|
198
|
+
description=description,
|
|
199
|
+
epilog=epilog,
|
|
200
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
201
|
+
)
|
|
202
|
+
parser.set_defaults(_handler=handler)
|
|
203
|
+
add_common_vision_args(parser)
|
|
204
|
+
return parser
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def build_default_output_path(command: str, source: str, model: str) -> str:
|
|
208
|
+
"""Builds the default path used for plotted vision command output."""
|
|
209
|
+
|
|
210
|
+
source_path = Path(source)
|
|
211
|
+
suffix = source_path.suffix or ".jpg"
|
|
212
|
+
return str(DEFAULT_OUTPUT_DIR / command / f"{source_path.stem}_{model}{suffix}")
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def resolve_output_path(
|
|
216
|
+
output: str | None, command: str, source: str, model: str
|
|
217
|
+
) -> str:
|
|
218
|
+
"""Returns an absolute result image path and ensures its parent exists."""
|
|
219
|
+
|
|
220
|
+
save_path = Path(
|
|
221
|
+
output or build_default_output_path(command, source, model)
|
|
222
|
+
).expanduser()
|
|
223
|
+
save_path.parent.mkdir(parents=True, exist_ok=True)
|
|
224
|
+
return str(save_path.resolve())
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def require_source_file(source: str) -> None:
|
|
228
|
+
"""Exits with a clear message when the source image is unavailable."""
|
|
229
|
+
|
|
230
|
+
source_path = Path(source).expanduser()
|
|
231
|
+
if not source_path.is_file():
|
|
232
|
+
raise SystemExit(f"Source image not found: {source}")
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def create_vision_engine(args: argparse.Namespace) -> Any:
|
|
236
|
+
"""Creates a vision engine from shared CLI model options.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
args: Parsed command options containing common vision model arguments.
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
Initialized vision inference engine.
|
|
243
|
+
|
|
244
|
+
Raises:
|
|
245
|
+
SystemExit: If the vision runtime dependencies are unavailable.
|
|
246
|
+
"""
|
|
247
|
+
|
|
248
|
+
try:
|
|
249
|
+
from mblt_vision import MBLT_Engine
|
|
250
|
+
from mblt_vision.wrapper import normalize_core_mode
|
|
251
|
+
except ImportError as exc:
|
|
252
|
+
print(f"Missing dependencies for vision CLI: {exc}", file=sys.stderr)
|
|
253
|
+
raise SystemExit(2) from exc
|
|
254
|
+
|
|
255
|
+
postprocess_kwargs: dict[str, Any] = {}
|
|
256
|
+
if getattr(args, "e2e", None) is not None:
|
|
257
|
+
postprocess_kwargs["e2e"] = args.e2e
|
|
258
|
+
|
|
259
|
+
return MBLT_Engine(
|
|
260
|
+
model_cls=args.model,
|
|
261
|
+
model_type=args.model_type,
|
|
262
|
+
framework=args.framework,
|
|
263
|
+
model_path=args.model_path,
|
|
264
|
+
mxq_path=args.mxq_path,
|
|
265
|
+
onnx_path=args.onnx_path,
|
|
266
|
+
dev_no=args.dev_no,
|
|
267
|
+
target_device=args.target_device,
|
|
268
|
+
core_mode=normalize_core_mode(
|
|
269
|
+
args.core_mode
|
|
270
|
+
or ("single" if args.target_device.startswith("regulus-") else "global8")
|
|
271
|
+
),
|
|
272
|
+
target_cores=args.target_cores,
|
|
273
|
+
target_clusters=args.target_clusters,
|
|
274
|
+
postprocess_kwargs=postprocess_kwargs,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def run_vision_inference(
|
|
279
|
+
args: argparse.Namespace,
|
|
280
|
+
*,
|
|
281
|
+
command: str,
|
|
282
|
+
) -> Any:
|
|
283
|
+
"""Runs a complete vision inference pipeline for a CLI command."""
|
|
284
|
+
|
|
285
|
+
require_source_file(args.source)
|
|
286
|
+
model = create_vision_engine(args)
|
|
287
|
+
try:
|
|
288
|
+
actual_task = normalize_vision_task(model.post_cfg.get("task", ""))
|
|
289
|
+
plot_kwargs: dict[str, Any] = {}
|
|
290
|
+
if actual_task == "image_classification":
|
|
291
|
+
plot_kwargs["topk"] = args.topk
|
|
292
|
+
elif actual_task in {
|
|
293
|
+
"object_detection",
|
|
294
|
+
"face_detection",
|
|
295
|
+
"instance_segmentation",
|
|
296
|
+
"pose_estimation",
|
|
297
|
+
"obb",
|
|
298
|
+
}:
|
|
299
|
+
model.set_postprocess_thresholds(
|
|
300
|
+
conf_thres=args.conf_thres, iou_thres=args.iou_thres
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
postprocess_kwargs: dict[str, Any] = {}
|
|
304
|
+
if actual_task == "semantic_segmentation":
|
|
305
|
+
input_img, metadata = model.preprocess_with_metadata(args.source)
|
|
306
|
+
postprocess_kwargs["img0_shape"] = metadata["img0_shape"]
|
|
307
|
+
postprocess_kwargs["ratio_pad"] = metadata.get("ratio_pad")
|
|
308
|
+
else:
|
|
309
|
+
input_img = model.preprocess(args.source)
|
|
310
|
+
output = model(input_img)
|
|
311
|
+
if not getattr(getattr(model, "postprocessor", None), "e2e", True):
|
|
312
|
+
if args.output:
|
|
313
|
+
raise SystemExit(
|
|
314
|
+
"`--output` is unavailable with `--e2e false`; use `--raw-output` instead."
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
raw_output = model.postprocessor(output)
|
|
318
|
+
raw_output_path = getattr(args, "raw_output", None)
|
|
319
|
+
if raw_output_path:
|
|
320
|
+
output_path = Path(raw_output_path).expanduser()
|
|
321
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
322
|
+
torch.save(raw_output, output_path)
|
|
323
|
+
print(f"Saved raw postprocess output to {output_path}")
|
|
324
|
+
else:
|
|
325
|
+
print(
|
|
326
|
+
"Generated raw export-style postprocess output. Use `--raw-output` to save it."
|
|
327
|
+
)
|
|
328
|
+
return raw_output
|
|
329
|
+
|
|
330
|
+
result = model.postprocess(output, **postprocess_kwargs)
|
|
331
|
+
|
|
332
|
+
save_path = resolve_output_path(args.output, command, args.source, args.model)
|
|
333
|
+
result.plot(source_path=args.source, save_path=save_path, **plot_kwargs)
|
|
334
|
+
print(f"Saved result to {os.path.relpath(save_path)}")
|
|
335
|
+
return result
|
|
336
|
+
finally:
|
|
337
|
+
model.dispose()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Vision compilation CLI command."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _run_compile(args: argparse.Namespace) -> int:
|
|
10
|
+
"""Compile a vision model from parsed CLI arguments.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
args: Parsed compilation arguments.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
Successful process status.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
from mblt_vision.compile import compile_vision_model
|
|
21
|
+
|
|
22
|
+
output_path = compile_vision_model(
|
|
23
|
+
model_cls=args.model_cls,
|
|
24
|
+
target_device=args.target_device,
|
|
25
|
+
model_type=args.model_type,
|
|
26
|
+
model_path=args.model_path,
|
|
27
|
+
data_path=args.data_path,
|
|
28
|
+
subset_path=args.subset_path,
|
|
29
|
+
calib_data_path=args.calib_data_path,
|
|
30
|
+
save_path=args.save_path,
|
|
31
|
+
subset_size=args.subset_size,
|
|
32
|
+
seed=args.seed,
|
|
33
|
+
percentile=args.percentile,
|
|
34
|
+
topk_ratio=args.topk_ratio,
|
|
35
|
+
)
|
|
36
|
+
except ImportError as exc:
|
|
37
|
+
print(str(exc), file=sys.stderr)
|
|
38
|
+
raise SystemExit(2) from exc
|
|
39
|
+
print(f"Compiled MXQ model to {output_path}")
|
|
40
|
+
return 0
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def add_compile_parser(
|
|
44
|
+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
|
|
45
|
+
) -> argparse.ArgumentParser:
|
|
46
|
+
"""Register the vision compilation command.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
subparsers: Main CLI subparser collection.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Registered compile command parser.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
parser = subparsers.add_parser(
|
|
56
|
+
"compile", help="Compile a configured vision ONNX model to MXQ."
|
|
57
|
+
)
|
|
58
|
+
parser.set_defaults(_handler=_run_compile)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"--model-cls",
|
|
61
|
+
required=True,
|
|
62
|
+
help="Vision model name, for example `alexnet` or `yolo11m`.",
|
|
63
|
+
)
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--target-device",
|
|
66
|
+
required=True,
|
|
67
|
+
choices=["aries-rb", "regulus-ra", "regulus-rb"],
|
|
68
|
+
help="Required NPU board target for the compiled MXQ artifact.",
|
|
69
|
+
)
|
|
70
|
+
parser.add_argument(
|
|
71
|
+
"--model-type",
|
|
72
|
+
default="DEFAULT",
|
|
73
|
+
help="Model variant from the YAML configuration.",
|
|
74
|
+
)
|
|
75
|
+
parser.add_argument(
|
|
76
|
+
"--model-path",
|
|
77
|
+
"--onnx-path",
|
|
78
|
+
dest="model_path",
|
|
79
|
+
help="Preferred local ONNX file. Missing files fall back to the configured hosted artifact.",
|
|
80
|
+
)
|
|
81
|
+
data_group = parser.add_mutually_exclusive_group()
|
|
82
|
+
data_group.add_argument(
|
|
83
|
+
"--data-path",
|
|
84
|
+
help="Original organized dataset root; organize, sample, and preprocess it as needed.",
|
|
85
|
+
)
|
|
86
|
+
data_group.add_argument(
|
|
87
|
+
"--subset-path",
|
|
88
|
+
help="Already-sampled image subset; skip original dataset preparation and sampling.",
|
|
89
|
+
)
|
|
90
|
+
data_group.add_argument(
|
|
91
|
+
"--calib-data-path",
|
|
92
|
+
"--calib-data-dir",
|
|
93
|
+
dest="calib_data_path",
|
|
94
|
+
help="Ready directory of preprocessed .npy tensors; pass it directly to qbcompiler.",
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"--save-path",
|
|
98
|
+
help="Output MXQ path. Defaults to the ONNX stem under ~/.mblt_model_zoo.",
|
|
99
|
+
)
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
"--subset-size",
|
|
102
|
+
type=int,
|
|
103
|
+
help="Per-category ImageNet/WiderFace count or total count for other datasets.",
|
|
104
|
+
)
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"--seed", type=int, default=0, help="Deterministic calibration subset seed."
|
|
107
|
+
)
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
"--percentile", type=float, help="Quantization percentile override."
|
|
110
|
+
)
|
|
111
|
+
parser.add_argument(
|
|
112
|
+
"--topk-ratio", type=float, help="Quantization top-k ratio override."
|
|
113
|
+
)
|
|
114
|
+
return parser
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
__all__ = ["add_compile_parser"]
|
mblt_vision/cli/main.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Standalone command-line entry point for Mobilint Vision."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
|
|
8
|
+
from .compile import add_compile_parser
|
|
9
|
+
from .predict import add_predict_parser
|
|
10
|
+
from .val import add_val_parser
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
14
|
+
"""Build the standalone Vision command parser."""
|
|
15
|
+
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
prog="mblt-vision",
|
|
18
|
+
description="Run, validate, and compile Mobilint Vision models.",
|
|
19
|
+
)
|
|
20
|
+
subparsers = parser.add_subparsers(help="mblt-vision commands")
|
|
21
|
+
add_predict_parser(subparsers)
|
|
22
|
+
add_val_parser(subparsers)
|
|
23
|
+
add_compile_parser(subparsers)
|
|
24
|
+
return parser
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
28
|
+
"""Run the standalone Vision command-line interface."""
|
|
29
|
+
|
|
30
|
+
parser = build_parser()
|
|
31
|
+
args = parser.parse_args(argv)
|
|
32
|
+
if hasattr(args, "_handler"):
|
|
33
|
+
return int(args._handler(args))
|
|
34
|
+
parser.print_help()
|
|
35
|
+
return 1
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Vision prediction CLI command."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
|
|
7
|
+
from ._vision import (
|
|
8
|
+
add_e2e_arg,
|
|
9
|
+
add_threshold_args,
|
|
10
|
+
add_vision_parser,
|
|
11
|
+
run_vision_inference,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _cmd_predict(args: argparse.Namespace) -> int:
|
|
16
|
+
"""Runs vision inference on a source image."""
|
|
17
|
+
|
|
18
|
+
run_vision_inference(args, command="predict")
|
|
19
|
+
return 0
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def add_predict_parser(
|
|
23
|
+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
|
|
24
|
+
) -> None:
|
|
25
|
+
"""Registers the unified vision prediction CLI command."""
|
|
26
|
+
|
|
27
|
+
parser = add_vision_parser(
|
|
28
|
+
subparsers,
|
|
29
|
+
command="predict",
|
|
30
|
+
help_text=(
|
|
31
|
+
"Run vision inference for classification, depth estimation, detection, instance or semantic "
|
|
32
|
+
"segmentation, OBB, pose, and face detection."
|
|
33
|
+
),
|
|
34
|
+
description=(
|
|
35
|
+
"Run a configured Vision model on one image. The selected model determines the task, "
|
|
36
|
+
"preprocessing, postprocessing, and output visualization automatically."
|
|
37
|
+
),
|
|
38
|
+
epilog="""Supported tasks:
|
|
39
|
+
image classification, depth estimation, object and face detection, instance
|
|
40
|
+
and semantic segmentation, oriented bounding boxes (OBB), and pose estimation.
|
|
41
|
+
|
|
42
|
+
The command downloads the default MXQ artifact when no local model path is supplied,
|
|
43
|
+
then writes a plotted result under runs/vision/predict/ by default. Use --output to
|
|
44
|
+
choose the image destination. Use --framework onnx with --model-path or --onnx-path
|
|
45
|
+
for ONNX Runtime inference; MXQ is the default framework.
|
|
46
|
+
|
|
47
|
+
Examples:
|
|
48
|
+
mblt-vision predict --source image.jpg --model resnet50 --topk 3
|
|
49
|
+
mblt-vision predict --source image.jpg --model yolo11m --conf-thres 0.4 --output result.jpg
|
|
50
|
+
mblt-vision predict --source image.jpg --model yolo11m --framework onnx
|
|
51
|
+
mblt-vision predict --source image.jpg --model yolo11m-pose --target-device regulus-ra --core-mode single
|
|
52
|
+
|
|
53
|
+
For export-style YOLO output, use --e2e false and optionally save it with --raw-output.""",
|
|
54
|
+
handler=_cmd_predict,
|
|
55
|
+
)
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
"--topk", type=int, default=5, help="Number of classification labels to show."
|
|
58
|
+
)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"--raw-output",
|
|
61
|
+
help="Path to save raw export-style output with `--e2e false`.",
|
|
62
|
+
)
|
|
63
|
+
add_threshold_args(parser, conf_default=0.25, iou_default=None)
|
|
64
|
+
add_e2e_arg(parser)
|