0Pricing
Deep Learning Academy · Урок

Генератор и дискриминатор: игра

Две сети соревнуются, совершенствуя друг друга

«Генератор и дискриминатор: игра» — бесплатный урок Deep Learning Academy на CoddyKit. Это урок 1 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения Deep Learning Academy, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс Deep Learning Academy содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

Two Networks, One Game

A GAN is two neural networks playing a game: one invents fake data, the other tries to catch it. Their rivalry is what makes both improve. 🎭

Meet the Generator

The generator starts with random noise and shapes it into something that looks like real data, such as a fake face. It never sees the real images directly.

Meet the Discriminator

The discriminator is a judge. It looks at a sample and outputs one number: how likely it thinks that sample is real rather than fake.

Noise In, Image Out

You feed the generator a vector of random numbers called the latent vector. Different vectors produce different outputs, so noise becomes the seed of creativity.

z = torch.randn(1, 100)
fake = generator(z)

A Forger and a Detective

Think of a forger making fake bills and a detective spotting them. Each one pushes the other to get sharper. That tug-of-war is the heart of a GAN.

Real or Fake Label

The discriminator trains on labels: real images get 1 and generated images get 0. It learns to tell the two apart with confidence.

real_label = 1.0
fake_label = 0.0

The Generator's Goal

The generator wins when the discriminator labels its fakes as real. So its goal is to fool the judge, not to copy any single image exactly.

Adversarial Means Opposed

Their objectives are opposite, which is why we call it adversarial. The discriminator wants to be right; the generator wants it to be wrong.

Improving Together

As the discriminator gets pickier, the generator must make better fakes to keep fooling it. This feedback loop lifts both networks over time.

Two Optimizers

Because the players have separate goals, each network gets its own optimizer and updates on its own turn during training.

opt_g = torch.optim.Adam(G.parameters())
opt_d = torch.optim.Adam(D.parameters())

The Goal: Indistinguishable

Training ideally ends when the discriminator can only guess, near 50 percent. At that point the fakes are practically indistinguishable from real data.

Quick Check

Let's make sure the roles are clear.

Recap: The GAN Game

You met both players: a generator that forges data from noise and a discriminator that judges it. Their rivalry drives both to improve. 🎉

Часто задаваемые вопросы

Урок «Генератор и дискриминатор: игра» бесплатный?

Да — полный текст урока «Генератор и дискриминатор: игра» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Deep Learning Academy, подпишись на CoddyKit PRO. Курс Deep Learning Academy содержит 4 уроков всего.

Чему я научусь в уроке «Генератор и дискриминатор: игра»?

Две сети соревнуются, совершенствуя друг друга Ты практикуешь Deep Learning Academy с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Deep Learning Academy?

Предыдущий опыт не требуется. Deep Learning Academy на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 1 из 4.

Сколько времени занимает урок «Генератор и дискриминатор: игра»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Deep Learning Academy?

Да. Каждый урок Deep Learning Academy включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Генератор и дискриминатор: игра
  2. Состязательная функция потерь
  3. Соберите DCGAN
  4. Коллапс мод и стабилизация
← Назад к Deep Learning Academy