Skip to content

v1.6.3: cannot use checkpoint *.ckpt file to predict and convert to ONNX as we could do with *.pth files #924

@LeMinhNgan

Description

@LeMinhNgan

Search before asking

  • I have searched the RF-DETR issues and found no similar feature requests.

Description

I try to load weights from "last.ckpt" into its model for prediction and ONNX conversion with specific resolution and device but meet error:

checkpoint_num_classes = checkpoint["model"]["class_embed.bias"].shape[0]
KeyError: 'model'

My code is:

model= RFDETRLarge(pretrain_weights= cfg.checkpoint_path, resolution= cfg.resolution, device= 'cuda')
model.export(output_dir= cfg.output_dir, verbose=False)
detections= model.predict(image, threshold=0.5)

I don't have this issue with other *.pth files. Please advise how to solve it. I wonder if we can back to *.pth file as v1.5.x

Use case

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions