Construya una DCGAN
GAN convolucional para generar imágenes
Construya una DCGAN es una lección gratuita de Deep Learning Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Deep Learning Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Deep Learning Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
What DCGAN Adds
A DCGAN is a GAN built from convolutional layers. It swaps dense layers for convolutions, which makes it great at generating realistic images. 🖼️
Generator Grows the Image
The generator uses transposed convolutions to upsample a tiny latent vector step by step into a full-size image.
nn.ConvTranspose2d(100, 256, 4, 1, 0)Discriminator Shrinks the Image
The discriminator does the reverse: strided convolutions shrink the image down to a single real-or-fake score.
nn.Conv2d(3, 64, 4, 2, 1)Batch Norm Stabilizes
DCGAN puts batch normalization between layers in both networks. It keeps activations healthy and makes training far more stable.
nn.BatchNorm2d(256)ReLU in the Generator
The generator uses ReLU activations on its hidden layers to keep gradients flowing as the image is built up.
nn.ReLU(True)LeakyReLU in the Discriminator
The discriminator prefers LeakyReLU, which lets a small signal through for negative values and avoids dead neurons.
nn.LeakyReLU(0.2, inplace=True)Tanh on the Output
The generator ends with Tanh, squeezing pixels into the range minus one to one to match normalized training images.
nn.Tanh()Sigmoid for the Verdict
The discriminator finishes with a sigmoid, turning its final feature into a probability between zero and one.
nn.Sigmoid()Weight Initialization
DCGAN starts weights from a small normal distribution centered near zero. Good init helps both networks train smoothly from the first step.
nn.init.normal_(m.weight, 0.0, 0.02)Pick the Latent Size
The latent dimension, often 100, sets how many random numbers seed each image. Larger latents give the generator more room to vary.
nz = 100Watch Samples as You Train
Save a grid of generated images every few epochs. Watching them get sharper is how you confirm a DCGAN is actually learning.
Quick Check
Which activation belongs at the very end of the generator?
Recap: Building a DCGAN
You assembled a DCGAN: transposed convolutions grow images, strided convolutions judge them, and batch norm keeps it all stable. 🛠️
Preguntas frecuentes
¿La lección «Construya una DCGAN» es gratis?
Sí — el texto completo de «Construya una DCGAN» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Deep Learning Academy, actualiza a CoddyKit PRO. El curso de Deep Learning Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Construya una DCGAN»?
GAN convolucional para generar imágenes Practicas Deep Learning Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Deep Learning Academy?
No se requiere experiencia previa. Deep Learning Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.
¿Cuánto tiempo toma la lección «Construya una DCGAN»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Deep Learning Academy?
Sí. Cada lección de Deep Learning Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Generador frente a discriminador: el juego
- La pérdida adversaria
- Construya una DCGAN
- Colapso de modos y trucos de estabilización