Overview
TheModelLoader class handles loading and initialization of YOLO11s NCNN models for object detection in the robotic arm system.
Source: arm_system/perception/vision/detection/model_loader.py:7
Class Definition
ModelLoader
{current_directory}/models/yolo11s_ncnn_model
Attributes
Loaded YOLO model instance configured for object detection
arm_system/perception/vision/detection/model_loader.py:8
Methods
get_model
Ultralytics YOLO model ready for inference
arm_system/perception/vision/detection/model_loader.py:13
Model Details
YOLO11s NCNN Format
The loader uses YOLO11s in NCNN format:- Framework: NCNN (neural compute network)
- Model Size: Small (11s variant)
- Task: Object detection
- Format: Optimized for edge devices
Directory Structure
Example Usage
Integration
Used by DetectionModel to load the YOLO model:Model Configuration
The loaded model includes: Attributes:names: Dictionary mapping class IDs to class namestask: Set to ‘detect’ for object detection
- Object detection on images
- Bounding box prediction
- Class classification
- Confidence scoring
NCNN Benefits
Why NCNN Format:- Optimized for Embedded Systems: Designed for ARM processors (Raspberry Pi)
- Low Memory Footprint: Efficient memory usage
- Fast Inference: Optimized for CPU inference
- No GPU Required: Runs efficiently on CPU-only devices
Path Resolution
model_loader.py file location, ensuring portability across different deployment environments.
Complete Example
Dependencies
ultralytics (includes YOLO and NCNN support)
Error Handling
If the model path is invalid or the model files are missing, the YOLO constructor will raise an exception. Ensure the model directory exists and contains valid NCNN model files:model.ncnn.param- Network architecturemodel.ncnn.bin- Model weights