How to improve autoencoder for ORL dataset?

Viewed 17

I wrote an autoencoder for ORL dataset. My dataset only has 1 channel and I decided to also end up with 1 channel after layer 2 and 4 to see how the autoencoder is progressing. I use the standard relo activation function, adam optimizer with lr = 0.01. When training, after only a few epochs, the error stops at 0.0134 or 0.0135. I tried adding a few more layers, but unfortunately nothing helped.

class ConvAutoencoder(nn.Module):
    def __init__(self):
        super(ConvAutoencoder, self).__init__()
        ## encoder layers ##
       
        self.conv1 = nn.Conv2d(1, 3, 3, padding=(1,0))  
        self.conv2 = nn.Conv2d(3,1, 3, padding = (1,0))  
        self.conv3 = nn.Conv2d(1, 3, 3, padding =(1,0))
        self.conv4 = nn.Conv2d(3, 1, 3, padding =(1,0))
        
        ## decoder layers ##
        self.t_conv1 = nn.ConvTranspose2d(1, 3, 3, padding=(1,0) )
        self.t_conv2 = nn.ConvTranspose2d(3, 1, 3, padding=(1,0))
        self.t_conv3 = nn.ConvTranspose2d(1, 3, 3, padding=(1,0))
        self.t_conv4 = nn.ConvTranspose2d(3, 1, 3, padding=(1,0))
    def forward(self, x):
        
        x = F.relu(self.conv1(x))
       
        x = F.relu(self.conv2(x))
       
        x = F.relu(self.conv3(x))
       
        x = F.relu(self.conv4(x))
        ## decode ##
       
        x = F.relu(self.t_conv1(x))
      
        x = F.relu(self.t_conv2(x))
        x = F.relu(self.t_conv3(x))
       
        x = torch.sigmoid(self.t_conv4(x))
       
        return x
0 Answers
Related