Lod34 commited on
Commit
6d8ed74
·
verified ·
1 Parent(s): 70a5d06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -53,12 +53,16 @@ class SpriteGenerator(nn.Module):
53
  nn.BatchNorm2d(16),
54
  nn.ReLU(True),
55
 
56
- # Layer finale modificato per corrispondere esattamente ai pesi
57
- nn.ConvTranspose2d(16, 3, 4, 2, 1, bias=False), # Output layer per RGB
58
- nn.BatchNorm2d(3), # Aggiunto BatchNorm
59
- nn.ReLU(True), # Aggiunto ReLU
 
 
 
 
60
 
61
- nn.Conv2d(3, 3, 3, 1, 1) # Layer di output finale
62
  )
63
 
64
  # Frame interpolator
@@ -98,6 +102,8 @@ class SpriteGenerator(nn.Module):
98
  # Generate frame
99
  frame_latent_reshaped = frame_latent.unsqueeze(2).unsqueeze(3)
100
  frame = self.generator(frame_latent_reshaped)
 
 
101
  all_frames.append(frame)
102
 
103
  # Stack all frames
 
53
  nn.BatchNorm2d(16),
54
  nn.ReLU(True),
55
 
56
+ # Layers finali modificati per corrispondere esattamente ai pesi
57
+ nn.ConvTranspose2d(16, 3, 4, 2, 1, bias=False), # -> 3 x 512 x 512
58
+ nn.BatchNorm2d(3),
59
+ nn.ReLU(True),
60
+
61
+ nn.Conv2d(3, 3, 3, 1, 1, bias=True), # Prima convoluzione di rifinitura
62
+ nn.BatchNorm2d(3),
63
+ nn.ReLU(True),
64
 
65
+ nn.Conv2d(3, 3, 3, 1, 1, bias=True) # Convoluzione finale
66
  )
67
 
68
  # Frame interpolator
 
102
  # Generate frame
103
  frame_latent_reshaped = frame_latent.unsqueeze(2).unsqueeze(3)
104
  frame = self.generator(frame_latent_reshaped)
105
+ # Aggiungiamo Tanh finale per normalizzare l'output
106
+ frame = torch.tanh(frame)
107
  all_frames.append(frame)
108
 
109
  # Stack all frames