{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html","markdown":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.md","pages":[{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","unitId":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","chapter":"course","number":1}],"aliases":[{"oldId":"b-1d8a586da410c665559efe3b","targetId":"b-1d8a586da410c665559efe3b","page":"reading-opening","operation":"move","beforeSHA256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","afterSHA256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","reason":"Same source body in authored semantic page"},{"oldId":"b-7b0c83ce09c0d2f523b15c41","targetId":"b-7b0c83ce09c0d2f523b15c41","page":"reading-opening","operation":"move","beforeSHA256":"3316e933c188a533cda6715672cb10d10754ab6684f0690565ae260427ab4fd3","afterSHA256":"3316e933c188a533cda6715672cb10d10754ab6684f0690565ae260427ab4fd3","reason":"Same source body in authored semantic page"},{"oldId":"b-7b92e87b79287541c363c54c","targetId":"b-7b92e87b79287541c363c54c","page":"reading-opening","operation":"move","beforeSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","afterSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","reason":"Same source body in authored semantic page"},{"oldId":"b-1f970ac2bc6ccfed757756e3","targetId":"b-1f970ac2bc6ccfed757756e3","page":"reading-opening","operation":"move","beforeSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","afterSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","reason":"Same source body in authored semantic page"},{"oldId":"b-3af1f24cf2fd448aef189c91","targetId":"b-3af1f24cf2fd448aef189c91","page":"reading-opening","operation":"move","beforeSHA256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","afterSHA256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","reason":"Same source body in authored semantic page"}],"blocks":[{"id":"b-1d8a586da410c665559efe3b","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html#b-1d8a586da410c665559efe3b","content":"[LAB 12 · CLIP延伸：缓存与检索（近似索引选读）](/course/notebooks/921eeaf784284ce19568c6ca7619b55a.html)","sha256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"unit":{"id":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-7b0c83ce09c0d2f523b15c41","prerequisites":[],"relatedBlocks":[]},{"id":"b-7b0c83ce09c0d2f523b15c41","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html#b-7b0c83ce09c0d2f523b15c41","content":"# LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sha256":"3316e933c188a533cda6715672cb10d10754ab6684f0690565ae260427ab4fd3","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"unit":{"id":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1d8a586da410c665559efe3b","nextBlock":"b-7b92e87b79287541c363c54c","prerequisites":[{"id":"b-1d8a586da410c665559efe3b","url":"#b-1d8a586da410c665559efe3b","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-7b92e87b79287541c363c54c","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html#b-7b92e87b79287541c363c54c","content":"并入相关学习路径","sha256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"unit":{"id":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7b0c83ce09c0d2f523b15c41","nextBlock":"b-1f970ac2bc6ccfed757756e3","prerequisites":[{"id":"b-7b0c83ce09c0d2f523b15c41","url":"#b-7b0c83ce09c0d2f523b15c41","role":"section-title"},{"id":"b-1d8a586da410c665559efe3b","url":"#b-1d8a586da410c665559efe3b","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1f970ac2bc6ccfed757756e3","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html#b-1f970ac2bc6ccfed757756e3","content":"同一CLIP缓存、exact/IVF搜索、延迟/扫描量、区域交互基线","sha256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"unit":{"id":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7b92e87b79287541c363c54c","nextBlock":"b-3af1f24cf2fd448aef189c91","prerequisites":[{"id":"b-7b0c83ce09c0d2f523b15c41","url":"#b-7b0c83ce09c0d2f523b15c41","role":"section-title"},{"id":"b-1d8a586da410c665559efe3b","url":"#b-1d8a586da410c665559efe3b","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-3af1f24cf2fd448aef189c91","type":"pre","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/4e6be52d45e84175a6f134439b154cd8.html#b-3af1f24cf2fd448aef189c91","content":"```\n# 每次整册运行使用临时工作目录，保留项目旧文件与历史结果。\nimport os, tempfile\nL03_RUN_DIR=tempfile.mkdtemp(prefix=\"lecture03-lab12-\")\nos.chdir(L03_RUN_DIR)\nimport numpy as np\nI=np.array([[1,0],[0,1],[.8,.2]],float); T=np.array([[1,0],[0,1]],float); I/=np.linalg.norm(I,axis=1,keepdims=True); T/=np.linalg.norm(T,axis=1,keepdims=True)\nS=T@I.T; print('similarity\\n',S.round(3)); ranks=np.argsort(-S,axis=1); truth=[0,1]\nfor k in [1,2]: print('Recall@'+str(k),np.mean([truth[i] in ranks[i,:k] for i in range(2)]))\n```","sha256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"unit":{"id":"notebook-blocks/4e6be52d45e84175a6f134439b154cd8","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读） · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1f970ac2bc6ccfed757756e3","nextBlock":null,"prerequisites":[{"id":"b-7b0c83ce09c0d2f523b15c41","url":"#b-7b0c83ce09c0d2f523b15c41","role":"section-title"},{"id":"b-1d8a586da410c665559efe3b","url":"#b-1d8a586da410c665559efe3b","role":"problem-context"}],"relatedBlocks":[]}]}
