Skip to Content
Deep Learning 向けの PyTorch プログラミング
book

Deep Learning 向けの PyTorch プログラミング

by Ian Pointer
May 2025
Intermediate to advanced
220 pages
3h 27m
Japanese
O'Reilly Media, Inc.
Content preview from Deep Learning 向けの PyTorch プログラミング

第3章 畳み込みニューラルネットワーク 畳み込みニューラルネットワーク

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

第2章で完全接続ニューラルネットワークを実験した後、あなたはおそらくいくつかのことに気づいただろう。レイヤーを増やしたり、パラメータ数を大幅に増やそうとすると、ほぼ間違いなくGPUのメモリが足りなくなる。加えて、ある程度まともな精度で学習できるようになるまでには時間がかかり、特にディープラーニングを取り巻く誇大広告を考慮すると、それすらもあまり褒められたものではなかった。何が起こっているのか?

完全接続ネットワークや(フィード・フォワード)ネットワークが普遍的な近似器として機能するのは事実だが、その理論では、本当に求めている関数の近似器となるように訓練するのに、どれくらいの時間がかかるかはわからない。しかし、特に画像については、もっとうまくやることができる。この章では、畳み込みニューラルネットワーク(CNN)について学び、CNNが現在最も精度の高い画像分類器のバックボーンをどのように形成しているかを学ぶ(途中、いくつかのCNNを詳しく見ていく)。魚対猫のアプリケーションのために新しい畳み込みベースのアーキテクチャを構築し、それが前の章でやっていたものより訓練が早く正確であることを示す。始めよう!

最初の畳み込みモデル

今回は、まず最終的なモデルアーキテクチャを共有し、それからすべての新しい部分について説明するつもりだ。また、第2章で述べたように、作成したトレーニング方法はモデルとは独立しているので、まずはこのモデルをテストして、それから説明を聞きに来ても構わない!

class CNNNet(nn.Module):

    def __init__(self, num_classes=2):
        super(CNNNet, self).__init__()
        self.features = nn.Sequential(
            nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(64, 192, kernel_size=5, padding=2),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(192, 384, kernel_size=3, padding=1),
            nn.ReLU(),
            nn.Conv2d(384, 256, kernel_size=3, padding=1),
            nn.ReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2),
        )
        self.avgpool = nn.AdaptiveAvgPool2d((6, 6))
        self.classifier = nn.Sequential(
            nn.Dropout(),
            nn.Linear(256 * 6 * 6, 4096),
            nn.ReLU(),
            nn.Dropout(),
            nn.Linear(4096, 4096),
            nn.ReLU(),
            nn.Linear(4096, num_classes)
        )

    def ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

生成 Deep Learning 第2版 ―絵を描き、物語や音楽を作り、ゲームをプレイする

生成 Deep Learning 第2版 ―絵を描き、物語や音楽を作り、ゲームをプレイする

David Foster, 松田 晃一, 小沼 千絵
直感 Deep Learning ―Python×Kerasでアイデアを形にするレシピ

直感 Deep Learning ―Python×Kerasでアイデアを形にするレシピ

Antonio Gulli, Sujit Pal, 大串 正矢, 久保 隆宏, 中山 光樹

Publisher Resources

ISBN: 9798341650367