Deep Learning Academy · レッスン

敵対的損失

実際のmin-max学習を学びます

レッスン 2/413 ステップ

「敵対的損失」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Loss Drives Both Players

Every GAN player learns from a loss that scores how well it did. The two losses pull in opposite directions, which is what makes training adversarial.

The Min-Max Game

GAN training is a min-max game: the discriminator tries to maximize its score while the generator tries to minimize it. Neither fully wins.

Binary Cross-Entropy

Most GANs measure each prediction with binary cross-entropy, the standard loss for a real-versus-fake yes or no decision.

criterion = nn.BCELoss()

Discriminator on Real Data

First the discriminator sees real images and should call them real. Its real loss pushes those outputs toward the label 1.

out_real = D(real)
loss_real = criterion(out_real, ones)

Discriminator on Fakes

Next it judges generated images and should call them fake. The fake loss pushes those outputs toward the label 0.

out_fake = D(fake.detach())
loss_fake = criterion(out_fake, zeros)

Why detach the Fakes

When updating the discriminator you call detach on the fakes so gradients do not flow back into the generator on this step.

fake.detach()

The Generator's Loss

The generator wants its fakes labeled real, so its loss compares the discriminator's verdict on fakes against the label 1.

out = D(fake)
loss_g = criterion(out, ones)

The Non-Saturating Trick

Telling the generator to maximize real-ness, instead of just minimizing fake-ness, gives stronger early gradients. This is the non-saturating loss.

Two Updates, One Round

Each training round does two updates: first the discriminator on its combined loss, then the generator on its own. Order and timing matter.

A Moving Target

Because both networks change every step, each one chases a moving target. This is why GAN losses bounce around instead of falling smoothly.

Losses Are Not Accuracy

In a GAN a falling loss does not mean better images. You judge quality by looking at samples, not by the loss number alone. 👀

Quick Check

One detail trips up many beginners.

Recap: Adversarial Loss

You saw the min-max game: cross-entropy guides both players, fakes are detached for the judge, and samples, not loss, reveal real progress. 🎯

無料で開始

AI チューターと学ぶ Python — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
30
レッスン
120

よくある質問

「敵対的損失」レッスンは無料ですか?

はい。「敵対的損失」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。

「敵対的損失」で何を学びますか?

実際のmin-max学習を学びます ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Deep Learning Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「敵対的損失」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDeep Learning Academyレッスンでコードを書いて実行できますか?

はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. GeneratorとDiscriminator:競争の仕組み
  2. 敵対的損失
  3. DCGANを構築する
  4. モード崩壊と安定化の工夫
← Deep Learning Academyに戻る