DetectorYolox¶
processing extra: detector-yolox
Detect objects in frames with a YOLOX model exported to ONNX, on ONNX Runtime, and attach them to the frame as plain data.
- Node type:
DetectorYolox- Input:
ImagePayload- Output:
ImagePayloadwithmeta['detections']- Extra:
detector-yolox
$ pip install "juturna-nodes[detector-yolox]"
The node README describes the models and where they are downloaded, the output message, and the limits of the node.
How it works¶
On warmup the node loads the model and runs it once. yolox_nano,
yolox_tiny and yolox_s are downloaded on first use from the
YOLOX releases,
checked against a fixed size and sha256, and kept in
$XDG_CACHE_HOME/juturna/models/ (~/.cache/juturna/models/ by default).
Any other value of model is the path of a YOLOX .onnx file, exported
with a fixed square input (not --dynamic) and the 80 COCO classes.
For every frame, the image is scaled to the model input (416 px for nano and tiny, 640 px for s) keeping its ratio, padded with grey, and converted to BGR. The boxes are mapped back to the pixels of the original frame. Overlapping boxes are merged whatever their class, as in the YOLOX demo.
The models, from the fastest to the slowest:
Model |
Input |
Download |
|---|---|---|
|
416 px |
3.7 MB |
|
416 px |
20 MB |
|
640 px |
36 MB |
When the frames come faster than the model, they queue up: limit them at the
source (for example with the fps argument of VideoCapture).
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
|
COCO class names to keep ( |
|
|
|
Minimum score of a detection |
|
|
|
Overlap (IoU) above which two boxes are merged |
|
|
|
|
Input message¶
Field |
Use |
|---|---|
|
|
Output message¶
The same payload, version and timers as the input, and:
Field |
Content |
|---|---|
|
List of |
DetectionEvents turns this list into JSON events.
Limits¶
The 80 COCO classes only. The boxes are not drawn on the frame.
The resize uses the nearest pixel instead of the linear interpolation of the original YOLOX code: small objects may get slightly lower scores.
License¶
Code: the pre and post-processing of this node are ported from the YOLOX ONNXRuntime demo, in the YOLOX repository, which Megvii releases under Apache-2.0 (its
LICENSEfile).Weights:
yolox_nano.onnx,yolox_tiny.onnxandyolox_s.onnxare assets of the 0.1.1rc0 release of the same repository. Neither the release notes nor the repository README give them a separate license, so the Apache-2.0 of the repository is the only one stated. The models are trained on COCO.requests: Apache-2.0 (the license of requests on PyPI), to download the default models.
Runtime: ONNX Runtime (
onnxruntimeon PyPI) is MIT licensed.
Unlike DetectorYolo (ultralytics, AGPL-3.0), none of these licenses is
copyleft.
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
model = "yolox_nano"
targets = []
confidence = 0.3
nms = 0.45
device = "cpu"
[meta]
Pipeline usage¶
{
"name": "detector",
"type": "DetectorYolox",
"configuration": { "model": "yolox_nano", "targets": ["person", "car"] }
}
Reference¶
- class DetectorYolox(
- model: str,
- targets: list,
- confidence: float,
- nms: float,
- device: str,
- **kwargs,
Attach the objects found by a YOLOX model to each frame