Repository navigation
Labeling
Label Studio (:3005) is the primary annotation platform for CTIP. It handles image labeling, review workflows, and export to training format.
Start it:
cd docker && docker compose --profile annotation up -d
# or from setup wizard: Step 5 → Start Annotation StackAccess: http://localhost:3005
| Class | Color | Hotkey | Description |
|---|---|---|---|
| stalked | cyan #22d3ee
|
1 | Glandular trichome with visible stalk + head. Most common in mature flowers. |
| sessile | green #34d399
|
2 | Short or no stalk, head sits close to the surface. |
| bulbous | purple #a78bfa
|
3 | Smallest type, visible only under high magnification. |
| non-glandular | orange #fb923c
|
4 | Hair-like, no resin head. |
Quality rating (per image):
-
good— sharp, well-lit, all trichomes clearly visible -
blurry— focus issues, trichomes indistinct -
poor— overexposed, underexposed, or severe artifacts
Notes field: Free text for session notes (e.g., "day 65 flowering", "possible mold").
In Label Studio → project → task list → click any image.
Keyboard: d next, a previous, w submit.
- Press hotkey (1–4) to select a class
- Click and drag to draw a rectangle around a trichome head
- Box snaps to visible area — include the full head
- Repeat for every trichome in the image
After labeling all boxes:
- Click the appropriate quality choice at the bottom
- Add notes if relevant
Click Submit (or press w).
- Every trichome head fully visible in frame
- Partially cut trichomes at image edges (if >50% visible)
- Trichomes completely out of focus
- Trichomes where class is genuinely ambiguous
- Draw tight around the trichome head (not the stalk)
- Include the head + a 2-3px margin
- Don't include neighboring trichomes in the same box
| Mistake | Consequence |
|---|---|
| Skipping small trichomes | Model misses small ones → lower recall |
| Boxes too loose | Model learns incorrect spatial extent |
| Wrong class for ambiguous trichomes | Class confusion in model |
| Inconsistent quality across sessions | Inconsistent training signal |
CTIP classifies maturity optically based on head color/translucency:
| Stage | Visual | Description |
|---|---|---|
| clear | Transparent/glassy | Early development. Resin glands not fully developed. |
| cloudy | Milky white, opaque | Peak development. Most common harvest target. |
| amber | Yellow/amber tint | Degradation beginning. |
Scientific note: Color alone does not determine cannabinoid content. Maturity is an optical proxy only. Multiple factors (genetics, lighting, microscope) affect color perception.
Maturity is not annotated in Label Studio — it is predicted by the maturity classifier after detection.
# Export completed annotations as a YOLO dataset (session-grouped train/val/test split)
curl -X POST http://localhost:8000/api/v1/training/prepare-ls-dataset \
-H "Content-Type: application/json" -d '{"project_id": 1, "seed": 42}'
# Structure created (path returned as dataset_yaml):
# $DATA_ROOT/datasets/ls_export_<project>_<id>_<timestamp>/
# ├── images/{train,val,test}/
# ├── labels/{train,val,test}/
# └── dataset.yaml# data.yaml
path: /home/user/ctip-oss/data/datasets/strain-A-v1
train: images/train
val: images/val
nc: 4
names: [stalked, sessile, bulbous, non-glandular]CTIP tracks model confidence on unlabeled images and surfaces the most uncertain ones:
# Run inference on unlabeled pool
trichome active-learn --pool data/raw/unlabeled/ --model yolo11s --strategy entropy
# Exports ranked list to Label Studio as new tasks
# Annotate these first for maximum training valueCVAT (:3006) is available for video annotation or when polygon/polyline labeling is needed.
# Start CVAT alongside Label Studio
docker compose --profile annotation up -d
# Access
http://localhost:3006
# Default credentials (first launch)
# User: admin Password: admin (CHANGE IMMEDIATELY)CVAT export → YOLO format → same training pipeline as Label Studio.
CTIP — Cannabis Trichome Intelligence Platform · RTX 4060 / 8 GB VRAM · Backend API · MLflow · Label Studio
Installation & Setup
Scientific Workflow
Reference