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

License

MIT β€” both data and model weights are freely available for research and commercial use.

Downloads last month
95
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train jeffliulab/card-calibration-v1

Space using jeffliulab/card-calibration-v1 1