# longjingcha/yolov8skill architecture

> Architecture diagram of the GitHub repository longjingcha/yolov8skill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/longjingcha/yolov8skill
- Repository: https://github.com/longjingcha/yolov8skill

## Overview

This repository is an Agent-invokable YOLO camera-detection skill with a data-improvement loop. Its main workflow captures images, creates candidate labels, scores label risk for review, prepares YOLO data, trains a model, then supports live detection, reporting, and hard-case collection. The graph retains the documented FastSAM capability and the alternate auto-label/train entry point. Pipeline links are supported by its excerpt or SOURCE INDEX references; capability links explicitly documented only in the README are cited there. Unsampled implementation details are not inferred.

Main entry points: [`skills/yolo-camera-skill/pipeline.py`](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/pipeline.py) (Workflow Pipeline), [`yolo_dataset`](https://github.com/longjingcha/yolov8skill/tree/main/yolo_dataset) (YOLO Dataset), [`skills/yolo-camera-skill/live_detect.py`](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/live_detect.py) (Live Detection), [`skills/yolo-camera-skill/hard_case_collect.py`](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/hard_case_collect.py) (Hard-case Collection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and Detection"]
  node_capture_script["Camera Capture"]
  node_live_detect["Live Detection<br/>[live_detect.py]"]
  node_detector["YOLO Detection<br/>[live_detect.py]"]
  node_segmentation["FastSAM Segmentation<br/>[FastSAM-s.pt]"]
end

subgraph group_labeling["Labeling and Review"]
  node_fastsam_label["FastSAM Labeling"]
  node_qwen_label["Qwen Candidate Labels<br/>[qwen_label.py]"]
  node_risk_score["Risk Scoring<br/>[risk_scoring.py]"]
  node_hard_cases["Hard-case Collection"]
end

subgraph group_training["Training and Evaluation"]
  node_dataset["YOLO Dataset"]
  node_prepare_data["Dataset Preparation<br/>[prepare_data.py]"]
  node_train["Model Training<br/>[train.py]"]
  node_weights["Model Weights<br/>[best.pt]"]
  node_report["Metrics and Reports<br/>[report.py]"]
end

subgraph group_orchestration["Skill Orchestration"]
  node_pipeline["Workflow Pipeline<br/>[pipeline.py]"]
  node_auto_train["Auto-label Train"]
end

node_user(("Agent or User"))
node_camera(("Camera"))
node_reviewer(("Human Reviewer"))

node_user -->|"invokes workflow"| node_pipeline
node_camera -->|"provides frames"| node_capture_script
node_pipeline -->|"runs capture"| node_capture_script
node_pipeline -->|"runs labeling"| node_qwen_label
node_pipeline -->|"runs scoring"| node_risk_score
node_pipeline -->|"runs preparation"| node_prepare_data
node_pipeline -->|"runs training"| node_train
node_pipeline -->|"generates report"| node_report
node_pipeline -->|"uses collector"| node_hard_cases
node_live_detect -->|"runs inference"| node_detector
node_live_detect -->|"delegates collection"| node_hard_cases
node_qwen_label -->|"flags risky labels"| node_reviewer
node_risk_score -->|"reports risk"| node_reviewer
node_reviewer -->|"corrects labels"| node_dataset
node_prepare_data -->|"prepares data"| node_dataset
node_train -->|"saves model"| node_weights
node_live_detect -->|"loads model"| node_weights
node_report -->|"summarizes dataset"| node_dataset
node_auto_train -->|"labels images"| node_fastsam_label
node_user -->|"requests segmentation"| node_segmentation
node_hard_cases -.->|"feeds iteration"| node_dataset
node_weights -.->|"supports visual analysis"| node_segmentation

click node_capture_script "https://github.com/longjingcha/yolov8skill/blob/main/capture_from_camera.py"
click node_live_detect "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/live_detect.py"
click node_detector "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/live_detect.py"
click node_fastsam_label "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/auto_label_train.py"
click node_qwen_label "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/qwen_label.py"
click node_risk_score "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/risk_scoring.py"
click node_hard_cases "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/hard_case_collect.py"
click node_dataset "https://github.com/longjingcha/yolov8skill/tree/main/yolo_dataset"
click node_prepare_data "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/prepare_data.py"
click node_train "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/train.py"
click node_weights "https://github.com/longjingcha/yolov8skill/blob/main/best.pt"
click node_report "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/report.py"
click node_pipeline "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/pipeline.py"
click node_auto_train "https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/auto_label_train.py"
click node_segmentation "https://github.com/longjingcha/yolov8skill/blob/main/FastSAM-s.pt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_capture_script,node_live_detect,node_detector,node_segmentation,node_user,node_reviewer toneBlue
class node_fastsam_label,node_qwen_label,node_risk_score,node_hard_cases toneAmber
class node_dataset,node_prepare_data,node_train,node_weights,node_report toneMint
class node_pipeline,node_auto_train toneRose
class node_camera toneIndigo
```

## Components

### Capture and Detection

- [Camera Capture](https://github.com/longjingcha/yolov8skill/blob/main/capture_from_camera.py): `capture_from_camera.py`
- [Live Detection](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/live_detect.py): `skills/yolo-camera-skill/live_detect.py`
- [YOLO Detection](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/live_detect.py): `skills/yolo-camera-skill/live_detect.py`
- [FastSAM Segmentation](https://github.com/longjingcha/yolov8skill/blob/main/FastSAM-s.pt): `FastSAM-s.pt`

### Labeling and Review

- [FastSAM Labeling](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/auto_label_train.py): `skills/yolo-camera-skill/auto_label_train.py`
- [Qwen Candidate Labels](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/qwen_label.py): `skills/yolo-camera-skill/qwen_label.py`
- [Risk Scoring](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/risk_scoring.py): `skills/yolo-camera-skill/risk_scoring.py`
- [Hard-case Collection](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/hard_case_collect.py): `skills/yolo-camera-skill/hard_case_collect.py`

### Training and Evaluation

- [YOLO Dataset](https://github.com/longjingcha/yolov8skill/tree/main/yolo_dataset): `yolo_dataset`
- [Dataset Preparation](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/prepare_data.py): `skills/yolo-camera-skill/prepare_data.py`
- [Model Training](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/train.py): `skills/yolo-camera-skill/train.py`
- [Model Weights](https://github.com/longjingcha/yolov8skill/blob/main/best.pt): `best.pt`
- [Metrics and Reports](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/report.py): `skills/yolo-camera-skill/report.py`

### Skill Orchestration

- [Workflow Pipeline](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/pipeline.py): `skills/yolo-camera-skill/pipeline.py`
- [Auto-label Train](https://github.com/longjingcha/yolov8skill/blob/main/skills/yolo-camera-skill/auto_label_train.py): `skills/yolo-camera-skill/auto_label_train.py`

### Other components

- **Agent or User**
- **Camera**
- **Human Reviewer**

## Connections

- Agent or User → Workflow Pipeline: invokes workflow (evidence: `README.md`)
- Camera → Camera Capture: provides frames (evidence: `capture_from_camera.py`)
- Workflow Pipeline → Camera Capture: runs capture (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Qwen Candidate Labels: runs labeling (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Risk Scoring: runs scoring (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Dataset Preparation: runs preparation (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Model Training: runs training (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Metrics and Reports: generates report (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Workflow Pipeline → Hard-case Collection: uses collector (evidence: `skills/yolo-camera-skill/pipeline.py`)
- Live Detection → YOLO Detection: runs inference (evidence: `skills/yolo-camera-skill/live_detect.py`)
- Live Detection → Hard-case Collection: delegates collection (evidence: `skills/yolo-camera-skill/live_detect.py`)
- Qwen Candidate Labels → Human Reviewer: flags risky labels (evidence: `skills/yolo-camera-skill/qwen_label.py`)
- Risk Scoring → Human Reviewer: reports risk (evidence: `skills/yolo-camera-skill/risk_scoring.py`)
- Human Reviewer → YOLO Dataset: corrects labels (evidence: `README.md`)
- Dataset Preparation → YOLO Dataset: prepares data (evidence: `skills/yolo-camera-skill/prepare_data.py`)
- Model Training → Model Weights: saves model (evidence: `skills/yolo-camera-skill/train.py`)
- Live Detection → Model Weights: loads model (evidence: `skills/yolo-camera-skill/live_detect.py`)
- Metrics and Reports → YOLO Dataset: summarizes dataset (evidence: `skills/yolo-camera-skill/report.py`)
- Auto-label Train → FastSAM Labeling: labels images (evidence: `skills/yolo-camera-skill/auto_label_train.py`)
- Agent or User → FastSAM Segmentation: requests segmentation (evidence: `README.md`)
- Hard-case Collection → YOLO Dataset: feeds iteration (evidence: `README.md`)
- Model Weights → FastSAM Segmentation: supports visual analysis
