{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.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/lab16-提示式分割.html","markdown":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.md","pages":[{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","unit":"LAB 16 · 点、框与负提示：分割规则基线","unitId":"lab16-提示式分割","chapter":"course","number":1},{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","unit":"LAB 16 · 点、框与负提示：分割规则基线","unitId":"lab16-提示式分割","chapter":"course","number":2},{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","unit":"LAB 16 · 点、框与负提示：分割规则基线","unitId":"lab16-提示式分割","chapter":"course","number":3},{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","unit":"LAB 16 · 点、框与负提示：分割规则基线","unitId":"lab16-提示式分割","chapter":"course","number":4}],"aliases":[{"oldId":"b-35f1dcdb715c8a7f75f99762","targetId":"b-35f1dcdb715c8a7f75f99762","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-c1fbef70702a7466a630efb4","targetId":"b-c1fbef70702a7466a630efb4","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-cba3015ff93e309f112f344b","targetId":"b-cba3015ff93e309f112f344b","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-9d0640119fe57047a3061e77","targetId":"b-9d0640119fe57047a3061e77","operation":"historical-explanation","sourceScope":"block-9c0f03efa4584e448eebaf416a492370"},{"oldId":"b-54dd3d9814b168008345d4d8","targetId":"b-54dd3d9814b168008345d4d8","page":"reading-opening","operation":"move","beforeSHA256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","afterSHA256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","reason":"Same source body in authored semantic page"},{"oldId":"b-75f58f9512f038b43545a78d","targetId":"b-75f58f9512f038b43545a78d","page":"reading-opening","operation":"move","beforeSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","afterSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","reason":"Same source body in authored semantic page"},{"oldId":"b-dcae3180d418000961102353","targetId":"b-dcae3180d418000961102353","page":"reading-opening","operation":"move","beforeSHA256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","afterSHA256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","reason":"Same source body in authored semantic page"},{"oldId":"b-d08ca56b490e208a4cf82440","targetId":"b-d08ca56b490e208a4cf82440","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-19fddca512a7c28bfc6c557f","targetId":"b-19fddca512a7c28bfc6c557f","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","afterSHA256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","reason":"Same source body in authored semantic page"},{"oldId":"b-b8efd5f328c5b1f895e4db0e","targetId":"b-b8efd5f328c5b1f895e4db0e","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","afterSHA256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","reason":"Same source body in authored semantic page"},{"oldId":"b-057396fe76e56e0328c6e665","targetId":"b-057396fe76e56e0328c6e665","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","afterSHA256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","reason":"Same source body in authored semantic page"},{"oldId":"b-415a447b8414b89c98862025","targetId":"b-415a447b8414b89c98862025","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"2cdec532b5bdfc62cc95fbfa93c6aa331c83974d419bafb177b824aaba4b0fd0","afterSHA256":"2cdec532b5bdfc62cc95fbfa93c6aa331c83974d419bafb177b824aaba4b0fd0","reason":"Same source body in authored semantic page"},{"oldId":"b-2a6796dfcb9c3ddc26f5a4fe","targetId":"b-2a6796dfcb9c3ddc26f5a4fe","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","afterSHA256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","reason":"Same source body in authored semantic page"},{"oldId":"b-d4a0c628e833d4519c8157b7","targetId":"b-d4a0c628e833d4519c8157b7","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","afterSHA256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","reason":"Same source body in authored semantic page"},{"oldId":"b-0390357281a0ffc9c9c908b8","targetId":"b-0390357281a0ffc9c9c908b8","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","afterSHA256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","reason":"Same source body in authored semantic page"},{"oldId":"b-81d43df6fc004ae40500d78a","targetId":"b-81d43df6fc004ae40500d78a","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","afterSHA256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","reason":"Same source body in authored semantic page"},{"oldId":"b-cccbd244a6a86b1b49f6af28","targetId":"b-cccbd244a6a86b1b49f6af28","page":"reading-block-b800ace904634fa1923a4a15bf3725cc","operation":"move","beforeSHA256":"6fb55df2c89b57fe0a5c8c218d7358df3d91b182ca0d7b2efb317cd0e5f3c18d","afterSHA256":"6fb55df2c89b57fe0a5c8c218d7358df3d91b182ca0d7b2efb317cd0e5f3c18d","reason":"Same source body in authored semantic page"},{"oldId":"b-7a800f71f43535d913ca965a","targetId":"b-7a800f71f43535d913ca965a","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","afterSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","reason":"Same source body in authored semantic page"},{"oldId":"b-92b0b394d2f55c52f8083fef","targetId":"b-92b0b394d2f55c52f8083fef","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","afterSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","reason":"Same source body in authored semantic page"},{"oldId":"b-c4bf3ae6b73df89cec765477","targetId":"b-c4bf3ae6b73df89cec765477","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"82b0307b43c8cddb155ab734b455a3c609cccce306763fc343f8f307d12514e6","afterSHA256":"82b0307b43c8cddb155ab734b455a3c609cccce306763fc343f8f307d12514e6","reason":"Same source body in authored semantic page"},{"oldId":"b-0e416050110e395e1640e997","targetId":"b-0e416050110e395e1640e997","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","afterSHA256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","reason":"Same source body in authored semantic page"},{"oldId":"b-20fcf2f3c6ea404ddaf60d36","targetId":"b-20fcf2f3c6ea404ddaf60d36","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"711476480ec133395b21df180bd636ee23f2bbadb824a8b86b98e5ef137bbc05","afterSHA256":"2c33ed1b8fda6746ae8bf439c0b94c370add166d4657cf402a15f011260dcb98","reason":"Same source body in authored semantic page"},{"oldId":"b-ad1991d09ecb72ac795a2d6a","targetId":"b-ad1991d09ecb72ac795a2d6a","page":"reading-block-be0ffb282ff049c88a51c23102954748","operation":"move","beforeSHA256":"db2bdb45c723abbab96b923ef260c66f315cb6bae806a52d4fb00cfade18367b","afterSHA256":"db2bdb45c723abbab96b923ef260c66f315cb6bae806a52d4fb00cfade18367b","reason":"Same source body in authored semantic page"},{"oldId":"b-a279a0199ad583bead412939","targetId":"b-a279a0199ad583bead412939","page":"reading-block-9c0f03efa4584e448eebaf416a492370","operation":"move","beforeSHA256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","afterSHA256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","reason":"Same source body in authored semantic page"},{"oldId":"b-eb5878bf56a39395bd829be7","targetId":"b-eb5878bf56a39395bd829be7","page":"reading-block-9c0f03efa4584e448eebaf416a492370","operation":"move","beforeSHA256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","afterSHA256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","reason":"Same source body in authored semantic page"},{"oldId":"block-b800ace904634fa1923a4a15bf3725cc--一个点为什么不总能确定一个对象","targetId":"b-2a6796dfcb9c3ddc26f5a4fe","operation":"retain-source-identity"},{"oldId":"block-be0ffb282ff049c88a51c23102954748--已完成的基准运行","targetId":"b-7a800f71f43535d913ca965a","operation":"retain-source-identity"}],"blocks":[{"id":"b-54dd3d9814b168008345d4d8","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-54dd3d9814b168008345d4d8","content":"# LAB 16 · 点、框与负提示：分割规则基线","sha256":"b6ce61c6e156018e106c686d26fe795a47372383d0ae6a4fdc86935a49de3f8e","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-75f58f9512f038b43545a78d","prerequisites":[{"id":"b-75f58f9512f038b43545a78d","url":"#b-75f58f9512f038b43545a78d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-75f58f9512f038b43545a78d","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-75f58f9512f038b43545a78d","content":"按问题继续","sha256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-54dd3d9814b168008345d4d8","nextBlock":"b-dcae3180d418000961102353","prerequisites":[{"id":"b-54dd3d9814b168008345d4d8","url":"#b-54dd3d9814b168008345d4d8","role":"section-title"}],"relatedBlocks":[]},{"id":"b-dcae3180d418000961102353","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-dcae3180d418000961102353","content":"像素连通域、正负点/框提示、局部/整体多义性","sha256":"7d1e7531a3ac0397d25516d56db48a938b043ef98467022f8eacc41563e73771","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-75f58f9512f038b43545a78d","nextBlock":"b-d08ca56b490e208a4cf82440","prerequisites":[{"id":"b-54dd3d9814b168008345d4d8","url":"#b-54dd3d9814b168008345d4d8","role":"section-title"},{"id":"b-75f58f9512f038b43545a78d","url":"#b-75f58f9512f038b43545a78d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d08ca56b490e208a4cf82440","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-d08ca56b490e208a4cf82440","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-opening","title":"LAB 16 · 点、框与负提示：分割规则基线","number":1},"sectionTitle":"LAB 16 · 点、框与负提示：分割规则基线","currentQuestion":"LAB 16 · 点、框与负提示：分割规则基线","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-dcae3180d418000961102353","nextBlock":null,"prerequisites":[{"id":"b-54dd3d9814b168008345d4d8","url":"#b-54dd3d9814b168008345d4d8","role":"section-title"},{"id":"b-75f58f9512f038b43545a78d","url":"#b-75f58f9512f038b43545a78d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-19fddca512a7c28bfc6c557f","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-19fddca512a7c28bfc6c557f","content":"**学习路径：** [像素、边界与对象身份](/course/study/pixels-instances.html) · [一句话指向哪个对象](/course/study/grounding-interface.html)。两个入口引用同一份现有材料，不需要重复阅读或运行。","sha256":"8136302808d723830a6ba6a259cf82af97e54050121c970153d78ecc870b421f","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-b8efd5f328c5b1f895e4db0e","prerequisites":[],"relatedBlocks":[]},{"id":"b-b8efd5f328c5b1f895e4db0e","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-b8efd5f328c5b1f895e4db0e","content":"这是 [P46–47 提示式分割](/course/pages/l3-r2-p46.html) 的按需短练习，不是 SAM 权重实验。输入同一张 RGB 图、一个正点及可选负点/框，颜色距离与连通域规则返回 mask；没有参数训练。","sha256":"9c0b5b608b7d92a8588ddc48df0098457f71ce66b1f8310d062d0f92b102dde9","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-19fddca512a7c28bfc6c557f","nextBlock":"b-057396fe76e56e0328c6e665","prerequisites":[{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-057396fe76e56e0328c6e665","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-057396fe76e56e0328c6e665","content":"先看 [四种已保存输出](/course/blocks/sam-rule-baseline-explained.html)，再只改一种条件：颜色容差、负点或框。记录返回面积或边界怎样改变，说明变化来自增加的提示信息还是规则本身的假设。","sha256":"41385584a846db379d8a5d01e76c8a3d1de90a9a397c99580485fb6bded77068","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b8efd5f328c5b1f895e4db0e","nextBlock":"b-415a447b8414b89c98862025","prerequisites":[{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-415a447b8414b89c98862025","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-415a447b8414b89c98862025","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":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-057396fe76e56e0328c6e665","nextBlock":"b-2a6796dfcb9c3ddc26f5a4fe","prerequisites":[{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-2a6796dfcb9c3ddc26f5a4fe","type":"h2","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-2a6796dfcb9c3ddc26f5a4fe","content":"## 一个点为什么不总能确定一个对象","sha256":"cdac7adfd7d8031b3ebe95ecccbf930b13ac315a768a3a7c6daa50ac75fa7b82","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-415a447b8414b89c98862025","nextBlock":"b-d4a0c628e833d4519c8157b7","prerequisites":[{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d4a0c628e833d4519c8157b7","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-d4a0c628e833d4519c8157b7","content":"输入是自行绘制的 48×64 RGB 图像：相邻的红色外壳和深红色内部零件，另有蓝色物体。正点、负点和矩形是使用者给出的条件，而非正确 mask。本例使用颜色距离与连通域的确定性算法，完整读入像素并返回 mask；它不训练，也不是 SAM。我们保留原来的“同一点同时落在局部和整体”例子，但现在实际改变提示和阈值，检查返回区域。","sha256":"e8e5c33f86ffb10330885561396ba91d07c1e81ecf7064aa9a57f3fdb357abda","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-2a6796dfcb9c3ddc26f5a4fe","nextBlock":"b-0390357281a0ffc9c9c908b8","prerequisites":[{"id":"b-2a6796dfcb9c3ddc26f5a4fe","url":"#b-2a6796dfcb9c3ddc26f5a4fe","role":"section-title"},{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0390357281a0ffc9c9c908b8","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-0390357281a0ffc9c9c908b8","content":"先预测：扩大颜色容差，正点的连通区域会增加还是减少？增加落在外壳上的负点会如何影响结果？负点在此算法中添加的是颜色排除规则，与 SAM 学到的提示编码不同。","sha256":"ac1e6be4afbbc5b47a295bd60863ed813559de54ac398a0528821f7e589dccd8","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-d4a0c628e833d4519c8157b7","nextBlock":"b-81d43df6fc004ae40500d78a","prerequisites":[{"id":"b-2a6796dfcb9c3ddc26f5a4fe","url":"#b-2a6796dfcb9c3ddc26f5a4fe","role":"section-title"},{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-81d43df6fc004ae40500d78a","type":"p","scope":"block-b800ace904634fa1923a4a15bf3725cc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-81d43df6fc004ae40500d78a","content":"[本册算法与四项已保存输出](/course/blocks/sam-rule-baseline-explained.html) · [SAM 的能力实际怎样训练出来](/course/blocks/sam-task-training.html)","sha256":"0ed5a76ed92c58fa9993c8c7e1a0faa75760c6a72a548a11f44b035d87a7b8ca","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0390357281a0ffc9c9c908b8","nextBlock":"b-cccbd244a6a86b1b49f6af28","prerequisites":[{"id":"b-2a6796dfcb9c3ddc26f5a4fe","url":"#b-2a6796dfcb9c3ddc26f5a4fe","role":"section-title"},{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-cccbd244a6a86b1b49f6af28","type":"pre","scope":"block-a938e2aaafcf413d96db608c3cb1cfbc","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-cccbd244a6a86b1b49f6af28","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":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-b800ace904634fa1923a4a15bf3725cc","title":"一个点为什么不总能确定一个对象","number":2},"sectionTitle":"一个点为什么不总能确定一个对象","currentQuestion":"一个点为什么不总能确定一个对象","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-81d43df6fc004ae40500d78a","nextBlock":null,"prerequisites":[{"id":"b-2a6796dfcb9c3ddc26f5a4fe","url":"#b-2a6796dfcb9c3ddc26f5a4fe","role":"section-title"},{"id":"b-19fddca512a7c28bfc6c557f","url":"#b-19fddca512a7c28bfc6c557f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-7a800f71f43535d913ca965a","type":"h2","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-7a800f71f43535d913ca965a","content":"## 已完成的基准运行","sha256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-92b0b394d2f55c52f8083fef","prerequisites":[{"id":"b-92b0b394d2f55c52f8083fef","url":"#b-92b0b394d2f55c52f8083fef","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-92b0b394d2f55c52f8083fef","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-92b0b394d2f55c52f8083fef","content":"以下是本轮本地独立 Python 进程的实际标准输出，云端执行另行记录。","sha256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7a800f71f43535d913ca965a","nextBlock":"b-c4bf3ae6b73df89cec765477","prerequisites":[{"id":"b-7a800f71f43535d913ca965a","url":"#b-7a800f71f43535d913ca965a","role":"section-title"}],"relatedBlocks":[]},{"id":"b-c4bf3ae6b73df89cec765477","type":"pre","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-c4bf3ae6b73df89cec765477","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":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-92b0b394d2f55c52f8083fef","nextBlock":"b-0e416050110e395e1640e997","prerequisites":[{"id":"b-7a800f71f43535d913ca965a","url":"#b-7a800f71f43535d913ca965a","role":"section-title"},{"id":"b-92b0b394d2f55c52f8083fef","url":"#b-92b0b394d2f55c52f8083fef","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0e416050110e395e1640e997","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-0e416050110e395e1640e997","content":"紧容差只保留内部 110 像素；宽容差合并到 837 像素外壳。负点回到 110，框则保留框内相连部分。这说明提示与算法假设共同决定输出，框还可能截断对象。","sha256":"5fe00ef16a7580ec79cf3431264ea1d7e40854c847ce32a509ced516183a13d4","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c4bf3ae6b73df89cec765477","nextBlock":"b-20fcf2f3c6ea404ddaf60d36","prerequisites":[{"id":"b-7a800f71f43535d913ca965a","url":"#b-7a800f71f43535d913ca965a","role":"section-title"},{"id":"b-92b0b394d2f55c52f8083fef","url":"#b-92b0b394d2f55c52f8083fef","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-20fcf2f3c6ea404ddaf60d36","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-20fcf2f3c6ea404ddaf60d36","content":"![同一RGB输入的四种提示结果](/assets/display/4a9a30188e394075dc0e66fa.webp)","sha256":"2c33ed1b8fda6746ae8bf439c0b94c370add166d4657cf402a15f011260dcb98","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0e416050110e395e1640e997","nextBlock":"b-ad1991d09ecb72ac795a2d6a","prerequisites":[{"id":"b-7a800f71f43535d913ca965a","url":"#b-7a800f71f43535d913ca965a","role":"section-title"},{"id":"b-92b0b394d2f55c52f8083fef","url":"#b-92b0b394d2f55c52f8083fef","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ad1991d09ecb72ac795a2d6a","type":"p","scope":"block-be0ffb282ff049c88a51c23102954748","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-ad1991d09ecb72ac795a2d6a","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":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-be0ffb282ff049c88a51c23102954748","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-20fcf2f3c6ea404ddaf60d36","nextBlock":null,"prerequisites":[{"id":"b-7a800f71f43535d913ca965a","url":"#b-7a800f71f43535d913ca965a","role":"section-title"},{"id":"b-92b0b394d2f55c52f8083fef","url":"#b-92b0b394d2f55c52f8083fef","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9685f61410261a7bdea3115c","type":"h4","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-9685f61410261a7bdea3115c","content":"#### 不运行也能检查：一个点包含在两个区域中","sha256":"706a2aba84ea474b40578db0a0d75f0b0314e8b62718b8c641531e5be4d19851","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-a279a0199ad583bead412939","prerequisites":[{"id":"b-a279a0199ad583bead412939","url":"#b-a279a0199ad583bead412939","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a279a0199ad583bead412939","type":"p","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-a279a0199ad583bead412939","content":"在 8×8 网格里，让局部区域为行列 2–3 的四个格子，整体区域为行列 1–6 的 36 个格子。点 (2,2) 同时属于两者，所以“包含正点”无法唯一规定目标。当前上方 RGB 实验进一步用容差、负点和框实际选择区域。","sha256":"e5d6881bfe6ca5f78e69b4684e7286faee6cfbd7c293009d7481270a760cb1d7","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9685f61410261a7bdea3115c","nextBlock":"b-eb5878bf56a39395bd829be7","prerequisites":[{"id":"b-9685f61410261a7bdea3115c","url":"#b-9685f61410261a7bdea3115c","role":"section-title"}],"relatedBlocks":[]},{"id":"b-eb5878bf56a39395bd829be7","type":"p","scope":"block-9c0f03efa4584e448eebaf416a492370","url":"https://codingai-lec03.pages.dev/course/lab16-提示式分割.html#b-eb5878bf56a39395bd829be7","content":"[从这一歧义读回提示式分割接口](/course/blocks/sam-prompt-contract.html)。","sha256":"2e7c4e25ece7e1aef19a7bc04edd43676da7f5d55a209fcc5c0ac1143976e378","chapter":{"id":"course","title":"LAB 16 · 点、框与负提示：分割规则基线"},"unit":{"id":"lab16-提示式分割","title":"LAB 16 · 点、框与负提示：分割规则基线"},"page":{"id":"reading-block-9c0f03efa4584e448eebaf416a492370","title":"不运行也能检查：一个点包含在两个区域中","number":4},"sectionTitle":"不运行也能检查：一个点包含在两个区域中","currentQuestion":"不运行也能检查：一个点包含在两个区域中","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a279a0199ad583bead412939","nextBlock":null,"prerequisites":[{"id":"b-9685f61410261a7bdea3115c","url":"#b-9685f61410261a7bdea3115c","role":"section-title"},{"id":"b-a279a0199ad583bead412939","url":"#b-a279a0199ad583bead412939","role":"problem-context"}],"relatedBlocks":[]}]}
