Object detector for YOLO models
Allows to use YOLO object detection models for image analysis
Installing/updating
Object detector for YOLO models is not included into EVA ICS distribution. To install/update it, either edit “eva/config/python-venv” registry key, specify the desired version in “extra” section (e.g. eva4-svc-yolo-detector>=0.0.1) and rebuild the Python virtual environment (/opt/eva4/sbin/venvmgr build). Or execute:
/opt/eva4/sbin/venvmgr add eva4-svc-yolo-detector
# or
/opt/eva4/sbin/venvmgr add eva4-svc-yolo-detector==N # where N = version number
The latest eva-shell version number can be obtained from https://pypi.org/project/eva4-svc-yolo-detector/
Setup
Use the template EVA_DIR/share/svc-tpl/svc-tpl-yolo-detector.yml:
# Detector service for Ultralytics YOLO models
#
# Requires https://pypi.org/project/eva4-svc-yolo-detector/ Python module installed
command: venv/bin/eva4-svc-yolo-detector
bus:
path: var/bus.ipc
config:
# Path to the YOLO model file. In case of model formats other than PyTorch,
# ensure the YOLO runtime is installed in the venv
model: /opt/eva4/cv/yolo11m.pt
# Classes to detect
classes:
# The class color used for the debug stream and 3rd party apps
- color: orange
# Confidence threshold for the class
confidence: 0.1
# Class id, according to the model, can be an integer or a string
id: person
# Key points, e.g. for YOLO-pose models. If the color is not specified, the
# key point is ignored in the debug stream. The model MUST provide keypoints otherwise
# the detector will fail to work
#keypoints:
#colors:
#- null
#- green
#- green
#- null
#- null
#- blue
#- blue
#- '#336699'
#- '#336699'
#- '#99CCFF'
#- '#99CCFF'
#- red
#- red
#- '#996633'
#- '#996633'
#- '#FFCC99'
#- '#FFCC99'
#enable: true
# Raw stream source OID, must provide RGB8 frames
oid_src: sensor:streams/s0/raw
# Debug stream OID, filled with RGB8 frames with detection boxes and keypoints
#oid_cv_debug: sensor:streams/s0/cv/debug
# Destination OID for detection results, filled with detection results (object)
#oid_dst: sensor:streams/s0/cv/json
# lmacro to process detections, executed with an argument (_1) containing the detections
# and "detector_stats" variable containing detector statistics
#process: lmacro:streams/s0/cv/process
user: eva # make sure the user has access to the model file
# the service may consume relatively large amounts of memory, set the warning
# threshold accordingly
mem_warn: 1500000000
Create the service using eva-shell:
eva svc create eva.detector.1 /opt/eva4/share/svc-tpl/svc-tpl-yolo-detector.yml
or using the bus CLI client:
cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -
(see eva.core::svc.deploy for more info)
EAPI methods
See EAPI commons for the common information about the bus, types, errors and RPC calls.
detector.stats
Description |
Get detector stats |
Parameters |
none |
Returns |
Detector stats |
Return payload example:
{
"fps": 30,
"frames_dropped": 3,
"frames_processed": 149,
"status": "ready",
"t_avg_ms": 25,
"t_max_ms": 141,
"t_min_ms": 18
}