blanclist/ICNet

How to resize CoSOD3k and CoCA to 224 * 224 for testing?

Opened this issue · 1 comments

How to resize CoSOD3k and CoCA to 224 * 224 for testing? Can you please share you code for resizing the images or provide a link to your google drive so that I may download it?

We resize images just by simple bilinear interpolation. More specifically, we use the function "cv2.resize()" from "opencv-python (import cv2)" to achieve this goal. The code is shown below:

import cv2
from os import listdir
from os.path import join

if __name__ == '__main__':
    for dataset in ('CoSOD3k', 'CoCA'):
        for img_type in ('img_bilinear_224', 'gt_bilinear_224'):
            base = '/mnt/jwd/data/{}/{}/'.format(dataset, img_type)
            dir_names = listdir(base)
            for dir_name in dir_names:
                dir_path = join(base, dir_name)
                names = listdir(dir_path)
                for name in names:
                    img_path = join(dir_path, name)
                    img = cv2.imread(img_path)
                    img = cv2.resize(img, (224, 224))
                    cv2.imwrite(img_path, img)