[Python] When running detectron2: The checkpoint state_dict contains keys that are not used by...

Discussão em 'Python' iniciado por Stack, Junho 12, 2025.

  1. Stack

    Stack Membro Participativo

    I implemented code that uses detectron2 to detect moving objects in short videos. Everything was working fine for a few weeks and then this warning appeared randomly out of nowhere, because I didn't change anything with the code nor did I install any updates.

    Full warning after which the code does not proceed with detection:

    D:\detectron2>python motion_detection_2.py
    [02/27 12:39:29 d2.checkpoint.detection_checkpoint]: [DetectionCheckpointer] Loading from detectron2://PointRend/InstanceSegmentation/pointrend_rcnn_X_101_32x8d_FPN_3x_coco/28119989/model_final_ba17b9.pkl ...
    WARNING [02/27 12:39:30 d2.projects.point_rend.mask_head]: Weight format of PointRend models have changed! Applying automatic conversion now ...
    The checkpoint state_dict contains keys that are not used by the model:
    pixel_mean
    pixel_std


    Did anyone encounter similar problem and have any idea how to fix it?

    I tried checking detectron2 files to look for the missing keys. I found this instead:

    detectron2/checkpoint/detection_checkpoint.py line 129

    for k in ["pixel_mean", "pixel_std"]:
    # Ignore missing key message about pixel_mean/std.
    # Though they may be missing in old checkpoints, they will be correctly
    # initialized from config anyway.
    if k in model_buffers:
    try:
    incompatible.missing_keys.remove(k)
    except ValueError:
    pass


    I checked if this code is being used when running my script and it indeed is. So now I am even more confused.

    Continue reading...

Compartilhe esta Página