Data Science Stack Exchange
2025-11-13 18:49 UTC
By MT0820
AI-111-20251113-social-media-93f97ae5
Possible to Improve Reconstruction Quality and Accuracy with VAE?
I am training a VAE architecture on microscopy images. Dataset of 1000 training images, 253 testing images. Images are resized to 128x128 input or 256x256 input from original resolution which is around 1024x720. The implementation here is a 256x256 input. Then, I put them through my VAE: class SEMVAE(nn.Module): def __init__(self, latent_dim=64): super().__init__() # ----------------- Encoder ----------------- self.enc_conv1 = nn.Conv2d(1, 32, 3, stride=2, padding=1) # 256 -> 128 self.enc_bn1 = nn.BatchNorm2d(32) self.enc_conv2 = nn.Conv2d(32, 64, 3, stride=2, padding=1) # 128 -> 64 self.enc_bn2 = nn.BatchNorm2d(64) self.enc_conv3 = nn.Conv2d(64, 128, 3, stride=2, padding=1) # 64 -> 32 self.enc_bn3 = nn.BatchNorm2d(128) self.enc_conv4 = nn.Conv2d(128, 128, 3, stride=2, padding=1)# 32 -> 16 self.enc_bn4 = nn.BatchNorm2d(128) self.dropout = nn.Dropout(0.05) self.flatten = nn.Flatten() self.fc_mu = nn.Linear(128*16*16, latent_dim) self.fc_logvar= nn.Linear(128*16*16, latent_dim) self.fc_dec = nn.Linear(latent_dim, 128*16*16) # ----------------- Decoder ----------------- self.dec_deconv1 = nn.ConvTranspose2d(128, 128, 3, stride=2, padding=1, output_padding=1) # 16 -> 32 self.dec_bn1 = nn.BatchNorm2d(128) self.dec_deconv2 = nn.ConvTranspose2d(128, 64, 3, stride=2, padding=1, output_padding=1) # 32 -> 64 self.dec_bn2 = nn.BatchNorm2d(64) self.dec_deconv3 = nn.ConvTranspose2d(64, 32, 3, stride=2, padding=1, output_padding=1) # 64 -> 128 self.dec_bn3 = nn.BatchNorm2d(32) self.dec_de…
I am training a VAE architecture on microscopy images. Dataset of 1000 training images, 253 testing images. Images are resized to 128x128 input or 256x256 input from original resolution which is around 1024x720. The implementation here is a 256x256 input. Then, I put them through my VAE: class SEMVAE(nn.Module): def __init__(self, latent_dim=64): super().__init__() # ----------------- Encoder ----------------- self.enc_conv1 = nn.Conv2d(1, 32, 3, stride=2, padding=1) # 256 -> 128 self.enc_bn1 = nn.BatchNorm2d(32) self.enc_conv2 = nn.Conv2d(32, 64, 3, stride=2, padding=1) # 128 -> 64 self.enc_bn2 = nn.BatchNorm2d(64) self.enc_conv3 = nn.Conv2d(64, 128, 3, stride=2, padding=1) # 64 -> 32 self.enc_bn3 = nn.BatchNorm2d(128) self.enc_conv4 = nn.Conv2d(128, 128, 3, stride=2, padding=1)# 32 -> 16 self.enc_bn4 = nn.BatchNorm2d(128) self.dropout = nn.Dropout(0.05) self.flatten = nn.Flatten() self.fc_mu = nn.Linear(128*16*16, latent_dim) self.fc_logvar= nn.Linear(128*16*16, latent_dim) self.fc_dec = nn.Linear(latent_dim, 128*16*16) # ----------------- Decoder ----------------- self.dec_deconv1 = nn.ConvTranspose2d(128, 128, 3, stride=2, padding=1, output_padding=1) # 16 -> 32 self.dec_bn1 = nn.BatchNorm2d(128) self.dec_deconv2 = nn.ConvTranspose2d(128, 64, 3, stride=2, padding=1, output_padding=1) # 32 -> 64 self.dec_bn2 = nn.BatchNorm2d(64) self.dec_deconv3 = nn.ConvTranspose2d(64, 32, 3, stride=2, padding=1, output_padding=1) # 64 -> 128 self.dec_bn3 = nn.BatchNorm2d(32) self.dec_de…
Full article content could not be extracted automatically. Read the original below.
Source:
Data Science Stack Exchange
· datascience.stackexchange.com