Skip to content

Saving a trained model for inference #35

@soumik12345

Description

@soumik12345

I used Detectron2 to train a custom object detection model using faster_rcnn_R_50_C4_3x. While I am trying to save the trained model using torch.save or dump in using pickle, I am getting the following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-17-e3c685b650c8> in <module>()
      2 
      3 filehandler = open("hand_detection_faster_rcnn_R_50_C4_3x.pb.pkl", "wb")
----> 4 pickle.dump(predictor, filehandler)
      5 filehandler.close()

AttributeError: Can't pickle local object 'GeneralizedRCNN.__init__.<locals>.<lambda>'

How should I save the detectron2 predictor as a pytorch model for inference?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions