class Autoencoder(nn.Module):
def init(self):
super(Autoencoder, self).init()
self.encoder = nn.Sequential( # like the Composition layer you built
nn.Conv2d(1, 12, 5, stride=1),
nn.ReLU(),
nn.Dropout2d(p=0.05),
nn.Conv2d(12, 24, 5, stride=1),
nn.ReLU(),
nn.Conv2d(24, 48, 3),
nn.ReLU(),
nn.Dropout2d(p=0.05),
)
self.decoder = nn.Sequential(
nn.ConvTranspose2d(48, 24, 5),
nn.ReLU(),
nn.ConvTranspose2d(24, 12, 5, stride=1),
nn.ReLU(),
nn.ConvTranspose2d(12, 1, 3, stride=1),
nn.ReLU()
)
def forward(self, value):
    value = self.encoder(value)
    value = self.decoder(value)
    return value

For epoch in range(Epochs):
for data in trainloader:
images, label= data
o_image = train_model(images)
loss = criterion(o_image, images)
loss.backward()
optimizer.step()
optimizer.zero_grad()
_,prediction = torch.max(o_image, 1)
train_acc += torch.sum(prediction == images)
print(‘Epoch:{}, Loss:{:.4f}’.format(epoch+1, float(loss)), accuracy_score)
~````Training Accuracy is increasing , which means there can be overfitting of data . But i used dropout function as well. Please suggest if i am missing something.
`Epoch 0, Train Accuracy: 93386456.0 , TrainLoss: 0.2611906826496124
Epoch 1, Train Accuracy: 186969568.0 , TrainLoss: 0.2584492564201355
Epoch 2, Train Accuracy: 280305408.0 , TrainLoss: 0.0300734955817461
Epoch 3, Train Accuracy: 373835808.0 , TrainLoss: 0.01294061541557312
Epoch 4, Train Accuracy: 466917440.0 , TrainLoss: 0.011260838247835636
Epoch 5, Train Accuracy: 560389248.0 , TrainLoss: 0.011532839387655258