Overview
TheDetectionModel class provides an interface to YOLO object detection models for real-time inference on robotic arm camera images.
Source: arm_system/perception/vision/detection/main.py:15
Interface Definition
DetectionModelInterface
arm_system/perception/vision/detection/main.py:9
Class Definition
DetectionModel
Attributes
Loaded YOLO model instance from ModelLoader
Methods
inference
Input image as NumPy array in BGR format (OpenCV format)
List of Ultralytics Results objects containing detection data
Dictionary mapping class IDs to class names
- conf: 0.55 (confidence threshold)
- verbose: False (suppress output)
- imgsz: 640 (input image size)
- stream: True (generator mode for memory efficiency)
- task: ‘detect’ (object detection)
- half: True (FP16 precision for faster inference)
arm_system/perception/vision/detection/main.py:19
Results Object Structure
The UltralyticsResults object contains:
- boxes: Bounding box data
boxes.xyxy- Box coordinates [x1, y1, x2, y2]boxes.conf- Confidence scoresboxes.cls- Class IDs
- names: Class name dictionary
Example Usage
Integration Example
Used by ImageProcessor for object detection:Model Configuration
The model is loaded with the following specifications:| Parameter | Value | Description |
|---|---|---|
| conf | 0.55 | Minimum confidence threshold |
| imgsz | 640 | Input image size (pixels) |
| half | True | FP16 precision mode |
| stream | True | Generator mode |
| task | detect | Object detection task |
Performance Optimization
Half Precision (FP16): Enabled for faster inference on compatible hardware (GPUs, some CPUs). Streaming Mode: Results are returned as a generator to reduce memory usage when processing multiple images. Image Size: Fixed at 640x640 for optimal balance between speed and accuracy.Supported Classes
The model supports all YOLO11s classes, with specific filtering for:- apple
- orange
- bottle