Files

123 lines
9.4 KiB
XML

<svg width="700" height="300" xmlns="http://www.w3.org/2000/svg">
<text x="350" y="22" fill="#333" font-size="14" font-weight="bold" text-anchor="middle">2D Convolution: Filter Slides Over Input</text>
<!-- Input grid 5x5 -->
<text x="120" y="48" fill="#666" font-size="11" text-anchor="middle">Input (5x5)</text>
<!-- Row 1 -->
<rect x="55" y="55" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="83" y="55" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="111" y="55" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="139" y="55" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="167" y="55" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<!-- Row 2 -->
<rect x="55" y="83" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="83" y="83" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="111" y="83" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="139" y="83" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="167" y="83" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<!-- Row 3 -->
<rect x="55" y="111" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="83" y="111" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="111" y="111" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="139" y="111" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="167" y="111" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<!-- Row 4 -->
<rect x="55" y="139" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="83" y="139" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="111" y="139" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="139" y="139" width="28" height="28" fill="#3498db" opacity="0.2" stroke="#3498db" stroke-width="1.5"/>
<rect x="167" y="139" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<!-- Row 5 -->
<rect x="55" y="167" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="83" y="167" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="111" y="167" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="139" y="167" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<rect x="167" y="167" width="28" height="28" fill="#eee" stroke="#999" stroke-width="1"/>
<!-- Numbers in input -->
<text x="69" y="74" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="97" y="74" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="125" y="74" fill="#666" font-size="10" text-anchor="middle">2</text>
<text x="153" y="74" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="181" y="74" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="69" y="102" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="97" y="102" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">1</text>
<text x="125" y="102" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">3</text>
<text x="153" y="102" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">1</text>
<text x="181" y="102" fill="#666" font-size="10" text-anchor="middle">2</text>
<text x="69" y="130" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="97" y="130" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">2</text>
<text x="125" y="130" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">1</text>
<text x="153" y="130" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">0</text>
<text x="181" y="130" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="69" y="158" fill="#666" font-size="10" text-anchor="middle">2</text>
<text x="97" y="158" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">0</text>
<text x="125" y="158" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">1</text>
<text x="153" y="158" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">2</text>
<text x="181" y="158" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="69" y="186" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="97" y="186" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="125" y="186" fill="#666" font-size="10" text-anchor="middle">0</text>
<text x="153" y="186" fill="#666" font-size="10" text-anchor="middle">1</text>
<text x="181" y="186" fill="#666" font-size="10" text-anchor="middle">3</text>
<!-- Highlighted region border -->
<rect x="83" y="83" width="84" height="84" fill="none" stroke="#3498db" stroke-width="2.5" rx="2"/>
<!-- Filter 3x3 -->
<text x="310" y="80" fill="#e74c3c" font-size="11" font-weight="bold" text-anchor="middle">Filter (3x3)</text>
<rect x="275" y="88" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="303" y="88" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="331" y="88" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="275" y="116" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="303" y="116" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="331" y="116" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="275" y="144" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="303" y="144" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<rect x="331" y="144" width="28" height="28" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
<!-- Filter values -->
<text x="289" y="107" fill="#e74c3c" font-size="10" text-anchor="middle">1</text>
<text x="317" y="107" fill="#e74c3c" font-size="10" text-anchor="middle">0</text>
<text x="345" y="107" fill="#e74c3c" font-size="10" text-anchor="middle">-1</text>
<text x="289" y="135" fill="#e74c3c" font-size="10" text-anchor="middle">1</text>
<text x="317" y="135" fill="#e74c3c" font-size="10" text-anchor="middle">0</text>
<text x="345" y="135" fill="#e74c3c" font-size="10" text-anchor="middle">-1</text>
<text x="289" y="163" fill="#e74c3c" font-size="10" text-anchor="middle">1</text>
<text x="317" y="163" fill="#e74c3c" font-size="10" text-anchor="middle">0</text>
<text x="345" y="163" fill="#e74c3c" font-size="10" text-anchor="middle">-1</text>
<!-- Multiply symbol -->
<text x="240" y="130" fill="#333" font-size="18" text-anchor="middle">*</text>
<!-- Equals arrow -->
<text x="390" y="130" fill="#333" font-size="16" text-anchor="middle">=</text>
<!-- Output grid 3x3 -->
<text x="510" y="80" fill="#27ae60" font-size="11" font-weight="bold" text-anchor="middle">Output (3x3)</text>
<rect x="472" y="88" width="32" height="32" fill="#27ae60" opacity="0.15" stroke="#27ae60" stroke-width="1.5"/>
<rect x="504" y="88" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="536" y="88" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="472" y="120" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="504" y="120" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="536" y="120" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="472" y="152" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="504" y="152" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<rect x="536" y="152" width="32" height="32" fill="#27ae60" opacity="0.1" stroke="#27ae60" stroke-width="1"/>
<!-- Output value (highlighted cell) -->
<text x="488" y="110" fill="#27ae60" font-size="11" text-anchor="middle" font-weight="bold">2</text>
<!-- Computation detail -->
<text x="350" y="210" fill="#666" font-size="10" text-anchor="middle">1·1 + 3·0 + 1·(-1) + 2·1 + 1·0 + 0·(-1) + 0·1 + 1·0 + 2·(-1) = 2</text>
<!-- Arrow showing slide direction -->
<text x="120" y="215" fill="#3498db" font-size="10" text-anchor="middle">filter slides right and down</text>
<line x1="80" y1="222" x2="160" y2="222" stroke="#3498db" stroke-width="1.2"/>
<polygon points="160,219 167,222 160,225" fill="#3498db"/>
<!-- Bottom note -->
<rect x="110" y="250" width="480" height="40" rx="6" fill="#f5f5f5" stroke="#333" stroke-width="1"/>
<text x="350" y="267" fill="#333" font-size="10" text-anchor="middle">Output size = (input - filter + 2·padding) / stride + 1</text>
<text x="350" y="282" fill="#666" font-size="10" text-anchor="middle">Same filter weights applied at every position (weight sharing)</text>
</svg>