flowchart LR
I["Image
28x28x1"]
C1["Conv
+ ReLU"]
P1["MaxPool"]
C2["Conv
+ ReLU"]
P2["MaxPool"]
F["Flatten"]
D["Dense"]
O["Sortie
10 classes"]
I --> C1 --> P1 --> C2 --> P2 --> F --> D --> O
style I fill:#E5D7F5,color:#1A1A1A
style O fill:#F7E64D,color:#1A1A1A
flowchart TD
subgraph Input ["Image 5x5"]
I["1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1"]
end
subgraph Filter ["Filtre 3x3"]
F["1 0 1
0 1 0
1 0 1"]
end
subgraph Output ["Feature Map 3x3"]
O["Resultat de
la convolution"]
end
Input -->|"×"| Filter --> Output
style Filter fill:#9B7AC4,color:#FFFFFF
style Output fill:#F7E64D,color:#1A1A1A
Le filtre "glisse" sur l'image et calcule un produit scalaire a chaque position.
$\begin{bmatrix} \textcolor{#3498db}{1} & \textcolor{#3498db}{0} & \textcolor{#3498db}{2} \\ \textcolor{#3498db}{0} & \textcolor{#3498db}{1} & \textcolor{#3498db}{0} \\ \textcolor{#3498db}{1} & \textcolor{#3498db}{0} & \textcolor{#3498db}{1} \end{bmatrix}$
$\begin{bmatrix} \textcolor{#9B7AC4}{-1} & \textcolor{#9B7AC4}{0} & \textcolor{#9B7AC4}{1} \\ \textcolor{#9B7AC4}{-1} & \textcolor{#9B7AC4}{0} & \textcolor{#9B7AC4}{1} \\ \textcolor{#9B7AC4}{-1} & \textcolor{#9B7AC4}{0} & \textcolor{#9B7AC4}{1} \end{bmatrix}$
$\text{Sortie} = \sum (\text{image} \times \text{filtre})$
$= (\textcolor{#3498db}{1} \times \textcolor{#9B7AC4}{-1}) + (\textcolor{#3498db}{0} \times \textcolor{#9B7AC4}{0}) + (\textcolor{#3498db}{2} \times \textcolor{#9B7AC4}{1})$
$+ (\textcolor{#3498db}{0} \times \textcolor{#9B7AC4}{-1}) + (\textcolor{#3498db}{1} \times \textcolor{#9B7AC4}{0}) + (\textcolor{#3498db}{0} \times \textcolor{#9B7AC4}{1})$
$+ (\textcolor{#3498db}{1} \times \textcolor{#9B7AC4}{-1}) + (\textcolor{#3498db}{0} \times \textcolor{#9B7AC4}{0}) + (\textcolor{#3498db}{1} \times \textcolor{#9B7AC4}{1})$
$= \textcolor{#e74c3c}{-1} + \textcolor{#27ae60}{2} + \textcolor{#e74c3c}{-1} + \textcolor{#27ae60}{1} = \textcolor{#27ae60}{\mathbf{1}}$
Interpretation: Valeur positive = bord vertical detecte!
- $\textcolor{#3498db}{Bleu}$: Pixels de l'image
- $\textcolor{#9B7AC4}{Violet}$: Poids du filtre (kernel)
- $\textcolor{#27ae60}{Vert}$: Contributions positives
- $\textcolor{#e74c3c}{Rouge}$: Contributions negatives