diff --git "a/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/CUdata_npy_denoise25.py" "b/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/CUdata_npy_denoise25.py" new file mode 100644 index 0000000..dd980a3 --- /dev/null +++ "b/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/CUdata_npy_denoise25.py" @@ -0,0 +1,43 @@ +import torch.utils.data as data +from glob import glob +import matplotlib.pyplot as plt +from torchvision import transforms +import cv2 +from PIL import Image +import random +import os +import numpy as np +import torch + +class cudataset(data.Dataset): + def __init__(self): + super(cudataset, self).__init__() + self.depth = np.load('trainset_denoise/data_x_25.npy')#(batch,height,width,c) + #print(self.depth.shape) + self.depth = np.transpose(self.depth, (0, 3, 1, 2)) + self.depth_t = torch.from_numpy(self.depth) + + self.gt = np.load('trainset_denoise/label_25.npy') # (batch,height,width,c) + self.gt = np.transpose(self.gt, (0, 3, 1, 2)) + self.gt_t = torch.from_numpy(self.gt) + + self.rgb = np.load('trainset_denoise/data_y_25.npy') # (batch,height,width,c) + self.rgb = np.transpose(self.rgb, (0, 3, 1, 2)) + self.rgb_t = torch.from_numpy(self.rgb) + + def __getitem__(self, item): + img_depth = self.depth_t[item] + img_gt = self.gt_t[item] + img_rgb = self.rgb_t[item] + + return (img_depth, img_gt,img_rgb) + + def __len__(self): + return len(self.depth) + +if __name__ =='__main__': + dataset=cudataset() + dataloader=data.DataLoader(dataset,batch_size=1) + for b1,(img_L,img_H,img_RGB) in enumerate(dataloader): + print(b1) + print(img_L.shape,img_H.shape,img_RGB.shape) \ No newline at end of file diff --git "a/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/testCUnoise.py" "b/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/testCUnoise.py" new file mode 100644 index 0000000..dd56fb7 --- /dev/null +++ "b/MIR_Task_pytorch/\357\254\202ash guided non-\357\254\202ash image denoising/Code/testCUnoise.py" @@ -0,0 +1,49 @@ +import torch.utils.data as data +from glob import glob +import matplotlib.pyplot as plt +from torchvision import transforms +import cv2 +from PIL import Image +import random +import os +import numpy as np +import torch + + +class cudatatest(data.Dataset): + def __init__(self): + super(cudatatest, self).__init__() + # self.depth = np.load('testset/data_d1.npy',allow_pickle=True)#(batch,height,width,c) + self.depth = np.load('noise_testset/data_n.npy', allow_pickle=True) # (batch,height,width,c) + self.depth = np.transpose(self.depth, (0, 3, 1, 2)) + self.depth_t = torch.from_numpy(self.depth) + + # self.gt = np.load('testset/data_g1.npy',allow_pickle=True) # (batch,height,width,c) + self.gt = np.load('noise_testset/gt.npy', allow_pickle=True) # (batch,height,width,c) + self.gt = np.transpose(self.gt, (0, 3, 1, 2)) + self.gt_t = torch.from_numpy(self.gt) + + # self.rgb = np.load('testset/data_c1.npy',allow_pickle=True) # (batch,height,width,c) + self.rgb = np.load('noise_testset/data_f.npy', allow_pickle=True) # (batch,height,width,c) + self.rgb = np.transpose(self.rgb, (0, 3, 1, 2)) + self.rgb_t = torch.from_numpy(self.rgb) + + def __getitem__(self, item): + img_depth = self.depth_t[item] + img_gt = self.gt_t[item] + img_rgb = self.rgb_t[item] + + return (img_depth, img_gt, img_rgb) + + def __len__(self): + return len(self.depth) + + + + +if __name__ == '__main__': + dataset = cudatatest() + dataloader = data.DataLoader(dataset, batch_size=1) + for b1, (img_L, img_H, img_RGB) in enumerate(dataloader): + print(b1) + print(img_L.shape, img_H.shape, img_RGB.shape) \ No newline at end of file