Training custom models for drone video sensing analytics – a guide for software engineers
Summary: Train an object detection model in LandingLens using Custom Training (or the REST train API), download the model as ONNX, then import or re-export into Azure Custom Vision (ONNX flavor) and wire the exported ONNX artifact into the DVSA dvsa-api (https://github.com/ravibeta/dvsa-api) inference pipeline so agentic RAG queries can call the new detector.
Workflow overview
1. Prepare dataset and labels in LandingLens (assign splits: train/dev/test). Use Custom Training when you need control over architecture, epochs, preprocessing and augmentations.
2. Start a custom training job via the LandingLens UI or the REST POST /v1/projects/{project_id}/train payload specifying architecture, hyperParams.epochs, preprocessing and augmentations. Store the returned trainingId and monitor status.
3. Download the trained model as a ZIP and extract saved_model.onnx (or saved_model_tiled.onnx for large-image tiled models). Note: avoid RepPoints architectures if you plan to run with ONNX Runtime; prefer RtmDet-[9M] for ONNX compatibility.
4. Import/export to Azure Custom Vision: Azure Custom Vision accepts ONNX exports; you can programmatically export or upload ONNX artifacts and then use the Custom Vision Prediction endpoint or export again from Custom Vision to the desired flavor (ONNX10/ONNX12) for runtime. Use the Custom Vision SDK export_iteration and get_exports to retrieve the downloadable artifact.
5. Integrate into dvsa-api: replace or add an inference module that loads the ONNX model (ONNX Runtime or platform of choice), maps LandingLens label file to the DVSA tag schema, and exposes the same inference API endpoints used by the repo so agentic RAG components can query detections. For local app examples, see ONNX usage patterns (ML.NET example shows input/output names and resizing steps).
Key technical details and checks
• Model format: ONNX (saved_model.onnx) is the canonical interchange format from LandingLens for offline use.
• Architecture constraint: If you need ONNX Runtime compatibility, do not use RepPoints architectures; choose RtmDet variants.
• Label mapping: include labels.txt from LandingLens bundle and create a deterministic mapping to DVSA class IDs.
• Azure flavor: export/import using platform=ONNX and flavor=ONNX10 (or ONNX12) via the Custom Vision training client. Poll get_exports until status == "Done".
Integration checklist for engineers
• Data: verified annotated frames, splits assigned.
• Training: script or API call to LandingLens custom train; capture trainingId.
• Download: unzip and confirm saved_model.onnx and labels.txt.
• Azure: create Custom Vision project (Object Detection), upload ONNX or re-export via SDK if you want Azure-hosted prediction endpoints.
• Runtime: implement ONNX Runtime loader in dvsa-api inference module, ensure input tensor shape and preprocessing match training (resize, normalization). Validate with sample frames.
Step LandingLens action Artifact Azure action
Train Custom Training via UI or POST /v1/projects/.../train Trained model bundle (Optional) re-train or import ONNX into Custom Vision
Download Models → Download Model saved_model.onnx; labels.txt Use Custom Vision export_iteration or upload ONNX
Export flavor Choose RtmDet for ONNX ONNX (ONNX10/ONNX12) get_exports → download URI
Runtime Validate preprocessing & tile logic ONNX runtime-ready file Deploy to Azure Prediction or local ONNX Runtime
Risks & limitations: ONNX Runtime incompatibilities with some LandingLens architectures (RepPoints) and licensing/commercial-use limits on downloaded models; confirm project activation and plan limits before download.
References:
https://github.com/ravibeta/dvsa-api/
https://landinglens.docs.landing.ai/custom-training
https://landing-ai.github.io/public-rest-api/tutorial/training/custom_training/
https://landinglens.docs.landing.ai/download-models
https://learn.microsoft.com/en-us/azure/ai-services/custom-vision-service/export-programmatically
https://learn.microsoft.com/en-us/azure/ai-services/custom-vision-service/
https://learn.microsoft.com/en-us/dotnet/machine-learning/tutorials/object-detection-custom-vision-onnx
https://learn.microsoft.com/en-us/azure/ai-services/custom-vision-service/export-programmatically
No comments:
Post a Comment