DetectionModel Class
The main detection interface is defined inarm_system/perception/vision/detection/main.py:15:
Inference Method
Theinference() method performs object detection with the following parameters (arm_system/perception/vision/detection/main.py:20):
- conf: 0.55 - Minimum confidence threshold for detections
- verbose: False - Suppress detailed output
- imgsz: 640 - Input image size for the model
- stream: True - Enable streaming mode for efficiency
- task: ‘detect’ - Object detection task
- half: True - Use FP16 half-precision for faster inference
Return Values
The method returns a tuple containing:- results: List of
Resultsobjects from Ultralytics - names: Dictionary mapping class IDs to class names
Confidence Threshold Settings
The system uses two confidence thresholds:Model Inference Threshold
Set during inference at 0.55 (arm_system/perception/vision/detection/main.py:20):
Processing Threshold
Configurable inImageProcessor (default 0.45) for filtering detections (arm_system/perception/vision/image_processing.py:9):
arm_system/communication/serial_manager.py:50):
Integration with Main System
The detection workflow is triggered during object scanning inserial_manager.py:174:
Detection Workflow
The complete detection workflow consists of:- Image Capture: Camera captures image when object is detected by sensors
- YOLO Inference: Model runs inference with conf=0.55
- Result Processing: Best detection above threshold is selected
- Filtering: Only specific classes are recognized (apple, orange, bottle)
- Callback: Detection data is sent to the central system
Processing Details
TheImageProcessor class handles detection processing (arm_system/perception/vision/image_processing.py:24):
Class Filtering
Only three object classes are recognized (arm_system/perception/vision/image_processing.py:50):
- apple
- orange
- bottle
Visualization
Detections are automatically drawn on images with bounding boxes and labels (arm_system/perception/vision/image_processing.py:74):
_detected.jpg suffix (arm_system/perception/vision/image_processing.py:93).