# Benchmark

> Profile YOLO model inference speed, FPS, and size across image sizes and export formats.

- **Type:** Skill
- **Install:** `agentstack add skill-macroman5-autotrain-yolo-benchmark`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [MacroMan5](https://agentstack.voostack.com/s/macroman5)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [MacroMan5](https://github.com/MacroMan5)
- **Source:** https://github.com/MacroMan5/autotrain-yolo/tree/master/.claude/skills/benchmark

## Install

```sh
agentstack add skill-macroman5-autotrain-yolo-benchmark
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Benchmark

Profile a YOLO model's inference performance across image sizes and devices.

## Inputs

### Model Path

1. If the user provides a model path, use it directly.
2. If not provided, look for the current best model:
   - Check `experiments/summary.md` for the latest best model path
   - Search `experiments/*/weights/best.pt` for the most recent
   - Fall back to asking the user

### Image Sizes

Default: `[320, 640, 1280]`. The user can override this list.

### Device

Detect available devices. Run on GPU (`0`) if available, CPU (`cpu`) always. If both exist, benchmark both and compare.

## Procedure

1. **Read `training-plan.md`** — check the "Deployment target" and "Secondary Goals" sections for latency/size constraints.

2. **Locate the model** using the lookup order above. Confirm the path exists before proceeding.

3. **Run benchmarks** — for each image size and each available device, run:

```python
from ultralytics import YOLO
import torch

model = YOLO(path)

# Check GPU availability
gpu_available = torch.cuda.is_available()
devices = ["cpu"]
if gpu_available:
    devices.insert(0, 0)  # GPU first

for device in devices:
    for imgsz in image_sizes:
        results = model.benchmark(imgsz=imgsz, half=False, device=device)
```

`model.benchmark()` handles warm-up internally. Do not add manual warm-up runs.

4. **Collect results** — from each benchmark call, extract:
   - Inference time (ms)
   - FPS (frames per second)
   - Model size (MB)
   - Format tested

5. **Report** — print a summary table:

```
## Benchmark Results: 

### GPU (NVIDIA ) / CPU

| Format   | imgsz | Inference (ms) | FPS    | Size (MB) |
|----------|-------|----------------|--------|-----------|
| PyTorch  | 320   | ...            | ...    | ...       |
| PyTorch  | 640   | ...            | ...    | ...       |
| PyTorch  | 1280  | ...            | ...    | ...       |
```

6. **Analyze against deployment constraints** — if `training-plan.md` specifies:
   - A latency target (e.g., "< 10ms"): flag any configuration that exceeds it
   - A model size limit: flag if the model exceeds it
   - A target device: highlight the relevant device results

7. **Recommend optimal imgsz** — based on the results:
   - Identify the largest imgsz that meets latency requirements
   - If no latency requirement is specified, note the speed/accuracy tradeoff (larger imgsz = better accuracy, slower inference)
   - If all sizes exceed the constraint, say so and suggest smaller model variants (n < s < m)

## Output Format

Print results directly to the conversation. Do not write to a file unless the user asks.

Structure:
1. Model info (path, parameter count, variant)
2. Results table(s) — one per device
3. Deployment check — pass/fail against `training-plan.md` constraints
4. Recommendation — optimal imgsz and format for the stated deployment target

## Important

- Do not export the model to other formats unless the user asks. `model.benchmark()` tests the PyTorch format by default.
- If `training-plan.md` has no deployment constraints, skip the constraint check and just report the numbers.
- Keep output factual. Report what the numbers show, suggest next steps if relevant.
- If the model file does not exist, stop and tell the user. Do not train a model.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [MacroMan5](https://github.com/MacroMan5)
- **Source:** [MacroMan5/autotrain-yolo](https://github.com/MacroMan5/autotrain-yolo)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-macroman5-autotrain-yolo-benchmark
- Seller: https://agentstack.voostack.com/s/macroman5
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
