feat: support rfdetr-keypoint-preview custom weights upload#507
Closed
mkaic wants to merge 1 commit into
Closed
Conversation
Enables uploading RF-DETR Keypoint Preview models through version.deploy(), workspace.deploy_model(), and the upload_model CLI: - register rfdetr-keypoint-preview in _RFDETR_MODEL_TYPE_TO_CLASS (RFDETRKeypointPreview ships in rfdetr>=1.8.0, the already-required minimum for the PTL-checkpoint path) - map keypoint model types to TASK_POSE in task_of_model_type so project type validation accepts keypoint-detection projects - detect keypoint checkpoints lacking model_name via args.keypoint_head (keypoint configs also carry segmentation_head=False, which previously misdetected them as detection) - add the keypoint-preview position-encoding grid (576 // 12 = 48, mirroring RFDETRKeypointPreviewConfig) for the variant mislabel check Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Note This comment was NOT written by Kai. It was written by Kai's Claude and posted through Kai's GitHub account on this PR. Closing as a duplicate of #496, which predates this PR and uses a more robust keypoint-checkpoint detection signal: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Code and PR description are LLM-written. Code has been reviewed and tested in staging by Kai
What
Enables uploading RF-DETR Keypoint Preview (
rfdetr-keypoint-preview) models to the Roboflow platform through the existing custom-weights flows:version.deploy(),workspace.deploy_model(), and theroboflow upload_modelCLI.The platform side already supports this model type: the model registry (
packages/shared/models/modelRegistry/rfdetrModels.jsinroboflow) registersrfdetr-keypoint-previewas a keypoint-detection model, and the export job (train/export/rfdetr/export.pyinroboflow-train, PR in flight) converts uploaded keypoint checkpoints — derivingkeypoints_metadata.jsonfrom the checkpoint'sargs.num_keypoints_per_class, so the existing bundle format (weights.pt+class_names.txt) needs no changes. This PR removes the client-side gate that rejected the model type.Changes (all in
roboflow/util/model_processor.py)rfdetr-keypoint-preview→RFDETRKeypointPreviewin_RFDETR_MODEL_TYPE_TO_CLASS. The class ships in publicrfdetr>=1.8.0, which is already the required minimum (RFDETR_MIN_VERSION) for the raw PyTorch-Lightning checkpoint path, so no dependency bump is needed.task_of_model_typenow maps model types containingkeypointtoTASK_POSE(the type string spells the task out instead of using the-posesuffix token). This makes project-type validation accept keypoint-detection projects and reject others.rf-detr-internalcarryargsbut nomodel_name, and their config setssegmentation_head=Falsealongsidekeypoint_head=True—_detect_rfdetr_taskpreviously misdetected them as detection. It now checksargs.keypoint_headfirst. Checkpoints withmodel_name(RFDETRKeypointPreview) were already classified as pose; they are now accepted rather than rejected.576 // 12 = 48, mirroringRFDETRKeypointPreviewConfiginrf-detr-internal/publicrfdetr) toRFDETR_POSITIONAL_ENCODING_SIZE.Cross-task mislabels stay rejected in both directions: a keypoint checkpoint uploaded as
rfdetr-baseand a detection checkpoint uploaded asrfdetr-keypoint-previewboth raiseTaskMismatchErrorbefore anything is uploaded.Testing
keypoint_headargs fallback (dict + namespace), project-type validation accept/reject, PE-grid match, full packaging flow, and both cross-task rejection directions.871 passed, 1 skippedlocally.torch.saved keypoint-style checkpoint (argsincludingkeypoint_head,num_keypoints_per_class,class_names): producesroboflow_deploy.zipwithweights.pt+ background-prefixedclass_names.txt, no warnings; uploading the same checkpoint asrfdetr-nanois rejected with an actionableTaskMismatchError.How to test an upload
🤖 Generated with Claude Code