CS

coderxiaokai/skill

Developer tools
4 stars Quality 52 Trend 20

— built for OpenAI Codex. Auto-loads by task description, or invoke with $yolo-training / $traffic-vehicle-count.

Overview

— built for OpenAI Codex. Auto-loads by task description, or invoke with $yolo-training / $traffic-vehicle-count. Two Codex skills I put together for my own image-processing and traffic work: - — turn a detection dataset into a trained, exported model (convert annotations → split → train → evaluate → export → infer). - — count vehicles in a video, including directional flow across a virtual line you draw in the frame. Both are plain folders (SKILL.md + a scripts/ dir) in .agents/skills/. Codex discovers them when you work inside this repo, and picks them up automatically when your task matches the skill's description, or you can invoke them by name ($yolo-training, $traffic-vehicle-count). Skills installed here work repo-wide. To use them everywhere, copy (or symlink) the folders to ~/.agents/skills/. Tested on Windows 11 + Anaconda (CUDA, RTX 4080). Should work on Linux/macOS too. One gotcha: if conda create fails with UnavailableInvalidChannel, a dead mirror channel in your .

README

YOLO Skills for Codex

Codex skill — built for OpenAI Codex. Auto-loads by task description, or invoke with $yolo-training / $traffic-vehicle-count.

Two Codex skills I put together for my own image-processing and traffic work:

  • yolo-training — turn a detection dataset into a trained, exported model (convert annotations → split → train → evaluate → export → infer).
  • traffic-vehicle-count — count vehicles in a video, including directional flow across a virtual line you draw in the frame.

Both are plain folders (SKILL.md + a scripts/ dir) in .agents/skills/. Codex discovers them when you work inside this repo, and picks them up automatically when your task matches the skill’s description, or you can invoke them by name ($yolo-training, $traffic-vehicle-count).

Languages · 简体中文 · 日本語 · 한국어


Layout

.
├── .agents/skills/
│   ├── yolo-training/
│   │   ├── SKILL.md
│   │   └── scripts/
│   │       ├── convert_to_yolo.py   VOC/COCO/txt -> YOLO labels
│   │       ├── prepare_dataset.py   train/val/test split + data.yaml
│   │       ├── evaluate_yolo.py     mAP + per-class report
│   │       ├── export_yolo.py       ONNX / TensorRT / TorchScript
│   │       └── infer_yolo.py        run the model on an image
│   └── traffic-vehicle-count/
│       ├── SKILL.md
│       └── scripts/
│           └── count_vehicles.py    crossing counts, directions, annotated video
├── requirements.txt
└── README.md

Skills installed here work repo-wide. To use them everywhere, copy (or symlink) the folders to ~/.agents/skills/.


Setup

Tested on Windows 11 + Anaconda (CUDA, RTX 4080). Should work on Linux/macOS too.

# 1. install the Codex CLI
npm install -g @openai/codex

# 2. create a python environment and install the dependencies
conda create -n yolo python=3.12 -y
conda run -n yolo python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
conda run -n yolo python -m pip install ultralytics

One gotcha: if conda create fails with UnavailableInvalidChannel, a dead mirror channel in your .condarc is usually the cause — add --override-channels -c conda-forge to get around it.


Using the skills

You can hand the whole job to Codex in plain words — “train a detector on this dataset” — and the skill walks through it. Or run the steps yourself:

Train a detector

# 1. convert VOC annotations to YOLO
python .agents/skills/yolo-training/scripts/convert_to_yolo.py datasets/voc \
    --format voc --classes classes.txt --out datasets/yolo

# 2. split train/val and write data.yaml
python .agents/skills/yolo-training/scripts/prepare_dataset.py datasets/yolo --val 0.2

# 3. train
yolo detect train data=/abs/path/datasets/yolo/data.yaml \
    model=yolov8n.pt epochs=50 imgsz=640 device=0

# 4. evaluate
python .agents/skills/yolo-training/scripts/evaluate_yolo.py \
    runs/detect/train/weights/best.pt --data datasets/yolo/data.yaml

# 5. export + infer
python .agents/skills/yolo-training/scripts/export_yolo.py best.pt --format onnx --imgsz 640
python .agents/skills/yolo-training/scripts/infer_yolo.py best.pt --source img.jpg

Count vehicles in a video

The pretrained COCO yolov8n already recognises vehicles, so this works without training:

python .agents/skills/traffic-vehicle-count/scripts/count_vehicles.py \
    --weights yolov8n.pt --source traffic.mp4 \
    --line 0,540,1920,540 --classes 2,5,7,3 --out runs/count

COCO vehicle class ids: 1=bicycle 2=car 3=motorcycle 5=bus 7=truck. The line coordinates are in source pixels — a vertical-ish line counts left/right, a horizontal-ish line counts up/down. Run with --reference first to dump one frame and pick coordinates. Output is an annotated video, counts.csv, and stats.json.


Did it work

Instead of real footage I tested both skills on synthetic data — colored rectangles as vehicles, and a two-car video where one car crosses a vertical line each direction. The count came back exactly 1 left and 1 right:

$ cat counts.csv          # from the two-car test video
class,direction,count
car,left,1
car,right,1
car,total,82
ALL,total,82

So the pipeline mechanics are verified; real-world numbers depend on your detector and camera. A few things I hit along the way: ultralytics’ metrics.box has no .names (read names from the model), relative project paths get nested under runs/detect/ (use absolute paths), and the counter drops tracks that vanish for a few frames — --max-gap (default 5) controls how tolerant that is.


MIT license. Model weights are subject to their own licenses (e.g. Ultralytics AGPL-3.0).

View the full README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add coderxiaokai/skill
New to MCP? Start with the mcpskill.org guide →