Files
maths-cs-ai-compendium-zh/images/clip_contrastive_matrix.svg
T

92 lines
6.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 350" width="600" height="350">
<defs>
<marker id="cm-arr" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
<path d="M0,0 L7,2.5 L0,5 Z" fill="#333"/>
</marker>
<marker id="cm-green" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
<path d="M0,0 L7,2.5 L0,5 Z" fill="#27ae60"/>
</marker>
<marker id="cm-red" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
<path d="M0,0 L7,2.5 L0,5 Z" fill="#e74c3c"/>
</marker>
</defs>
<!-- Title -->
<text x="300" y="22" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#333">CLIP Contrastive Learning: N×N Similarity Matrix</text>
<!-- Column headers -->
<text x="246" y="56" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e74c3c">Text₁</text>
<text x="316" y="56" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e74c3c">Text₂</text>
<text x="386" y="56" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e74c3c">Text₃</text>
<text x="456" y="56" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e74c3c">Text₄</text>
<!-- Row headers -->
<text x="170" y="94" text-anchor="end" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#3498db">Image₁</text>
<text x="170" y="164" text-anchor="end" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#3498db">Image₂</text>
<text x="170" y="234" text-anchor="end" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#3498db">Image₃</text>
<text x="170" y="304" text-anchor="end" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#3498db">Image₄</text>
<!-- Grid: 4x4 cells, each 70x70 -->
<!-- Row 1 -->
<rect x="211" y="64" width="70" height="52" rx="4" fill="#27ae60" fill-opacity="0.25" stroke="#27ae60" stroke-width="1.5"/>
<text x="246" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#27ae60">+</text>
<rect x="281" y="64" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="316" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="351" y="64" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="386" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="421" y="64" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="456" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<!-- Row 2 -->
<rect x="211" y="134" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="246" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="281" y="134" width="70" height="52" rx="4" fill="#27ae60" fill-opacity="0.25" stroke="#27ae60" stroke-width="1.5"/>
<text x="316" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#27ae60">+</text>
<rect x="351" y="134" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="386" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="421" y="134" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="456" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<!-- Row 3 -->
<rect x="211" y="204" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="246" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="281" y="204" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="316" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="351" y="204" width="70" height="52" rx="4" fill="#27ae60" fill-opacity="0.25" stroke="#27ae60" stroke-width="1.5"/>
<text x="386" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#27ae60">+</text>
<rect x="421" y="204" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="456" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<!-- Row 4 -->
<rect x="211" y="274" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="246" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="281" y="274" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="316" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="351" y="274" width="70" height="52" rx="4" fill="#e74c3c" fill-opacity="0.08" stroke="#ccc" stroke-width="1"/>
<text x="386" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#e74c3c" opacity="0.6"></text>
<rect x="421" y="274" width="70" height="52" rx="4" fill="#27ae60" fill-opacity="0.25" stroke="#27ae60" stroke-width="1.5"/>
<text x="456" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#27ae60">+</text>
<!-- "maximise" annotation on diagonal -->
<text x="530" y="95" text-anchor="start" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#27ae60">maximise</text>
<line x1="495" y1="90" x2="522" y2="90" stroke="#27ae60" stroke-width="1.2" marker-end="url(#cm-green)"/>
<!-- "minimise" annotation on off-diagonal -->
<text x="530" y="170" text-anchor="start" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e74c3c">minimise</text>
<line x1="492" y1="165" x2="522" y2="165" stroke="#e74c3c" stroke-width="1.2" marker-end="url(#cm-red)"/>
<!-- Symmetric loss annotation at bottom -->
<text x="350" y="342" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Loss = ½ (CE over rows + CE over columns) — symmetric cross-entropy</text>
</svg>