claroche-r / FastDiffusionEM

17 stars 1 forks source link

how to test with my custom image? #2

Open sunzhe09 opened 8 months ago

jiachen0212 commented 4 months ago

You can refer to the xx.pickle file under testset. If you look at the demo code, you can find that in fact, high-quality H and kernel data are not needed, so our test pickle only needs to write low-quality images and sigma values. Sigma is 5/255 or 10/255 (the hyperparameter set in the paper~)

test_path = 'xxxx/images/frame_00570.png'
image = cv2.imread(test_path)/255.0
image = cv2.resize(image, (512,448))   # This step is not necessary, but it will oom if the image is too large.
image = image[:,:,::-1]   # bgr2rgb
image = np.array([image])
image = image.transpose(0,3,1,2) 
image = torch.from_numpy(image).float()
pkl = dict()
pkl['L'] = image
pkl['sigma'] = float(5.0/255)   # 5.0 or 10.0 ~ 
pickle.dump(pkl, open('./testset/test.pickle', 'wb'))