{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 20 · 尺度跨度与两对象匹配","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html","markdown":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.md","pages":[{"id":"reading-opening","title":"LAB 20 · 尺度跨度与两对象匹配","unit":"LAB 20 · 尺度跨度与两对象匹配","unitId":"lab23-尺度与集合输出","chapter":"course","number":1},{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","unit":"LAB 20 · 尺度跨度与两对象匹配","unitId":"lab23-尺度与集合输出","chapter":"course","number":2},{"id":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","title":"已完成的基准运行","unit":"LAB 20 · 尺度跨度与两对象匹配","unitId":"lab23-尺度与集合输出","chapter":"course","number":3},{"id":"reading-block-043de8a70dd54f4c88bdb062e0590d04","title":"先心算一个更小的匹配例","unit":"LAB 20 · 尺度跨度与两对象匹配","unitId":"lab23-尺度与集合输出","chapter":"course","number":4}],"aliases":[{"oldId":"b-97dec1de70a4429b0f84dc94","targetId":"b-97dec1de70a4429b0f84dc94","operation":"historical-explanation","sourceScope":"block-043de8a70dd54f4c88bdb062e0590d04"},{"oldId":"b-c2b0a2c0f82c78cf91001393","targetId":"b-c2b0a2c0f82c78cf91001393","operation":"historical-explanation","sourceScope":"block-043de8a70dd54f4c88bdb062e0590d04"},{"oldId":"b-636453598e9de461b37628b3","targetId":"b-636453598e9de461b37628b3","operation":"historical-explanation","sourceScope":"block-043de8a70dd54f4c88bdb062e0590d04"},{"oldId":"b-7852b5b7b623484f72d56fd9","targetId":"b-7852b5b7b623484f72d56fd9","operation":"historical-explanation","sourceScope":"block-043de8a70dd54f4c88bdb062e0590d04"},{"oldId":"b-34898cca72f9c4dfb80c38f0","targetId":"b-34898cca72f9c4dfb80c38f0","page":"reading-opening","operation":"move","beforeSHA256":"251aae49aa098c04135afd9ef48adad0d3abb9a0daec7e8be740034198648a40","afterSHA256":"251aae49aa098c04135afd9ef48adad0d3abb9a0daec7e8be740034198648a40","reason":"Same source body in authored semantic page"},{"oldId":"b-8257c1f5c31b538bfeb5d6f5","targetId":"b-8257c1f5c31b538bfeb5d6f5","page":"reading-opening","operation":"move","beforeSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","afterSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","reason":"Same source body in authored semantic page"},{"oldId":"b-7ad6cdb63fbeb07760d520fc","targetId":"b-7ad6cdb63fbeb07760d520fc","page":"reading-opening","operation":"move","beforeSHA256":"1d7535d0c02cc7bae4e9740472c8fa2e46f9a3b9067705762875bccfe9114541","afterSHA256":"1d7535d0c02cc7bae4e9740472c8fa2e46f9a3b9067705762875bccfe9114541","reason":"Same source body in authored semantic page"},{"oldId":"b-595bb6721cd008c229527133","targetId":"b-595bb6721cd008c229527133","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-712c1ccd2fb57ebf309cbcb9","targetId":"b-712c1ccd2fb57ebf309cbcb9","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"034b6112f93c03c81cf131a48ede9fb578c84ff87acad274fbb654923f4ba12b","afterSHA256":"034b6112f93c03c81cf131a48ede9fb578c84ff87acad274fbb654923f4ba12b","reason":"Same source body in authored semantic page"},{"oldId":"b-479ef311e664230e2c651e18","targetId":"b-479ef311e664230e2c651e18","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"2b01e3b98f6d8017e99d0668ce6dcd1b33ac5481049671a08714a8005c960020","afterSHA256":"2b01e3b98f6d8017e99d0668ce6dcd1b33ac5481049671a08714a8005c960020","reason":"Same source body in authored semantic page"},{"oldId":"b-8f6ffc543ab2341b55270bc8","targetId":"b-8f6ffc543ab2341b55270bc8","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"07039c013b314ff21a0cade9ba5bb95efb8a50f7883f7706f75ef2794d177855","afterSHA256":"07039c013b314ff21a0cade9ba5bb95efb8a50f7883f7706f75ef2794d177855","reason":"Same source body in authored semantic page"},{"oldId":"b-06c438907888afd5514a1813","targetId":"b-06c438907888afd5514a1813","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"933fb07ec46fa465c33aff50bfb9969547b90d30ed8775d71768acd5290079dc","afterSHA256":"933fb07ec46fa465c33aff50bfb9969547b90d30ed8775d71768acd5290079dc","reason":"Same source body in authored semantic page"},{"oldId":"b-9ff9e9055f2ed20ad252911c","targetId":"b-9ff9e9055f2ed20ad252911c","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"89ab347c49c038f4fc87d04e6c621a44d1d385ecb10882358138acdc8c892309","afterSHA256":"89ab347c49c038f4fc87d04e6c621a44d1d385ecb10882358138acdc8c892309","reason":"Same source body in authored semantic page"},{"oldId":"b-2c683d934ab4da88d101e059","targetId":"b-2c683d934ab4da88d101e059","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"f7ba3349d6be423fd7ddd5c14a7622396e705783715f61b4536d5c42f254403e","afterSHA256":"f7ba3349d6be423fd7ddd5c14a7622396e705783715f61b4536d5c42f254403e","reason":"Same source body in authored semantic page"},{"oldId":"b-a02e83017ee64d50d5be3f1f","targetId":"b-a02e83017ee64d50d5be3f1f","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"ff0896feb96cdd255b1dfd2ba91d1734d56b3c3376ae877d50718e3060e83b61","afterSHA256":"ff0896feb96cdd255b1dfd2ba91d1734d56b3c3376ae877d50718e3060e83b61","reason":"Same source body in authored semantic page"},{"oldId":"b-e4042dd86658c598324589c7","targetId":"b-e4042dd86658c598324589c7","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"cb255c1d61af05f31fd9fddf08e3c4cf45908c203ad789411dbe34ebde2c8c42","afterSHA256":"cb255c1d61af05f31fd9fddf08e3c4cf45908c203ad789411dbe34ebde2c8c42","reason":"Same source body in authored semantic page"},{"oldId":"b-27cf520ac489798198ef1b70","targetId":"b-27cf520ac489798198ef1b70","page":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","operation":"move","beforeSHA256":"5714c01e6f12168c1ae96d2c020af303805871c916cd8e924051dbea3aa808d3","afterSHA256":"5714c01e6f12168c1ae96d2c020af303805871c916cd8e924051dbea3aa808d3","reason":"Same source body in authored semantic page"},{"oldId":"b-c59f3115bc6a6d34d0a575bb","targetId":"b-c59f3115bc6a6d34d0a575bb","page":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","operation":"move","beforeSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","afterSHA256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","reason":"Same source body in authored semantic page"},{"oldId":"b-26dcb4fa251ffdcada4ceee5","targetId":"b-26dcb4fa251ffdcada4ceee5","page":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","operation":"move","beforeSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","afterSHA256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","reason":"Same source body in authored semantic page"},{"oldId":"b-bdcbc4eeb8d88e4feceefdfa","targetId":"b-bdcbc4eeb8d88e4feceefdfa","page":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","operation":"move","beforeSHA256":"4a2587c0973bf49253d61d71eec489a36a70abfc8ffbffd2a57326b581057eec","afterSHA256":"4a2587c0973bf49253d61d71eec489a36a70abfc8ffbffd2a57326b581057eec","reason":"Same source body in authored semantic page"},{"oldId":"b-bee50b3d4594d9132b71c39d","targetId":"b-bee50b3d4594d9132b71c39d","page":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","operation":"move","beforeSHA256":"3345c147cd1b8dab6fc43a257359dc025f3ed9429ffcebb6023d87182e31c3b9","afterSHA256":"3345c147cd1b8dab6fc43a257359dc025f3ed9429ffcebb6023d87182e31c3b9","reason":"Same source body in authored semantic page"},{"oldId":"b-93579220af0ff9d843b74995","targetId":"b-93579220af0ff9d843b74995","page":"reading-block-043de8a70dd54f4c88bdb062e0590d04","operation":"move","beforeSHA256":"4d6802ddf08a4df32d9fbf0dac61145b5fdd301efbc6f85b7fa8a14dd11546cf","afterSHA256":"4d6802ddf08a4df32d9fbf0dac61145b5fdd301efbc6f85b7fa8a14dd11546cf","reason":"Same source body in authored semantic page"},{"oldId":"b-46c99cb478d9d9ed24f857b6","targetId":"b-46c99cb478d9d9ed24f857b6","page":"reading-block-043de8a70dd54f4c88bdb062e0590d04","operation":"move","beforeSHA256":"1c81be1097bb47b6650329d503f951f0b2d053186a97e6dc796a85af82073191","afterSHA256":"1c81be1097bb47b6650329d503f951f0b2d053186a97e6dc796a85af82073191","reason":"Same source body in authored semantic page"},{"oldId":"block-6ab1753a596940e5aceba3b7dd7537c5--同一组对象换了排列损失不该凭空变大","targetId":"b-9ff9e9055f2ed20ad252911c","operation":"retain-source-identity"},{"oldId":"block-3cdc52c2a4254fcebc30f166d5043b8f--已完成的基准运行","targetId":"b-c59f3115bc6a6d34d0a575bb","operation":"retain-source-identity"}],"blocks":[{"id":"b-34898cca72f9c4dfb80c38f0","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-34898cca72f9c4dfb80c38f0","content":"# LAB 20 · 尺度跨度与两对象匹配","sha256":"251aae49aa098c04135afd9ef48adad0d3abb9a0daec7e8be740034198648a40","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-opening","title":"LAB 20 · 尺度跨度与两对象匹配","number":1},"sectionTitle":"LAB 20 · 尺度跨度与两对象匹配","currentQuestion":"LAB 20 · 尺度跨度与两对象匹配","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-8257c1f5c31b538bfeb5d6f5","prerequisites":[{"id":"b-8257c1f5c31b538bfeb5d6f5","url":"#b-8257c1f5c31b538bfeb5d6f5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8257c1f5c31b538bfeb5d6f5","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-8257c1f5c31b538bfeb5d6f5","content":"按问题继续","sha256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-opening","title":"LAB 20 · 尺度跨度与两对象匹配","number":1},"sectionTitle":"LAB 20 · 尺度跨度与两对象匹配","currentQuestion":"LAB 20 · 尺度跨度与两对象匹配","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-34898cca72f9c4dfb80c38f0","nextBlock":"b-7ad6cdb63fbeb07760d520fc","prerequisites":[{"id":"b-34898cca72f9c4dfb80c38f0","url":"#b-34898cca72f9c4dfb80c38f0","role":"section-title"}],"relatedBlocks":[]},{"id":"b-7ad6cdb63fbeb07760d520fc","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-7ad6cdb63fbeb07760d520fc","content":"步幅占格、两对象排列、分类/位置/IoU联合匹配代价","sha256":"1d7535d0c02cc7bae4e9740472c8fa2e46f9a3b9067705762875bccfe9114541","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-opening","title":"LAB 20 · 尺度跨度与两对象匹配","number":1},"sectionTitle":"LAB 20 · 尺度跨度与两对象匹配","currentQuestion":"LAB 20 · 尺度跨度与两对象匹配","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8257c1f5c31b538bfeb5d6f5","nextBlock":"b-595bb6721cd008c229527133","prerequisites":[{"id":"b-34898cca72f9c4dfb80c38f0","url":"#b-34898cca72f9c4dfb80c38f0","role":"section-title"},{"id":"b-8257c1f5c31b538bfeb5d6f5","url":"#b-8257c1f5c31b538bfeb5d6f5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-595bb6721cd008c229527133","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-595bb6721cd008c229527133","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-opening","title":"LAB 20 · 尺度跨度与两对象匹配","number":1},"sectionTitle":"LAB 20 · 尺度跨度与两对象匹配","currentQuestion":"LAB 20 · 尺度跨度与两对象匹配","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7ad6cdb63fbeb07760d520fc","nextBlock":null,"prerequisites":[{"id":"b-34898cca72f9c4dfb80c38f0","url":"#b-34898cca72f9c4dfb80c38f0","role":"section-title"},{"id":"b-8257c1f5c31b538bfeb5d6f5","url":"#b-8257c1f5c31b538bfeb5d6f5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-712c1ccd2fb57ebf309cbcb9","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-712c1ccd2fb57ebf309cbcb9","content":"**学习路径：** [一张图怎样变成一组框](/course/study/image-detection.html) · [像素、边界与对象身份](/course/study/pixels-instances.html)。两个入口引用同一份现有材料，不需要重复阅读或运行。","sha256":"034b6112f93c03c81cf131a48ede9fb578c84ff87acad274fbb654923f4ba12b","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-479ef311e664230e2c651e18","prerequisites":[],"relatedBlocks":[]},{"id":"b-479ef311e664230e2c651e18","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-479ef311e664230e2c651e18","content":"本册只回答两个选读问题，不是 DETR 训练实验。看 [P38 的多尺度表示](/course/pages/l3-r2-p38.html) 时，可查目标在 stride 4/8/16/32 网格中的跨度；看 [P39 的对象身份](/course/pages/l3-r2-p39.html) 时，可查无序对象如何对应。","sha256":"2b01e3b98f6d8017e99d0668ce6dcd1b33ac5481049671a08714a8005c960020","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-712c1ccd2fb57ebf309cbcb9","nextBlock":"b-8f6ffc543ab2341b55270bc8","prerequisites":[{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8f6ffc543ab2341b55270bc8","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-8f6ffc543ab2341b55270bc8","content":"先看 [尺度跨度](/course/blocks/multiscale-architecture-comparison.html) 或 [由框与概率计算匹配](/course/blocks/set-matching-real-inputs.html)，再修改对应条件。匹配用类别概率、框 L1 与 IoU 构造代价，再穷举两个对象的排列；跨度和匹配解决不同问题。","sha256":"07039c013b314ff21a0cade9ba5bb95efb8a50f7883f7706f75ef2794d177855","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-479ef311e664230e2c651e18","nextBlock":"b-06c438907888afd5514a1813","prerequisites":[{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-06c438907888afd5514a1813","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-06c438907888afd5514a1813","content":"产出一个判断：交换预测槽顺序后，最小总成本是否不变？为什么小于一格不等于信息必定消失？读完回到 [CLS 08](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/2d81e2a1936043349eacb71c53c0defa)；完整图像到框学习另见 [LAB 10](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/a14237bfa9dd413d959ab4e458e11f42)。","sha256":"933fb07ec46fa465c33aff50bfb9969547b90d30ed8775d71768acd5290079dc","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8f6ffc543ab2341b55270bc8","nextBlock":"b-9ff9e9055f2ed20ad252911c","prerequisites":[{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9ff9e9055f2ed20ad252911c","type":"h2","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-9ff9e9055f2ed20ad252911c","content":"## 同一组对象换了排列，损失不该凭空变大","sha256":"89ab347c49c038f4fc87d04e6c621a44d1d385ecb10882358138acdc8c892309","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-06c438907888afd5514a1813","nextBlock":"b-2c683d934ab4da88d101e059","prerequisites":[{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-2c683d934ab4da88d101e059","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-2c683d934ab4da88d101e059","content":"检测输出是对象集合。两个预测slot与两个真值框没有天然同序关系。本例从类别概率、归一化框L1距离与IoU构造成本 Cᵢⱼ=−log pᵢ(cⱼ)+2||bᵢ−gⱼ||₁+(1−IoU)，穷举2!种排列得到最小匹配。系数是教学设定；DETR常用的分类/L1/GIoU组合须按实际实现区分。","sha256":"f7ba3349d6be423fd7ddd5c14a7622396e705783715f61b4536d5c42f254403e","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9ff9e9055f2ed20ad252911c","nextBlock":"b-a02e83017ee64d50d5be3f1f","prerequisites":[{"id":"b-9ff9e9055f2ed20ad252911c","url":"#b-9ff9e9055f2ed20ad252911c","role":"section-title"},{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a02e83017ee64d50d5be3f1f","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-a02e83017ee64d50d5be3f1f","content":"前置尺度算例记录16px目标在stride4/8/16/32上对应的连续跨度4/2/1/0.5格，不把0.5格误说为必定完全消失。FPN负责多尺度表示；二分匹配负责输出对应，两者不能相互替代。","sha256":"ff0896feb96cdd255b1dfd2ba91d1734d56b3c3376ae877d50718e3060e83b61","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-2c683d934ab4da88d101e059","nextBlock":"b-e4042dd86658c598324589c7","prerequisites":[{"id":"b-9ff9e9055f2ed20ad252911c","url":"#b-9ff9e9055f2ed20ad252911c","role":"section-title"},{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e4042dd86658c598324589c7","type":"p","scope":"block-6ab1753a596940e5aceba3b7dd7537c5","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-e4042dd86658c598324589c7","content":"本册没有图像编码器或参数训练；真实图像到框的完整链在 [LAB 10](https://deepnote.com/workspace/ise3309jingao-5ba66b0a-4283-4f5a-ae06-3f68d3201e99/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/a14237bfa9dd413d959ab4e458e11f42?utm_source=openai&utm_medium=mcp&utm_campaign=openaimcp&utm_content=a14237bfa9dd413d959ab4e458e11f42&utm_term=get_notebook)。","sha256":"cb255c1d61af05f31fd9fddf08e3c4cf45908c203ad789411dbe34ebde2c8c42","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a02e83017ee64d50d5be3f1f","nextBlock":"b-27cf520ac489798198ef1b70","prerequisites":[{"id":"b-9ff9e9055f2ed20ad252911c","url":"#b-9ff9e9055f2ed20ad252911c","role":"section-title"},{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-27cf520ac489798198ef1b70","type":"pre","scope":"block-0f45eba379c5437685bb52cf7ae38a2d","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-27cf520ac489798198ef1b70","content":"```\n# Writable ephemeral workspace for detached readonly cloud runs.\nimport os, tempfile\nos.chdir(tempfile.mkdtemp(prefix='lec03_lab23_'))\n\nimport numpy as np\nfrom itertools import permutations\nboxes=np.array([[.61,.12,.91,.43],[.08,.10,.32,.40]])\ntruth=np.array([[.10,.10,.35,.42],[.60,.10,.90,.45]])\nprob=np.array([[.15,.85],[.9,.1]]); labels=np.array([0,1])\ndef iou(a,b):\n    wh=np.maximum(0,np.minimum(a[2:],b[2:])-np.maximum(a[:2],b[:2])); inter=wh.prod()\n    return inter/(np.prod(a[2:]-a[:2])+np.prod(b[2:]-b[:2])-inter)\nC=np.array([[-np.log(prob[i,labels[j]])+2*abs(boxes[i]-truth[j]).sum()+1-iou(boxes[i],truth[j]) for j in range(2)] for i in range(2)])\ncosts={str(p):sum(C[i,j] for i,j in enumerate(p)) for p in permutations(range(2))}\nprint('cost matrix',C.round(4).tolist(),'assignment costs',costs,'selected',min(costs,key=costs.get))\nassert min(costs,key=costs.get)=='(1, 0)'\nfor stride in [4,8,16,32]: print('stride',stride,'target span',16/stride,'cells')\nprint('with 3 predictions/2 targets, unmatched slot needs no-object classification, not an invented third target')\n```","sha256":"5714c01e6f12168c1ae96d2c020af303805871c916cd8e924051dbea3aa808d3","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-6ab1753a596940e5aceba3b7dd7537c5","title":"同一组对象换了排列，损失不该凭空变大","number":2},"sectionTitle":"同一组对象换了排列，损失不该凭空变大","currentQuestion":"同一组对象换了排列，损失不该凭空变大","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e4042dd86658c598324589c7","nextBlock":null,"prerequisites":[{"id":"b-9ff9e9055f2ed20ad252911c","url":"#b-9ff9e9055f2ed20ad252911c","role":"section-title"},{"id":"b-712c1ccd2fb57ebf309cbcb9","url":"#b-712c1ccd2fb57ebf309cbcb9","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c59f3115bc6a6d34d0a575bb","type":"h2","scope":"block-3cdc52c2a4254fcebc30f166d5043b8f","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-c59f3115bc6a6d34d0a575bb","content":"## 已完成的基准运行","sha256":"70efe3096d536ddf0d6f0f7335815da85d73017a47a0e52cac5d2621805a3c53","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-26dcb4fa251ffdcada4ceee5","prerequisites":[{"id":"b-26dcb4fa251ffdcada4ceee5","url":"#b-26dcb4fa251ffdcada4ceee5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-26dcb4fa251ffdcada4ceee5","type":"p","scope":"block-3cdc52c2a4254fcebc30f166d5043b8f","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-26dcb4fa251ffdcada4ceee5","content":"以下是本轮本地独立 Python 进程的实际标准输出，云端执行另行记录。","sha256":"ff4e2caa2efcd2a7e24e155ecad4f46e58bf2f1bb641ebcf47707b657cc53d56","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c59f3115bc6a6d34d0a575bb","nextBlock":"b-bdcbc4eeb8d88e4feceefdfa","prerequisites":[{"id":"b-c59f3115bc6a6d34d0a575bb","url":"#b-c59f3115bc6a6d34d0a575bb","role":"section-title"}],"relatedBlocks":[]},{"id":"b-bdcbc4eeb8d88e4feceefdfa","type":"pre","scope":"block-3cdc52c2a4254fcebc30f166d5043b8f","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-bdcbc4eeb8d88e4feceefdfa","content":"```\ncost matrix [[5.0971, 0.4509], [0.4779, 5.6026]] assignment costs {'(0, 1)': np.float64(10.699705077879926), '(1, 0)': np.float64(0.9288002118875242)} selected (1, 0)\nstride 4 target span 4.0 cells\nstride 8 target span 2.0 cells\nstride 16 target span 1.0 cells\nstride 32 target span 0.5 cells\nwith 3 predictions/2 targets, unmatched slot needs no-object classification, not an invented third target\n\n```","sha256":"4a2587c0973bf49253d61d71eec489a36a70abfc8ffbffd2a57326b581057eec","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-26dcb4fa251ffdcada4ceee5","nextBlock":"b-bee50b3d4594d9132b71c39d","prerequisites":[{"id":"b-c59f3115bc6a6d34d0a575bb","url":"#b-c59f3115bc6a6d34d0a575bb","role":"section-title"},{"id":"b-26dcb4fa251ffdcada4ceee5","url":"#b-26dcb4fa251ffdcada4ceee5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-bee50b3d4594d9132b71c39d","type":"p","scope":"block-3cdc52c2a4254fcebc30f166d5043b8f","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-bee50b3d4594d9132b71c39d","content":"本例左侧预测实际上来自slot1，因此交叉匹配便宜。只交换预测slot顺序，最小总成本应保持；固定按索引配对则会改变损失。若只有一个预测正确，匹配仍会选最低成本，但这并不意味着两物体均被成功检测。框损失、分类损失与评价是不同对象。[DETR官方matcher](https://github.com/facebookresearch/detr/blob/main/models/matcher.py)可对照这里的教学成本；LAB10展示从真实图像得到候选的前半条链。","sha256":"3345c147cd1b8dab6fc43a257359dc025f3ed9429ffcebb6023d87182e31c3b9","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-3cdc52c2a4254fcebc30f166d5043b8f","title":"已完成的基准运行","number":3},"sectionTitle":"已完成的基准运行","currentQuestion":"已完成的基准运行","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-bdcbc4eeb8d88e4feceefdfa","nextBlock":null,"prerequisites":[{"id":"b-c59f3115bc6a6d34d0a575bb","url":"#b-c59f3115bc6a6d34d0a575bb","role":"section-title"},{"id":"b-26dcb4fa251ffdcada4ceee5","url":"#b-26dcb4fa251ffdcada4ceee5","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4491cfb17ee7a528752df3a2","type":"h4","scope":"block-043de8a70dd54f4c88bdb062e0590d04","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-4491cfb17ee7a528752df3a2","content":"#### 先心算一个更小的匹配例","sha256":"8c9fea44e455c761cdd0ac37acf39c07bf0d125445ce3eabd871fcbbda2a49b2","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-043de8a70dd54f4c88bdb062e0590d04","title":"先心算一个更小的匹配例","number":4},"sectionTitle":"先心算一个更小的匹配例","currentQuestion":"先心算一个更小的匹配例","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-93579220af0ff9d843b74995","prerequisites":[{"id":"b-93579220af0ff9d843b74995","url":"#b-93579220af0ff9d843b74995","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-93579220af0ff9d843b74995","type":"p","scope":"block-043de8a70dd54f4c88bdb062e0590d04","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-93579220af0ff9d843b74995","content":"成本矩阵为 `[[1.2,.3],[.2,1.0]]`。按相同索引对应，总代价 2.2；交换对应，总代价 .5，因此选交叉。上方当前代码进一步从类别概率、真实坐标和 IoU 得到成本，说明这些数并非只能手填。","sha256":"4d6802ddf08a4df32d9fbf0dac61145b5fdd301efbc6f85b7fa8a14dd11546cf","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-043de8a70dd54f4c88bdb062e0590d04","title":"先心算一个更小的匹配例","number":4},"sectionTitle":"先心算一个更小的匹配例","currentQuestion":"先心算一个更小的匹配例","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4491cfb17ee7a528752df3a2","nextBlock":"b-46c99cb478d9d9ed24f857b6","prerequisites":[{"id":"b-4491cfb17ee7a528752df3a2","url":"#b-4491cfb17ee7a528752df3a2","role":"section-title"}],"relatedBlocks":[]},{"id":"b-46c99cb478d9d9ed24f857b6","type":"p","scope":"block-043de8a70dd54f4c88bdb062e0590d04","url":"https://codingai-lec03.pages.dev/course/lab23-尺度与集合输出.html#b-46c99cb478d9d9ed24f857b6","content":"想比较匹配与难例加权，读 [选读：难例权重和对象匹配不是一件事](/course/blocks/focal-versus-assignment.html)；两者解决不同问题。","sha256":"1c81be1097bb47b6650329d503f951f0b2d053186a97e6dc796a85af82073191","chapter":{"id":"course","title":"LAB 20 · 尺度跨度与两对象匹配"},"unit":{"id":"lab23-尺度与集合输出","title":"LAB 20 · 尺度跨度与两对象匹配"},"page":{"id":"reading-block-043de8a70dd54f4c88bdb062e0590d04","title":"先心算一个更小的匹配例","number":4},"sectionTitle":"先心算一个更小的匹配例","currentQuestion":"先心算一个更小的匹配例","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-93579220af0ff9d843b74995","nextBlock":null,"prerequisites":[{"id":"b-4491cfb17ee7a528752df3a2","url":"#b-4491cfb17ee7a528752df3a2","role":"section-title"},{"id":"b-93579220af0ff9d843b74995","url":"#b-93579220af0ff9d843b74995","role":"problem-context"}],"relatedBlocks":[]}]}
