Card Calibration v1
Inference weights for the Card Calibration project β automated color calibration via two-stage YOLO detection + tree-based regression.
Best result: XGBoost with Bayesian-tuned hyperparameters β Lab Mean ΞE = 4.59 (meets commercial printing standards).
Live Demo
Try it directly in your browser: HuggingFace Space
Files
| File | Description | Size |
|---|---|---|
yolo_first.pt |
YOLOv8-nano β calibration card detector | 6 MB |
yolo_second.pt |
YOLOv8-nano β 4-pattern detector (red/green/blue/black box) | 6 MB |
xgboost_v1.pkl |
XGBoost calibration model (best) | 3.5 MB |
random_forest_v1.pkl |
Random Forest calibration model | 45 MB |
Quick Start
from huggingface_hub import hf_hub_download
import joblib
from ultralytics import YOLO
REPO = "jeffliulab/card-calibration-v1"
# Download weights (cached in ~/.cache/huggingface/)
yolo_card_path = hf_hub_download(repo_id=REPO, filename="yolo_first.pt")
yolo_pattern_path = hf_hub_download(repo_id=REPO, filename="yolo_second.pt")
xgb_path = hf_hub_download(repo_id=REPO, filename="xgboost_v1.pkl")
# Load
yolo_card = YOLO(yolo_card_path)
yolo_pattern = YOLO(yolo_pattern_path)
xgb_model = joblib.load(xgb_path)
For the full inference pipeline (detect card β detect patterns β extract RGB β predict true color), see space/model_utils.py.
Inference Pipeline
Photo βββΆ YOLO Stage 1 βββΆ Card Crop βββΆ YOLO Stage 2 βββΆ 4 Patches
β
βββββββββββββββββββββ
βΌ
Feature Engineering
(9 deltas + 3 RGB)
β
βΌ
XGBoost / RF Model
β
βΌ
Predicted True RGB
Performance
| Model | RΒ² | RMSE | Lab Mean ΞE | Lab Median ΞE |
|---|---|---|---|---|
| XGBoost (tuned) | 0.8280 | 11.76 | 4.59 | 3.61 |
| Random Forest | 0.8225 | 12.10 | 5.20 | 3.96 |
ΞE < 3: professional Β· ΞE < 5: commercial printing Β· ΞE < 10: acceptable
Training Data
Dataset: jeffliulab/card-calibration-v1-data
- 255 hand-collected photos of color calibration cards
- Augmented to 2,294 samples (brightness/hue/blur/noise/rotation)
- 12-D feature vectors extracted from center 1/3 of each detected patch
- 70/30 train/test split,
random_state=42
Links
- GitHub: https://github.com/jeffliulab/Color_Calibration
- Live Demo: https://huggingface.co/spaces/jeffliulab/card-calibration-v1
- Dataset: https://huggingface.co/datasets/jeffliulab/card-calibration-v1-data
License
MIT β both data and model weights are freely available for research and commercial use.
- Downloads last month
- 95