<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ウォーリー | DL FreeTime</title>
	<atom:link href="https://www.ct-innovation.blog/dl-freetime/tag/wally/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ct-innovation.blog/dl-freetime</link>
	<description>Start studying deep learning in my Free time</description>
	<lastBuildDate>Wed, 13 Mar 2024 08:49:28 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/02/cropped-cooltext289278806579247-32x32.png</url>
	<title>ウォーリー | DL FreeTime</title>
	<link>https://www.ct-innovation.blog/dl-freetime</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその３</title>
		<link>https://www.ct-innovation.blog/dl-freetime/programming/python/2434/</link>
					<comments>https://www.ct-innovation.blog/dl-freetime/programming/python/2434/#respond</comments>
		
		<dc:creator><![CDATA[Yuki]]></dc:creator>
		<pubDate>Sat, 02 Mar 2024 06:16:52 +0000</pubDate>
				<category><![CDATA[AI/MachineLearning]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Chainer]]></category>
		<category><![CDATA[CNN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ウォーリー]]></category>
		<guid isPermaLink="false">https://www.ct-innovation.blog/dl-freetime/?p=2434</guid>

					<description><![CDATA[機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトと [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトとして「ウォーリーを探せ」の絵本に挑戦する構想を紹介します。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-prev">

<a target="_blank" href="https://www.ct-innovation.blog/dl-freetime/programming/python/2417/" title="畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその２" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img fetchpriority="high" decoding="async" width="320" height="180" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-320x180.png" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-320x180.png 320w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-240x135.png 240w" sizes="(max-width: 320px) 100vw, 320px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその２</div><div class="blogcard-snippet internal-blogcard-snippet">この記事では、Pythonの機械学習ライブラリChainerを使って、人気絵本「ウォーリーを探せ」の主人公ウォーリーを自動認識するプロジェクトに挑戦します。画像認識の基礎から教師データの収集、モデル構築、学習プロセスまでを詳しく解説しています。</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://www.ct-innovation.blog/dl-freetime" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">www.ct-innovation.blog</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2024.02.09</div></div></div></div></a>
</div>



<span id="more-2434"></span>



<h2 class="wp-block-heading">検証用データの収集</h2>



<p>まずは、正解データとして前回も利用した購入した本からウォーリーを再び探してデータを集めていきます。</p>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-3 sbs-line sbp-l sbis-cb cf block-box not-nested-style cocoon-block-balloon"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/02/cropped-図1-e1709253991344.png" alt="" class="speech-icon-image"/></figure><div class="speech-name"></div></div><div class="speech-balloon">
<p>あまりこの能力の向上はうれしくないですが…順調に私の探索能力が上がっていっており、早いとページを開いて数秒で見つけられるようになってきています。</p>
</div></div>



<p>次に、不正解データを用意します。ここで正解と判断されたくないけど紛らわしいキャラクターを使ってみたいと思います。ウォーリーにはガールフレンドがいるんですが、これがそれなりに似ています。名前は「ウェンダ」というらしいです。見た目はこんな感じです。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img decoding="async" width="141" height="141" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171101171940.png" alt="" class="wp-image-2436"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"></div>
</div>



<h2 class="wp-block-heading">プログラム実装</h2>



<pre class="wp-block-code python"><code>def return_result(data_input):
    model = cnn.MyCNN(2)
    serializers.load_npz("mymodel.npz", model)
    x = Variable(np.array(&#91;data_input], dtype=np.float32))
    y = model.forward(x)
    return y

def main():
    train_pathes = {'folder_path': '0'}
    for fil in train_pathes.keys():
        append_data(fil, train_pathes&#91;fil], 'train')
        N = len(x_train_data)
        x_train_data_np = np.array(x_train_data, dtype=np.float32)
        x_train_data_reshape = x_train_data_np.reshape(N, 1, 60, 60)
        x_train_data_reshape /= 255 # to 0-1
 
        for i in range(len(x_train_data_reshape)):
            data_input = x_train_data_reshape&#91;i]
            r_data = return_result(data_input)
            data = np.argmax(r_data.data)
            if data == 1:
                print(str(t_train_data&#91;i]) + 'はウォーリー')
            else:
                print(str(t_train_data&#91;i]) + 'は違う')</code></pre>



<h2 class="wp-block-heading">検証結果</h2>



<p>以下のファイル群をプログラムにかけて結果を確認してみます。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="481" height="246" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171101172306.png" alt="" class="wp-image-2522" style="width:450px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171101172306.png 481w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171101172306-300x153.png 300w" sizes="(max-width: 481px) 100vw, 481px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="158" height="146" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171101172315.png" alt="" class="wp-image-2523" style="width:160px"/></figure>
</div>
</div>



<p>ちゃんと判断してくれた！ひとまず成功ですね。よかった。とりあえずは第一関門は突破しました。次回は走査的に全体を探索していくプログラムを組んで実際にウォーリーを探していきます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ct-innovation.blog/dl-freetime/programming/python/2434/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその２</title>
		<link>https://www.ct-innovation.blog/dl-freetime/programming/python/2417/</link>
					<comments>https://www.ct-innovation.blog/dl-freetime/programming/python/2417/#respond</comments>
		
		<dc:creator><![CDATA[Yuki]]></dc:creator>
		<pubDate>Fri, 09 Feb 2024 01:39:31 +0000</pubDate>
				<category><![CDATA[AI/MachineLearning]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Chainer]]></category>
		<category><![CDATA[CNN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ウォーリー]]></category>
		<guid isPermaLink="false">https://www.ct-innovation.blog/dl-freetime/?p=2417</guid>

					<description><![CDATA[機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトと [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトとして「ウォーリーを探せ」の絵本に挑戦する構想を紹介します。</p>



<span id="more-2417"></span>



<h2 class="wp-block-heading">はじめに</h2>



<p>前回の記事では、「ウォーリーを探せ」の主人公ウォーリーを自動認識するプロジェクトに挑戦することを決めました。今回は教師用データを集め、Chainerを用いたCNNの構築に挑戦します。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-prev">

<a target="_blank" href="https://www.ct-innovation.blog/dl-freetime/programming/python/279/" title="畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその１" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img decoding="async" width="320" height="180" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-320x180.jpg" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-320x180.jpg 320w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-240x135.jpg 240w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-640x360.jpg 640w" sizes="(max-width: 320px) 100vw, 320px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその１</div><div class="blogcard-snippet internal-blogcard-snippet">このブログ記事では、畳み込みニューラルネットワーク（CNN）について解説しています。初めに、CNNの基本的な概念について説明し、その後に実際の題材として、CNNを用いて「ウォーリーを探せ」の絵本のキャラクターを検出するプロジェクトに取り組む構想を紹介しています。また、題材選定の経緯や教師データの収集についても触れています。この記事を通じて、機械学習におけるCNNの応用や実践的な活用方法について興味を持つ読者に向けた情報提供を行っています。</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://www.ct-innovation.blog/dl-freetime" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">www.ct-innovation.blog</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2021.03.09</div></div></div></div></a>
</div>



<h2 class="wp-block-heading">教師データの収集</h2>



<p> 画像認識AIを学習させるには、教師データが必要不可欠です。ウォーリーの絵本から手作業で画像を切り抜き、約40枚のウォーリー画像と100枚の非ウォーリー画像を用意しました。</p>



<h3 class="wp-block-heading">問題その1：画質</h3>



<p>購入した本がポケット版であったことから原本の1/4程度に縮小されているため、画質が粗いという課題が発生しました。後の学習プロセスで工夫することにしました。</p>



<h3 class="wp-block-heading">問題その2：ウォーリー作画問題</h3>



<p>画像を切り抜きながら感じた大きな問題です。</p>



<p>よく漫画とかで初期のころと最後の方で絵のタッチとかが変わることってあると思うのですが、それと似たような現象がウォーリーを探せにも起こっています。機械学習をさせる側にしては大きな問題です。参考に抜き出したデータをいくつか貼ります。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="133" height="176" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171027150642.png" alt="" class="wp-image-2428" style="width:auto;height:170px"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="140" height="149" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171027150657.png" alt="" class="wp-image-2429" style="width:auto;height:170px"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="157" height="144" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171027153714.png" alt="" class="wp-image-2430" style="width:auto;height:170px"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="50" height="51" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171026090425.png" alt="" class="wp-image-2431" style="width:auto;height:170px"/></figure>
</div>
</div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-3 sbs-line sbp-l sbis-cb cf block-box not-nested-style cocoon-block-balloon"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/02/cropped-図1-e1709253991344.png" alt="" class="speech-icon-image"/></figure><div class="speech-name"></div></div><div class="speech-balloon">
<p>こう見るとこれらが全部ウォーリーだと判断して見つけられる人間の補完力に驚かせられます。</p>
</div></div>



<h2 class="wp-block-heading">ライブラリの選定とインストール</h2>



<p>Chainerを用いて学習を実行しました。40エポックの学習で早い段階で収束が確認されましたが、実際の判別性能は次回のテストで確認する予定です。ただし、Chainerは開発をやめてしまったので今は利用は推奨されません。今なら、PyTorchなどを利用しましょう。</p>



<h2 class="wp-block-heading">CNN モデルの構築</h2>



<p> 畳み込みニューラルネットワーク(CNN)を使ってモデルを構築しました。6層のディープラーニングモデルを設計し、入力画像からウォーリーか否かを2値分類できるようにしています。</p>



<pre class="wp-block-code python"><code># coding=utf-8 
from chainer import Chain 
import chainer.links as L 
import chainer.functions as F 

class MyCNN(Chain):
    def __init__(self, n_out):
        super(MyCNN, self).__init__(
            conv1=L.Convolution2D(in_channels=1, out_channels=10, 　　　　　　　　　　　　　　
                                  ksize=5, stride=1, pad=2), 
            conv2=L.Convolution2D(in_channels=None, out_channels=20, 　
　　　　　　　　　　　　　　　　　ksize=5, stride=1, pad=2),
            l1=L.Linear(None, 500),
            l2=L.Linear(500, 500),
            l3=L.Linear(500, n_out)
        )
    def forward(self, x):
        h1 = self.conv1(x)
        h2 = self.conv2(h1)
        h3 = F.relu(self.l1(h2))
        h4 = F.relu(self.l2(h3))
        out = self.l3(h4)
        return out</code></pre>



<h2 class="wp-block-heading">学習とモデルの保存 </h2>



<p>収集した教師データを使い、ミニバッチ学習による反復学習を実施しました。損失関数にはソフトマックス関数を使用し、40エポックで収束しました。学習済みモデルをファイルに保存しました。</p>



<pre class="wp-block-code python"><code>model = cnn.MyCNN(2) 
optimizer = optimizers.Adam() 
optimizer.setup(model) 
n_epoch = 40 
batch_size = 30 

for epoch in range(n_epoch):
    sum_loss = 0
    sum_accuracy = 0
    perm = np.random.permutation(N)
    for i in range(0, N, batch_size):
        x = Variable(data&#91;perm&#91;i:i+batch_size]]) 
        t = Variable(label_data&#91;perm&#91;i:i+batch_size]])
        y = model.forward(x) model.zerograds() 
        loss = F.softmax_cross_entropy(y, t) 
        acc = F.accuracy(y, t) 
        loss.backward() 
        optimizer.update()

serializers.save_npz("wally.npz", model)</code></pre>



<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="627" height="467" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171031171744.png" alt="" class="wp-image-2432" style="width:600px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171031171744.png 627w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/20171031171744-300x223.png 300w" sizes="(max-width: 627px) 100vw, 627px" /></figure>



<h2 class="wp-block-heading">次のステップ</h2>



<p>次は収束したモデルを使って、実際にウォーリーの認識が可能かテストを行う予定です。プロジェクト全体を通して、機械学習の基礎からモデル構築、学習プロセスまで実践的に学ぶことができました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ct-innovation.blog/dl-freetime/programming/python/2417/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>畳み込みニューラルネットワーク（CNN）の魅力とウォーリーを探せプロジェクトその１</title>
		<link>https://www.ct-innovation.blog/dl-freetime/programming/python/279/</link>
					<comments>https://www.ct-innovation.blog/dl-freetime/programming/python/279/#respond</comments>
		
		<dc:creator><![CDATA[Yuki]]></dc:creator>
		<pubDate>Tue, 09 Mar 2021 01:06:00 +0000</pubDate>
				<category><![CDATA[AI/MachineLearning]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Chainer]]></category>
		<category><![CDATA[CNN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ウォーリー]]></category>
		<guid isPermaLink="false">http://ct-innovation01.xyz/DL-Freetime/?p=279</guid>

					<description><![CDATA[機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトと [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>機械学習の世界に足を踏み入れると、その広がりと可能性に驚かされます。特に、畳み込みニューラルネットワーク（CNN）は、画像分析の分野で優れた成果を上げています。今回は、CNNの基本的な概念から始め、実践的なプロジェクトとして「ウォーリーを探せ」の絵本に挑戦する構想を紹介します。</p>



<span id="more-279"></span>



<h2 class="wp-block-heading">畳み込みニューラルネットワークの基礎</h2>



<p>畳み込みニューラルネットワーク（Convolution Neural Network)は、画像分析を行うための機械学習手法の一つです。画像内のパターンを学習し、物体や顔などを認識することが可能です。また、最近では自然言語処理にも応用されています。</p>



<p>CNNは主に「<span class="marker-under-blue">畳み込み</span>」と「<span class="marker-under-red">ニューラルネットワーク</span>」の処理から成り立っています。畳み込みは画像の特徴を抽出し、ニューラルネットワークはその特徴を分析します。</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<figure class="wp-block-image aligncenter size-large"><img decoding="async" width="1024" height="353" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1-1024x353.png" alt="" class="wp-image-2423" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1-1024x353.png 1024w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1-300x104.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1-768x265.png 768w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1-1536x530.png 1536w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-1.png 1663w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
<cite>https://world4jason.gitbooks.io/research-log/content/deepLearning/CNN/Model%20&amp;%20ImgNet/lenet.html</cite></blockquote>



<h3 class="wp-block-heading"><strong>畳み込みとプーリング</strong></h3>



<p>畳み込み処理は、画像から特徴を抽出する重要な工程です。この処理をさらに分割すると、「畳み込み」と「プーリング」という手法があります。畳み込みでは、画像全体を適当なサイズのフィルタで走査し、特徴を抽出します。プーリングは、画像サイズを縮小しつつ特徴を保持する処理です。</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="780" height="269" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet.png" alt="" class="wp-image-2422" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet.png 780w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-300x103.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-768x265.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></figure>



<p><br>もう一度この図に戻ると、C1とC3と書いているところが<span class="marker-under-red"><span class="marker-under-blue">畳み込み</span></span>でS2とS4と書いているところが<span class="marker-under-red">プーリング</span>です。</p>



<h4 class="wp-block-heading">畳み込み</h4>



<p><span class="marker-under-red"><span class="marker-under-blue">畳み込み</span></span>は、元の画像から適当なサイズのフィルタを用いて<strong>特徴点を抽出する処理</strong>です。以下のようなことを行っています。</p>



<div class="wp-block-cocoon-blocks-tab-box-1 blank-box bb-tab bb-point block-box">
<ul class="wp-block-list">
<li>元の画像の左上端にフィルタをかけて特徴を抽出する</li>



<li>画像全体を走査的にフィルタがスライドしながら繰り返す</li>



<li>走査後に特徴のみを抽出した新たな画像を作り上げる</li>



<li>フィルタの数だけ新たな画像が出力される</li>
</ul>
</div>



<figure class="wp-block-image aligncenter size-large is-resized"><img decoding="async" width="1024" height="319" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv1-1024x319.png" alt="" class="wp-image-2418" style="width:800px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv1-1024x319.png 1024w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv1-300x93.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv1-768x239.png 768w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv1.png 1072w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="780" height="274" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv4.png" alt="" class="wp-image-2419" style="width:800px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv4.png 780w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv4-300x105.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Conv4-768x270.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></figure>



<p>画像で示していてわかりやすいサイトがあったのでこちらからお借りしました。しっかりビジュアライズされているので、中身まで理解したい方はぜひこちら見てください。</p>



<h4 class="wp-block-heading">プーリング</h4>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="780" height="269" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet.png" alt="" class="wp-image-2422" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet.png 780w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-300x103.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/lenet-768x265.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></figure>



<p><br>前章の<span class="marker-under-red"><span class="marker-under-blue">畳み込み</span></span>で、フィルタの数によって画像の枚数が増えます。最終的には『ニューラルネットワーク』を行い、分析をするのですがその際に入力するデータの数がどんどん増えてしまいます。これを防ぐために<span class="marker-under-red">プーリング</span>では特徴を残しつつ画像サイズを小さくする処理を行っています。</p>



<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="1012" height="336" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_1.png" alt="" class="wp-image-2421" style="width:800px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_1.png 1012w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_1-300x100.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_1-768x255.png 768w" sizes="(max-width: 1012px) 100vw, 1012px" /></figure>



<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="1014" height="332" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_2.png" alt="" class="wp-image-2420" style="width:800px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_2.png 1014w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_2-300x98.png 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2024/03/CNN_Pooling_2-768x251.png 768w" sizes="(max-width: 1014px) 100vw, 1014px" /></figure>



<p>先ほどと同じサイトから参照させていただきました。</p>



<h2 class="wp-block-heading">題材を探せ</h2>



<p>CNNの優れた特性を活かし、楽しい題材を選びました。「ウォーリーを探せ」の絵本は、赤白のボーダーの服に帽子と眼鏡をつけたキャラクターを探す遊び絵本です。この楽しいテーマにCNNを適用し、「ウォーリー vs. AI」という無謀な挑戦を始めることにしました。</p>



<h3 class="wp-block-heading"><strong>ウォーリーを探せ</strong></h3>



<p>1987年に発表されたこの絵本は、幅広い世代に親しまれています。ウォーリーを探す喜びは、誰もが体験したことがあるでしょう。</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img decoding="async" width="1024" height="768" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-1024x768.jpg" alt="" class="wp-image-2060" style="width:800px" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-1024x768.jpg 1024w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-300x225.jpg 300w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067-768x576.jpg 768w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2019/03/DSCF3067.jpg 780w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>そもそもこの本を知ってる人はどれぐらいいるのかなと思ってたら、少し前は（2017/10/24）しぶちかの広告にウォーリーいたし、テレビCMで物件探しのCMにも出ていたのである程度の知名度はあるようですね。</p>



<h2 class="wp-block-heading"><strong>アプローチ方法</strong></h2>



<p>ウォーリーを探すためのアプローチとして、以下の二つの方法を検討しました。</p>



<ol class="wp-block-list">
<li><strong>CNNを用いた学習モデルの構築と画像の走査による検出</strong></li>



<li><strong>OpenCVを活用した物体検出によるウォーリーの捜索</strong></li>
</ol>



<p>今回は、CNNの勉強のために一つ目のアプローチを採用することにしました。</p>



<h3 class="wp-block-heading"><strong>教師データの収集</strong></h3>



<p>CNNの学習には正解の画像が必要ですが、インターネット上で適切な教師データを見つけることが難しいことがわかりました。そのため、TSUTAYAで絵本を購入し、自らウォーリーを探して写真を撮ることで教師用の画像を収集することにしました。</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img decoding="async" width="768" height="1024" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171026201932.jpg" alt="" class="wp-image-167" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171026201932.jpg 768w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171026201932-225x300.jpg 225w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img decoding="async" width="768" height="1024" src="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171109142203.jpg" alt="" class="wp-image-169" srcset="https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171109142203.jpg 768w, https://www.ct-innovation.blog/dl-freetime/wp-content/uploads/2018/06/20171109142203-225x300.jpg 225w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>
</div>



<h2 class="wp-block-heading">まとめ</h2>



<p>機械学習の世界は、私たちに新たな挑戦を促します。CNNを使って「ウォーリーを探せ」のプロジェクトに取り組むことで、機械学習の基礎を学びながら楽しい時間を過ごすことができます。これからの記事で、プロジェクトの進捗や結果を共有していきます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ct-innovation.blog/dl-freetime/programming/python/279/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
