{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 16 · 点、框与负提示：分割规则基线","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html","markdown":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.md","pages":[{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","unit":"提示怎样指定这一次要分的区域？","unitId":"prompted-spatial-output","chapter":"II","number":1},{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","unit":"提示怎样指定这一次要分的区域？","unitId":"prompted-spatial-output","chapter":"II","number":2},{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","unit":"提示怎样指定这一次要分的区域？","unitId":"prompted-spatial-output","chapter":"II","number":3},{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","unit":"提示怎样指定这一次要分的区域？","unitId":"prompted-spatial-output","chapter":"II","number":4}],"aliases":[{"oldId":"b-78ef7c15bdfda621a432b53f","targetId":"b-78ef7c15bdfda621a432b53f","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-580025d6446c4e701c0a85fe","targetId":"b-580025d6446c4e701c0a85fe","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-dc4b080a67d44e4a6b227743","targetId":"b-dc4b080a67d44e4a6b227743","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-0bb56084bef0600e9ee51031","targetId":"b-0bb56084bef0600e9ee51031","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-0f2ade2ba52f79562cf7a356","targetId":"b-0f2ade2ba52f79562cf7a356","page":"reading-opening","operation":"move","beforeSHA256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","afterSHA256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","reason":"Same source body in authored semantic page"},{"oldId":"b-c069aa7c73630a563f0b55d7","targetId":"b-c069aa7c73630a563f0b55d7","page":"reading-opening","operation":"move","beforeSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","afterSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","reason":"Same source body in authored semantic page"},{"oldId":"b-e3964a79a1db0aa82e3b2f40","targetId":"b-e3964a79a1db0aa82e3b2f40","page":"reading-opening","operation":"move","beforeSHA256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","afterSHA256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","reason":"Same source body in authored semantic page"},{"oldId":"b-c438cfc21e774d7e3f3fe30b","targetId":"b-c438cfc21e774d7e3f3fe30b","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-862eb9ab53f93a149f6824eb","targetId":"b-862eb9ab53f93a149f6824eb","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","afterSHA256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","reason":"Same source body in authored semantic page"},{"oldId":"b-c63d0866392d709f585e2a10","targetId":"b-c63d0866392d709f585e2a10","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","afterSHA256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","reason":"Same source body in authored semantic page"},{"oldId":"b-dc46b6afe4fdcdf51951eda0","targetId":"b-dc46b6afe4fdcdf51951eda0","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","afterSHA256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","reason":"Same source body in authored semantic page"},{"oldId":"b-24784b662576dd22e0e81f13","targetId":"b-24784b662576dd22e0e81f13","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"2cdec532b5bdfc62cc95fbfa93c6aa331c83974d419bafb177b824aaba4b0fd0","afterSHA256":"2cdec532b5bdfc62cc95fbfa93c6aa331c83974d419bafb177b824aaba4b0fd0","reason":"Same source body in authored semantic page"},{"oldId":"b-b0c105e2fded1ddaa7aefef1","targetId":"b-b0c105e2fded1ddaa7aefef1","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","afterSHA256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","reason":"Same source body in authored semantic page"},{"oldId":"b-029e3c7218cdeaf7496b4f35","targetId":"b-029e3c7218cdeaf7496b4f35","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","afterSHA256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","reason":"Same source body in authored semantic page"},{"oldId":"b-f21db8c11e997e61bfefb05e","targetId":"b-f21db8c11e997e61bfefb05e","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","afterSHA256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","reason":"Same source body in authored semantic page"},{"oldId":"b-61d9d3fd12be4d5dcec05125","targetId":"b-61d9d3fd12be4d5dcec05125","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","afterSHA256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","reason":"Same source body in authored semantic page"},{"oldId":"b-77379afefce499c7d1588570","targetId":"b-77379afefce499c7d1588570","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"6fb55df2c89b57fe0a5c8c218d7358df3d91b182ca0d7b2efb317cd0e5f3c18d","afterSHA256":"6fb55df2c89b57fe0a5c8c218d7358df3d91b182ca0d7b2efb317cd0e5f3c18d","reason":"Same source body in authored semantic page"},{"oldId":"b-34d2388b46ddf6e2970699bb","targetId":"b-34d2388b46ddf6e2970699bb","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","afterSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","reason":"Same source body in authored semantic page"},{"oldId":"b-83470c549959759060bd3e03","targetId":"b-83470c549959759060bd3e03","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","afterSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","reason":"Same source body in authored semantic page"},{"oldId":"b-972ccd68419843cc91fedc8d","targetId":"b-972ccd68419843cc91fedc8d","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"82b0307b43c8cddb155ab734b455a3c609cccce306763fc343f8f307d12514e6","afterSHA256":"82b0307b43c8cddb155ab734b455a3c609cccce306763fc343f8f307d12514e6","reason":"Same source body in authored semantic page"},{"oldId":"b-e0738e0ce7a040e1056b0dbd","targetId":"b-e0738e0ce7a040e1056b0dbd","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","afterSHA256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","reason":"Same source body in authored semantic page"},{"oldId":"b-b44b24fae99088e28d63557f","targetId":"b-b44b24fae99088e28d63557f","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"711476480ec133395b21df180bd636ee23f2bbadb824a8b86b98e5ef137bbc05","afterSHA256":"2c33ed1b8fda6746ae8bf439c0b94c370add166d4657cf402a15f011260dcb98","reason":"Same source body in authored semantic page"},{"oldId":"b-2b285ff836e5ab11702a701f","targetId":"b-2b285ff836e5ab11702a701f","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"db2bdb45c723abbab96b923ef260c66f315cb6bae806a52d4fb00cfade18367b","afterSHA256":"db2bdb45c723abbab96b923ef260c66f315cb6bae806a52d4fb00cfade18367b","reason":"Same source body in authored semantic page"},{"oldId":"b-c4e9ab8a1ee11f1459a3b0e1","targetId":"b-c4e9ab8a1ee11f1459a3b0e1","page":"reading-block-9c0f03efa4584e448eebaf416a492370","operation":"move","beforeSHA256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","afterSHA256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","reason":"Same source body in authored semantic page"},{"oldId":"b-dab002843c07c4d14cdf0c78","targetId":"b-dab002843c07c4d14cdf0c78","page":"reading-block-9c0f03efa4584e448eebaf416a492370","operation":"move","beforeSHA256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","afterSHA256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","reason":"Same source body in authored semantic page"},{"oldId":"block-b800ace904634fa1923a4a15bf3725cc--一个点为什么不总能确定一个对象","targetId":"b-b0c105e2fded1ddaa7aefef1","operation":"retain-source-identity"},{"oldId":"block-be0ffb282ff049c88a51c23102954748--已完成的基准运行","targetId":"b-34d2388b46ddf6e2970699bb","operation":"retain-source-identity"}],"blocks":[{"id":"b-0f2ade2ba52f79562cf7a356","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-0f2ade2ba52f79562cf7a356","content":"# LAB 16 · 点、框与负提示：分割规则基线","sha256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-c069aa7c73630a563f0b55d7","prerequisites":[{"id":"b-c069aa7c73630a563f0b55d7","url":"#b-c069aa7c73630a563f0b55d7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c069aa7c73630a563f0b55d7","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-c069aa7c73630a563f0b55d7","content":"按问题继续","sha256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0f2ade2ba52f79562cf7a356","nextBlock":"b-e3964a79a1db0aa82e3b2f40","prerequisites":[{"id":"b-0f2ade2ba52f79562cf7a356","url":"#b-0f2ade2ba52f79562cf7a356","role":"section-title"}],"relatedBlocks":[]},{"id":"b-e3964a79a1db0aa82e3b2f40","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-e3964a79a1db0aa82e3b2f40","content":"像素连通域、正负点/框提示、局部/整体多义性","sha256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c069aa7c73630a563f0b55d7","nextBlock":"b-c438cfc21e774d7e3f3fe30b","prerequisites":[{"id":"b-0f2ade2ba52f79562cf7a356","url":"#b-0f2ade2ba52f79562cf7a356","role":"section-title"},{"id":"b-c069aa7c73630a563f0b55d7","url":"#b-c069aa7c73630a563f0b55d7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c438cfc21e774d7e3f3fe30b","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-c438cfc21e774d7e3f3fe30b","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e3964a79a1db0aa82e3b2f40","nextBlock":null,"prerequisites":[{"id":"b-0f2ade2ba52f79562cf7a356","url":"#b-0f2ade2ba52f79562cf7a356","role":"section-title"},{"id":"b-c069aa7c73630a563f0b55d7","url":"#b-c069aa7c73630a563f0b55d7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-862eb9ab53f93a149f6824eb","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-862eb9ab53f93a149f6824eb","content":"**学习路径：** [像素、边界与对象身份](/course/study/pixels-instances.html) · [一句话指向哪个对象](/course/study/grounding-interface.html)。两个入口引用同一份现有材料，不需要重复阅读或运行。","sha256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-c63d0866392d709f585e2a10","prerequisites":[],"relatedBlocks":[]},{"id":"b-c63d0866392d709f585e2a10","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-c63d0866392d709f585e2a10","content":"这是 [P46–47 提示式分割](/course/pages/l3-r2-p46.html) 的按需短练习，不是 SAM 权重实验。输入同一张 RGB 图、一个正点及可选负点/框，颜色距离与连通域规则返回 mask；没有参数训练。","sha256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-862eb9ab53f93a149f6824eb","nextBlock":"b-dc46b6afe4fdcdf51951eda0","prerequisites":[{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-dc46b6afe4fdcdf51951eda0","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-dc46b6afe4fdcdf51951eda0","content":"先看 [四种已保存输出](/course/blocks/sam-rule-baseline-explained.html)，再只改一种条件：颜色容差、负点或框。记录返回面积或边界怎样改变，说明变化来自增加的提示信息还是规则本身的假设。","sha256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c63d0866392d709f585e2a10","nextBlock":"b-24784b662576dd22e0e81f13","prerequisites":[{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-24784b662576dd22e0e81f13","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-24784b662576dd22e0e81f13","content":"如果疑问是“训练后模型如何学会响应提示”，转到 [SAM 的任务训练](/course/blocks/sam-task-training.html)；如果已经理解接口，可回 [CLS 02](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/f9ab632ba16b4f2084669791cba6ba85) 接视觉语言主线，无需额外运行本册。","sha256":"2cdec532b5bdfc62cc95fbfa93c6aa331c83974d419bafb177b824aaba4b0fd0","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-dc46b6afe4fdcdf51951eda0","nextBlock":"b-b0c105e2fded1ddaa7aefef1","prerequisites":[{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b0c105e2fded1ddaa7aefef1","type":"h2","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-b0c105e2fded1ddaa7aefef1","content":"## 一个点为什么不总能确定一个对象","sha256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-24784b662576dd22e0e81f13","nextBlock":"b-029e3c7218cdeaf7496b4f35","prerequisites":[{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-029e3c7218cdeaf7496b4f35","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-029e3c7218cdeaf7496b4f35","content":"输入是自行绘制的 48×64 RGB 图像：相邻的红色外壳和深红色内部零件，另有蓝色物体。正点、负点和矩形是使用者给出的条件，而非正确 mask。本例使用颜色距离与连通域的确定性算法，完整读入像素并返回 mask；它不训练，也不是 SAM。我们保留原来的“同一点同时落在局部和整体”例子，但现在实际改变提示和阈值，检查返回区域。","sha256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b0c105e2fded1ddaa7aefef1","nextBlock":"b-f21db8c11e997e61bfefb05e","prerequisites":[{"id":"b-b0c105e2fded1ddaa7aefef1","url":"#b-b0c105e2fded1ddaa7aefef1","role":"section-title"},{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f21db8c11e997e61bfefb05e","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-f21db8c11e997e61bfefb05e","content":"先预测：扩大颜色容差，正点的连通区域会增加还是减少？增加落在外壳上的负点会如何影响结果？负点在此算法中添加的是颜色排除规则，与 SAM 学到的提示编码不同。","sha256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-029e3c7218cdeaf7496b4f35","nextBlock":"b-61d9d3fd12be4d5dcec05125","prerequisites":[{"id":"b-b0c105e2fded1ddaa7aefef1","url":"#b-b0c105e2fded1ddaa7aefef1","role":"section-title"},{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-61d9d3fd12be4d5dcec05125","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-61d9d3fd12be4d5dcec05125","content":"[本册算法与四项已保存输出](/course/blocks/sam-rule-baseline-explained.html) · [SAM 的能力实际怎样训练出来](/course/blocks/sam-task-training.html)","sha256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-f21db8c11e997e61bfefb05e","nextBlock":"b-77379afefce499c7d1588570","prerequisites":[{"id":"b-b0c105e2fded1ddaa7aefef1","url":"#b-b0c105e2fded1ddaa7aefef1","role":"section-title"},{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-77379afefce499c7d1588570","type":"pre","scope":"block-a938e2aaafcf413d96db608c3cb1cfbc","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-77379afefce499c7d1588570","content":"```\n# Writable ephemeral workspace for detached readonly cloud runs.\nimport os, tempfile\nos.chdir(tempfile.mkdtemp(prefix='lec03_lab16_'))\n\nimport numpy as np\nfrom pathlib import Path\nimport matplotlib; matplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nout=Path('lab16-results'); out.mkdir(exist_ok=True)\nimage=np.full((48,64,3),.94); image[8:39,7:34]=[.8,.18,.15]\nimage[18:29,17:27]=[.48,.10,.08]; image[13:37,43:57]=[.12,.25,.8]\ndef segment(image,positive,tolerance,negative=None,box=None):\n    x,y=positive; seed=image[y,x]; allowed=np.linalg.norm(image-seed,axis=-1)<tolerance\n    if negative is not None:\n        nx,ny=negative\n        allowed &= np.linalg.norm(image-image[ny,nx],axis=-1)>.15\n    if box is not None:\n        x0,y0,x1,y1=box; crop=np.zeros(allowed.shape,bool); crop[y0:y1,x0:x1]=True; allowed &= crop\n    result=np.zeros(allowed.shape,bool); stack=[(x,y)]\n    while stack:\n        x,y=stack.pop()\n        if not (0<=x<64 and 0<=y<48) or result[y,x] or not allowed[y,x]: continue\n        result[y,x]=True; stack.extend([(x-1,y),(x+1,y),(x,y-1),(x,y+1)])\n    return result\nconfigs=[('tight',.2,None,None),('loose',.5,None,None),('negative',.5,(10,10),None),('box',.5,None,(16,17,28,30))]\nmasks=[segment(image,(21,23),t,n,b) for _,t,n,b in configs]\nfig,axs=plt.subplots(1,5,figsize=(12,3)); axs[0].imshow(image); axs[0].plot(21,23,'g+'); axs[0].set_title('RGB + positive point')\nfor ax,(name,*_),mask in zip(axs[1:],configs,masks): ax.imshow(mask,vmin=0,vmax=1); ax.set_title(name+' area='+str(mask.sum()))\nfor ax in axs: ax.axis('off')\nfig.tight_layout(); fig.savefig(out/'lab16-prompts.png',dpi=150); plt.close(fig)\nassert masks[0].sum()==110 and masks[1].sum()==837\nprint({name:int(m.sum()) for (name,*_),m in zip(configs,masks)})\nprint('negative removes similar outer-shell pixels; box clips, neither proves learned object semantics')\n```","sha256":"6fb55df2c89b57fe0a5c8c218d7358df3d91b182ca0d7b2efb317cd0e5f3c18d","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-61d9d3fd12be4d5dcec05125","nextBlock":null,"prerequisites":[{"id":"b-b0c105e2fded1ddaa7aefef1","url":"#b-b0c105e2fded1ddaa7aefef1","role":"section-title"},{"id":"b-862eb9ab53f93a149f6824eb","url":"#b-862eb9ab53f93a149f6824eb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-34d2388b46ddf6e2970699bb","type":"h2","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-34d2388b46ddf6e2970699bb","content":"## 已完成的基准运行","sha256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-83470c549959759060bd3e03","prerequisites":[{"id":"b-83470c549959759060bd3e03","url":"#b-83470c549959759060bd3e03","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-83470c549959759060bd3e03","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-83470c549959759060bd3e03","content":"以下是本轮本地独立 Python 进程的实际标准输出，云端执行另行记录。","sha256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-34d2388b46ddf6e2970699bb","nextBlock":"b-972ccd68419843cc91fedc8d","prerequisites":[{"id":"b-34d2388b46ddf6e2970699bb","url":"#b-34d2388b46ddf6e2970699bb","role":"section-title"}],"relatedBlocks":[]},{"id":"b-972ccd68419843cc91fedc8d","type":"pre","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-972ccd68419843cc91fedc8d","content":"```\n{'tight': 110, 'loose': 837, 'negative': 110, 'box': 156}\nnegative removes similar outer-shell pixels; box clips, neither proves learned object semantics\n\n```","sha256":"82b0307b43c8cddb155ab734b455a3c609cccce306763fc343f8f307d12514e6","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-83470c549959759060bd3e03","nextBlock":"b-e0738e0ce7a040e1056b0dbd","prerequisites":[{"id":"b-34d2388b46ddf6e2970699bb","url":"#b-34d2388b46ddf6e2970699bb","role":"section-title"},{"id":"b-83470c549959759060bd3e03","url":"#b-83470c549959759060bd3e03","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e0738e0ce7a040e1056b0dbd","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-e0738e0ce7a040e1056b0dbd","content":"紧容差只保留内部 110 像素；宽容差合并到 837 像素外壳。负点回到 110，框则保留框内相连部分。这说明提示与算法假设共同决定输出，框还可能截断对象。","sha256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-972ccd68419843cc91fedc8d","nextBlock":"b-b44b24fae99088e28d63557f","prerequisites":[{"id":"b-34d2388b46ddf6e2970699bb","url":"#b-34d2388b46ddf6e2970699bb","role":"section-title"},{"id":"b-83470c549959759060bd3e03","url":"#b-83470c549959759060bd3e03","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b44b24fae99088e28d63557f","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-b44b24fae99088e28d63557f","content":"![同一RGB输入的四种提示结果](/assets/display/4a9a30188e394075dc0e66fa.webp)","sha256":"2c33ed1b8fda6746ae8bf439c0b94c370add166d4657cf402a15f011260dcb98","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e0738e0ce7a040e1056b0dbd","nextBlock":"b-2b285ff836e5ab11702a701f","prerequisites":[{"id":"b-34d2388b46ddf6e2970699bb","url":"#b-34d2388b46ddf6e2970699bb","role":"section-title"},{"id":"b-83470c549959759060bd3e03","url":"#b-83470c549959759060bd3e03","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-2b285ff836e5ab11702a701f","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-2b285ff836e5ab11702a701f","content":"SAM 把图像与提示分别编码，由 mask decoder 预测多个候选和质量分数；不是这段颜色规则。真实模型使用流程见 [官方 SAM predictor](https://github.com/facebookresearch/segment-anything/blob/main/notebooks/predictor_example.ipynb)。本次没有执行 SAM checkpoint。比较算法时固定这张图与提示，保存返回 mask，不把任意一个包含正点的 mask 都叫正确答案。下一步只把正点移到蓝色物体，解释颜色阈值是否还足够；与 [LAB 11 像素预测](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/9e268706471944e3a59e6f568f9ce9a3) 对照：模型类别预测和使用者选择对象是两个问题。","sha256":"db2bdb45c723abbab96b923ef260c66f315cb6bae806a52d4fb00cfade18367b","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b44b24fae99088e28d63557f","nextBlock":null,"prerequisites":[{"id":"b-34d2388b46ddf6e2970699bb","url":"#b-34d2388b46ddf6e2970699bb","role":"section-title"},{"id":"b-83470c549959759060bd3e03","url":"#b-83470c549959759060bd3e03","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4e808680fdd8a84562898d7e","type":"h4","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-4e808680fdd8a84562898d7e","content":"#### 不运行也能检查：一个点包含在两个区域中","sha256":"706a2aba84ea474b40578db0a0d75f0b0314e8b62718b8c641531e5be4d19851","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-c4e9ab8a1ee11f1459a3b0e1","prerequisites":[{"id":"b-c4e9ab8a1ee11f1459a3b0e1","url":"#b-c4e9ab8a1ee11f1459a3b0e1","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c4e9ab8a1ee11f1459a3b0e1","type":"p","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-c4e9ab8a1ee11f1459a3b0e1","content":"在 8×8 网格里，让局部区域为行列 2–3 的四个格子，整体区域为行列 1–6 的 36 个格子。点 (2,2) 同时属于两者，所以“包含正点”无法唯一规定目标。当前上方 RGB 实验进一步用容差、负点和框实际选择区域。","sha256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4e808680fdd8a84562898d7e","nextBlock":"b-dab002843c07c4d14cdf0c78","prerequisites":[{"id":"b-4e808680fdd8a84562898d7e","url":"#b-4e808680fdd8a84562898d7e","role":"section-title"}],"relatedBlocks":[]},{"id":"b-dab002843c07c4d14cdf0c78","type":"p","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/notebooks/d83defa954034769a1ee94e3ea48640a.html#b-dab002843c07c4d14cdf0c78","content":"[从这一歧义读回提示式分割接口](/course/blocks/sam-prompt-contract.html)。","sha256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","chapter":{"id":"II","title":"区域、像素与实例"},"unit":{"id":"prompted-spatial-output","title":"提示怎样指定这一次要分的区域？"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c4e9ab8a1ee11f1459a3b0e1","nextBlock":null,"prerequisites":[{"id":"b-4e808680fdd8a84562898d7e","url":"#b-4e808680fdd8a84562898d7e","role":"section-title"},{"id":"b-c4e9ab8a1ee11f1459a3b0e1","url":"#b-c4e9ab8a1ee11f1459a3b0e1","role":"problem-context"}],"relatedBlocks":[]}]}
