likyoo/open-cd

test

Opened this issue · 2 comments

关于test.py运行报错如何解决
image

same issue, idid the same.

10/21 12:17:58 - mmengine - INFO - Load checkpoint from work-dirs/train/changeformer/mit_b1_256_75k_b16_clr_sysu/iter_10000.pth
pred_img_data : (1024, 1024, 3)
binary_masks : (1, 256, 256)

I am getting this, did you find any solution to this ?

I have added this lines in visualizer.py in above line 881 inside draw_binary_masks method. visualizer.py is inside of mmengine. Above script you can find in site package where you installed your conda environment.

/path/to/installed/directory/anaconda3/envs/(your env name if not than search in base)/lib/python3.8/site-packages/mmengine/visualization/visualizer.py

    #print("Image shape :",img.shape)
    #print("Binary masks :",binary_masks.shape)
    
     #Check if dimensions match, and if not, resize img to match binary mask dimensions
    if img.shape[:2] != binary_masks.shape[1:]:
            img = cv2.resize(img, (binary_masks.shape[2], binary_masks.shape[1]))

    #print("Image shape :",img.shape)
    #print("Binary masks :",binary_masks.shape)

This does not garauntee though the results saved are true. It seems like results saved of label are not of same size as that of input label. I am not sure about how to solv, if you found out solution, please let me know