- assigned_to: EHxuban11
Originally created by: EHxuban11
Originally owned by: EHxuban11
In v1.0.0, when LibreYOLO() gets a .pt file, it identifies the model family by inspecting state dict key names (e.g., YOLOX wins if keys contain backbone.backbone or head.stems) and the model size by inspecting tensor shapes (e.g., first conv has 16 output channels → size t).
This is fragile, if a future model has overlapping key names, the factory silently picks the wrong class. It also scales poorly: every new model family or variant requires a new set of heuristic rules. As we add more models and variants (e.g. YOLOv9 segmentation), this set of rules will keep growing.
Current state:
Our training pipeline already saves model_family, size, and nc in checkpoints, so any model trained through LibreYOLO already has the metadata. The factory just doesn't use it yet.
What needs to happen:
The key-sniffing heuristics stay as a fallback for raw upstream weights that weren't converted through our pipeline.
Out of scope: RF-DETR checkpoints are saved by the upstream rfdetr package, we don't control their format, so they'll continue to rely on key-sniffing.
The sooner we do this, the fewer backward compatibility issues we'll create as the weight library grows.