0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

有胚乳種子と無胚乳種子の画像分類

Posted at

【1】画像分類の定式化

◆ 入力データ:

種子画像 $I \in \mathbb{R}^{H \times W \times C}$
(高さ $H$、幅 $W$、チャンネル数 $C=3$:RGB)

◆ 出力ラベル:

$$
y \in {0, 1}
\quad
\begin{cases}
0: \text{無胚乳種子} \
1: \text{有胚乳種子}
\end{cases}
$$


【2】CNNによる分類関数

学習するモデルは次のような関数 $f_{\theta}$:

$$
f_{\theta}: \mathbb{R}^{H \times W \times C} \to [0, 1]
$$

これは確率的な分類関数であり、

$$
f_{\theta}(I) = P(y = 1 \mid I; \theta)
$$

のように、画像 $I$ が「有胚乳種子」である確率を返す。


【3】損失関数(バイナリ交差エントロピー)

教師あり学習では、損失関数を最小化することで学習を行う:

$$
\mathcal{L}(\theta) = - \frac{1}{N} \sum_{i=1}^{N} \left[
y_i \cdot \log f_{\theta}(I_i) + (1 - y_i) \cdot \log(1 - f_{\theta}(I_i))
\right]
$$

  • $N$:サンプル数
  • $I_i$:i番目の画像
  • $y_i$:i番目の正解ラベル(0または1)

【4】モデル構造(簡略化)

畳み込みニューラルネットワーク(CNN)の基本構造:

$$
f_{\theta}(I) = \text{Softmax}(W_2 \cdot \sigma(W_1 \cdot \text{Conv}(I) + b_1) + b_2)
$$

  • Conv:畳み込み層
  • $\sigma$:ReLUなどの非線形関数
  • $W_1, W_2$:全結合層の重み
  • $b_1, b_2$:バイアス

【5】予測と分類結果

予測確率がしきい値(通常は0.5)以上ならクラス1(有胚乳種子)と判定:

$$
\hat{y} =
\begin{cases}
1 & \text{if } f_{\theta}(I) \geq 0.5 \
0 & \text{otherwise}
\end{cases}
$$


【6】勾配降下法による最適化

パラメータ $\theta$ を最小化する方向に更新:

$$
\theta \leftarrow \theta - \eta \cdot \nabla_\theta \mathcal{L}(\theta)
$$

  • $\eta$:学習率
  • $\nabla_\theta \mathcal{L}$:損失関数の勾配

【7】モデル解釈(Grad-CAM)

最後の畳み込み層の出力 $A^k$ に対して:

$$
L_{\text{Grad-CAM}}^c = \text{ReLU} \left( \sum_k \alpha_k^c A^k \right)
$$

  • $\alpha_k^c = \frac{1}{Z} \sum_i \sum_j \frac{\partial y^c}{\partial A^k_{ij}}$
  • $y^c$:クラスcの出力
  • $Z$:空間サイズ(i, jの合計数)

これにより、モデルがどこを見て分類しているかを可視化可能。


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?