Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 31 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,27 +297,31 @@ ultralytics-inference predict --model yolo26n.onnx --source image.jpg

**CLI Options:**

| Option | Short | Description | Default |
| -------------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `--model` | `-m` | Path to ONNX model file; auto-downloaded if a known YOLOv8/YOLO11/YOLO26 name | `yolo26n.onnx` |
| `--task` | | Task type (`detect`, `segment`, `semantic`\*, `depth`\*, `classify`, `pose`, `obb`); selects nano model when `--model` is omitted | `detect` |
| `--source` | `-s` | Input source (image, directory, glob, video, webcam index, or URL) | Task-dependent Ultralytics URL assets |
| `--conf` | | Confidence threshold | `0.25` |
| `--iou` | | IoU threshold for NMS | `0.5` |
| `--max-det` | | Maximum number of detections | `300` |
| `--imgsz` | | Inference image size | model metadata |
| `--rect [<BOOL>]` | | Enable rectangular inference (minimal padding) | `true` |
| `--tile [<TILE>]` | | Tile size for overlapping-window inference; bare `--tile` uses `--imgsz` | off |
| `--retina-masks` | | Build segmentation masks at the original image size instead of the inference size | `false` |
| `--batch` | | Batch size for inference | `1` |
| `--quantize` | | Inference precision: `8`, `16`, `32`, `int8`, `fp16`, `fp32`, `w8a8`, `w16a16`, `w32a32`, `w8a16`, or `w8a32` | Model precision |
| `--save [<BOOL>]` | | Save annotated results to runs/\<task\>/predict | `true` |
| `--save-frames` | | Save individual frames for video input (instead of video file) | `false` |
| `--save-json` | | Save semantic segmentation class-map PNGs for external evaluation | `false` |
| `--show` | | Display results in a window | `false` |
| `--device` | | Device string, e.g. cpu, cuda:0, coreml, directml:0, intel:cpu, intel:gpu, intel:npu, tensorrt:0, rocm:0, migraphx:0, xnnpack; each needs its feature, and a requested device that is not built or fails to load is an error | auto (best available provider; `cpu` when no accelerator feature is enabled) |
| `--verbose [<BOOL>]` | | Show verbose output | `true` |
| `--classes` | | Filter by class IDs, e.g. `0` or `"0,1,2"` or `"[0, 1, 2]"` | all classes |
| Option | Short | Description | Default |
| ------------------------ | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `--model` | `-m` | Path to ONNX model file; auto-downloaded if a known YOLOv8/YOLO11/YOLO26 name | `yolo26n.onnx` |
| `--task` | | Task type (`detect`, `segment`, `semantic`\*, `depth`\*, `classify`, `pose`, `obb`); selects nano model when `--model` is omitted | `detect` |
| `--source` | `-s` | Input source (image, directory, glob, video, webcam index, or URL) | Task-dependent Ultralytics URL assets |
| `--conf` | | Confidence threshold | `0.25` |
| `--iou` | | IoU threshold for NMS | `0.5` |
| `--max-det` | | Maximum number of detections | `300` |
| `--imgsz` | | Inference image size | model metadata |
| `--rect [<BOOL>]` | | Enable rectangular inference (minimal padding) | `true` |
| `--tile [<TILE>]` | | Tile size for overlapping-window inference; bare `--tile` uses `--imgsz` | off |
| `--retina-masks` | | Build segmentation masks at the original image size instead of the inference size | `false` |
| `--batch` | | Batch size for inference | `1` |
| `--quantize` | | Inference precision: `8`, `16`, `32`, `int8`, `fp16`, `fp32`, `w8a8`, `w16a16`, `w32a32`, `w8a16`, or `w8a32` | Model precision |
| `--save [<BOOL>]` | | Save annotated results to runs/\<task\>/predict | `true` |
| `--save-frames` | | Save individual frames for video input (instead of video file) | `false` |
| `--save-json` | | Save semantic segmentation class-map PNGs for external evaluation | `false` |
| `--show` | | Display results in a window | `false` |
| `--show-labels [<BOOL>]` | | Show class names in box labels | `true` |
| `--show-conf [<BOOL>]` | | Show confidences in box labels | `true` |
| `--show-boxes [<BOOL>]` | | Draw boxes and their labels | `true` |
| `--line-width` | | Box line width in pixels, which also sizes labels | from image size |
| `--device` | | Device string, e.g. cpu, cuda:0, coreml, directml:0, intel:cpu, intel:gpu, intel:npu, tensorrt:0, rocm:0, migraphx:0, xnnpack; each needs its feature, and a requested device that is not built or fails to load is an error | auto (best available provider; `cpu` when no accelerator feature is enabled) |
| `--verbose [<BOOL>]` | | Show verbose output | `true` |
| `--classes` | | Filter by class IDs, e.g. `0` or `"0,1,2"` or `"[0, 1, 2]"` | all classes |

`[<BOOL>]` marks a flag whose value is optional: passing it bare (`--rect`) sets it to `true`, and an explicit `--rect false` or `--rect=false` turns it off.

Expand Down Expand Up @@ -530,16 +534,19 @@ let mut model = YOLOModel::load_with_config("yolo26n.onnx", config)?;
let results = model.predict("aerial.jpg")?;
```

**Pose Drawing:**
**Drawing:**

`annotate_image_with_options` takes the keypoint options of Ultralytics `Results.plot`. A 17-keypoint (COCO-Pose)
model draws the human skeleton, any other layout draws one palette color per keypoint and no lines, and `skeleton`
`annotate_image_with_options` draws like Ultralytics `Results.plot` and takes its options: `line_width`, `show_boxes`,
`show_labels` and `show_conf` work like the CLI flags of the same name, and the keypoint options style pose. A
17-keypoint (COCO-Pose) model draws the human skeleton, any other layout draws one palette color per keypoint and no lines, and `skeleton`
connects the keypoints of a custom model, each line in the color of its first keypoint:

```rust
use ultralytics_inference::annotate::{AnnotateOptions, annotate_image_with_options};

let options = AnnotateOptions {
line_width: Some(3),
show_conf: false,
kpt_radius: 5,
kpt_conf: 0.25,
skeleton: Some(vec![[0, 1], [1, 2]]),
Expand Down
Loading
Loading