![]() ![]() # add transpose conv layers, with relu activation function ![]() # add hidden layers with relu activation function Self.t_conv1 = nn.ConvTranspose2d(2, 1, 64, stride=1, padding=1) Self.t_conv2 = nn.ConvTranspose2d(4, 2, 64, stride=1, padding=1) Self.t_conv3 = nn.ConvTranspose2d(4, 4, 64, stride=1, padding=1) Self.t_conv4 = nn.ConvTranspose2d(3, 4, 64, stride=1, padding=1) Self.t_conv5 = nn.ConvTranspose2d(2, 3, 64, stride=1, padding=1) Self.t_conv6 = nn.ConvTranspose2d(2, 2, 64, stride=1, padding=1) # a kernel of 2 and a stride of 2 will increase the spatial dims by 2 # pooling layer to reduce x-y dims by two kernel and stride of 2 # conv layer (depth from 16 -> 4), 3x3 kernels # conv layer (depth from 1 -> 16), 3x3 kernels Test_loader = (MyDataset("./test.csv"), batch_size=batch_size, num_workers=num_workers)įor reading the shape, it seems like the grayscale image returns as a (width,height), then, I reshape the 2d image to a 4d input that I can feed into the neural network (1,1,width,height).Here is my convnet class ConvAutoencoder(nn.Module): Train_loader = (MyDataset("./train.csv"), batch_size=batch_size, num_workers=num_workers) Y = om_numpy(np.array(image_transformed)) #x, y = TF.to_tensor(image), TF.to_tensor(image_transformed) # Make sure to perform the same transformations on image and target #image, image_transformed = load_image(self.image_paths) Image_transformed = Image.open(current.iloc) #image_transformed = load_image(self.image_paths) Self.image_paths = pd.read_csv(csv_file, header = 0) transform = transforms.Compose(ĭef _init_(self, csv_file,transform=None): My grayscale images are original 0 to 255, but I have read that Transform.toTensor(), automatically scales between 0 and 1, so I don’t need to change the input. At first, I thought my conv net was not working, so I tried to have the autoencoder recreate the original input, but no matter what, the autoencoder on returns an gray image.I’m currently using my custom dataset, which I wrote with help, but when testing if my conv net has issues, I pass the x(input) as both x(input) and y(output).Here is my dataloading. For my project, I am attempting to write an autoencoder, where the input and output grayscale images are slightly different. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |