Publish experiment f36f1e9e2bb64866b8d6c792db158635 (rollouts)
Browse filesFiles changed (29)
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/config/fbbcc99e90836229f20e40620bd7af775bea07b4625e31f68c90636c68247cc3/config.yamlAdded+52
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/3be63c0a2701dca49c3a360ea12261848646465890b6a305722652755dc46257/metrics.jsonAdded+24
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/6d734205017b3edef3ca0a5784d7924d863d2fc01ebb401bf9b57e1746bfe971/source_hashes.jsonAdded+58
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/c85fe2522b5782ba711eabff1c7f0c9e65b19a200d3e2bec8ea63d2f87d63ddd/priority_fps_seed_control.jsonAdded+2957
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/032dec668a404267774c947883f31b0bd87d6ff904cc5e95a8f9563decf75db9/priority_fps_seed_control.htmlAdded+15
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c/seed_priority_final_coverage.pngAdded
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/1861c0542f7cade5845cd7726d62f95879ff215e0979947dd7fe630f06994af9/execution_tests.logAdded+52
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/2a85e21142786e54bff67b4ce38cac8234f97f2581fe5fffcc8c13ae1e8331c5/git_start.diffAdded+259
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9/geometry.pyAdded+255
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/445926e3f65f60177f3fe874cfb0ecff38b9478aeaced65c96659d51d6294757/tests.logAdded+52
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed/sampling.pyAdded+266
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6/seed_initial_points.pngAdded
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b/report-56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b.zipAdded+3
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/57b59f80dc5e1d8936802b9ca2fb33c1e851ead6993917111985a8fae75ab542/verification.jsonAdded+63
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645/test_priority_fps_seed_control.pyAdded+244
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/707614a32fad479c78cb688b2fa021c83c338dfb08c760e5859d6b4650341ffd/report_snapshot.mdAdded+112
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827/run_priority_fps_seed_control.pyAdded+588
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627/shared_initial_overlay.pngAdded
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/799e3c2b5af5472a01f15ae7517e3df5ac64d993ff44ca65a9d67578862f4ee1/git_end.jsonAdded+9
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3/run_rim_bottleneck.pyAdded+342
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164/rgbd.pyAdded+202
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3/refresh_report.pyAdded+77
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d61d3b2801f95280a7ef2f088ad6d5ccc9a98c6873ac20eb6a3337ade2ccc057/implementation.patchAdded+1244
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b/sampling_evaluation.pyAdded+248
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26/run_priority_fps_seed_control.pyAdded+611
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b/run_priority_fps_trace.pyAdded+304
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f55bf1adddc81f3e56c2dfbad787980cd5ae5edc7dd4a019eb2a234f99dff1ee/git_start.jsonAdded
- visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496/shared_initial_coverage.pngAdded
- visual/f36f1e9e2bb64866b8d6c792db158635/manifests/644857c758c7c31d539cbb79e1ecfdcf24067e1df556582dba38843fc116213c/manifest.jsonAdded+209
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{ "additional_initial_sweeps": 0, "box_budget": 127, "candidate_normal_feature_recalculation": false, "device": "cpu", "frame": 0, "full_sampling_executed": false, "gpu_executed": false, "input_sha256": { "experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json": "330f451d1424ec05d237070443cd898f5f5b4f6118a1132cfcb06184075577e0", "experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json": "2a0346704763e2a5aca9ef3d52913699ced651501b031a8b1a49c57e6dcdfcff", "visual/data/step2/ep000.npz": "22ad72d776057da9ed5f85014cba47b4603e421623f29763c88edb159a5087ba", "visual/data/step2/segmentation_id_map.json": "ffd4cf9c568b4d3ef2cec161e22c9a49b78212ae0b43c43d763d1fa4bb1f0027", "visual/results/runtime_tracking/ep000/masks.npz": "6bf9555a9c97c83a09d9733e582e9c4b9509f95e9dd06854ba05d3ac25fb7042", "visual/results/runtime_tracking/ep000/tracking.json": "b78ba6064a610b77d8761e4d81fcff4660f1b5120854ec224c88b1e01017f40f", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json": "a88035aa821b879f1e6b87cf5b477af13f0d5858568ca0efa7c26c364894e94c", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json": "6df34b94fa8e513d8872c3259bfe5a3d60b5718875b80d1715e5f8b6522ebbe8", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz": "9f6d46356212bc43bd29ceb6df34c1a96ea70b3879f0bb4da2c6ccae535dd058" }, "matching_px_m": [ 2.0, 0.003 ], "methods": [ "S2", "S3" ], "num_points": 256, "numpy": "2.4.6", "orientation_threshold_deg": 20, "phase": 3, "phase1_run_id": "d3f14ee494894daabb8ba2fab8e1b00c", "phase2_run_id": "aa5d71078e0841fd886b5026d6030ebc", "priority_count": 32, "python": "3.11.13", "real_fps_calls_per_method": 1, "reference_count": 103, "simulator_executed": false, "source_run_id": "2551448b0fae4c6bbce3caf48774275f", "source_sha256": { "visual/runtime/geometry.py": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "visual/runtime/rgbd.py": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "visual/runtime/sampling.py": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "visual/runtime/test/run_priority_fps_seed_control.py": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "visual/runtime/test/run_priority_fps_trace.py": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "visual/runtime/test/run_rim_bottleneck.py": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "visual/runtime/test/sampling_evaluation.py": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "visual/runtime/test/test_priority_fps_seed_control.py": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645" }, "structural_ratio": 0.25, "task": "03-D"}123456789101112131415161718192021222324[ { "metrics": { "eval/task03d/saved/S2/saved_priority_seed0": 13, "eval/task03d/saved/S2/saved_priority_seed1": 7, "eval/task03d/saved/S2/saved_priority_seed2": 7, "eval/task03d/saved/S3/saved_priority_seed0": 3, "eval/task03d/saved/S3/saved_priority_seed1": 5, "eval/task03d/saved/S3/saved_priority_seed2": 3 }, "run_id": "f36f1e9e2bb64866b8d6c792db158635", "step": 0 }, { "metrics": { "eval/task03d/control/S2/priority_references": 8, "eval/task03d/control/S2/rim_matching_nodes": 3, "eval/task03d/control/S3/priority_references": 3, "eval/task03d/control/S3/rim_matching_nodes": 1 }, "run_id": "f36f1e9e2bb64866b8d6c792db158635", "step": 0 }]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758{ "diagnostic_sources": { "visual/runtime/geometry.py": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "visual/runtime/rgbd.py": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "visual/runtime/sampling.py": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "visual/runtime/test/run_priority_fps_seed_control.py": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "visual/runtime/test/run_priority_fps_trace.py": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "visual/runtime/test/run_rim_bottleneck.py": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "visual/runtime/test/sampling_evaluation.py": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "visual/runtime/test/test_priority_fps_seed_control.py": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645" }, "evaluated_fps": { "current_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "fps_candidate_allocation_ast_exact": true, "saved_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed" }, "executed_diagnostic_sources": { "visual/runtime/geometry.py": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "visual/runtime/rgbd.py": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "visual/runtime/sampling.py": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "visual/runtime/test/run_priority_fps_seed_control.py": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "visual/runtime/test/run_priority_fps_trace.py": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "visual/runtime/test/run_rim_bottleneck.py": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "visual/runtime/test/sampling_evaluation.py": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "visual/runtime/test/test_priority_fps_seed_control.py": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645" }, "inputs_after": { "experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json": "330f451d1424ec05d237070443cd898f5f5b4f6118a1132cfcb06184075577e0", "experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json": "2a0346704763e2a5aca9ef3d52913699ced651501b031a8b1a49c57e6dcdfcff", "visual/data/step2/ep000.npz": "22ad72d776057da9ed5f85014cba47b4603e421623f29763c88edb159a5087ba", "visual/data/step2/segmentation_id_map.json": "ffd4cf9c568b4d3ef2cec161e22c9a49b78212ae0b43c43d763d1fa4bb1f0027", "visual/results/runtime_tracking/ep000/masks.npz": "6bf9555a9c97c83a09d9733e582e9c4b9509f95e9dd06854ba05d3ac25fb7042", "visual/results/runtime_tracking/ep000/tracking.json": "b78ba6064a610b77d8761e4d81fcff4660f1b5120854ec224c88b1e01017f40f", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json": "a88035aa821b879f1e6b87cf5b477af13f0d5858568ca0efa7c26c364894e94c", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json": "6df34b94fa8e513d8872c3259bfe5a3d60b5718875b80d1715e5f8b6522ebbe8", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz": "9f6d46356212bc43bd29ceb6df34c1a96ea70b3879f0bb4da2c6ccae535dd058" }, "inputs_before": { "experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json": "330f451d1424ec05d237070443cd898f5f5b4f6118a1132cfcb06184075577e0", "experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json": "2a0346704763e2a5aca9ef3d52913699ced651501b031a8b1a49c57e6dcdfcff", "visual/data/step2/ep000.npz": "22ad72d776057da9ed5f85014cba47b4603e421623f29763c88edb159a5087ba", "visual/data/step2/segmentation_id_map.json": "ffd4cf9c568b4d3ef2cec161e22c9a49b78212ae0b43c43d763d1fa4bb1f0027", "visual/results/runtime_tracking/ep000/masks.npz": "6bf9555a9c97c83a09d9733e582e9c4b9509f95e9dd06854ba05d3ac25fb7042", "visual/results/runtime_tracking/ep000/tracking.json": "b78ba6064a610b77d8761e4d81fcff4660f1b5120854ec224c88b1e01017f40f", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json": "a88035aa821b879f1e6b87cf5b477af13f0d5858568ca0efa7c26c364894e94c", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json": "6df34b94fa8e513d8872c3259bfe5a3d60b5718875b80d1715e5f8b6522ebbe8", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz": "9f6d46356212bc43bd29ceb6df34c1a96ea70b3879f0bb4da2c6ccae535dd058" }, "original_preservation": { "all_sha256_unchanged": true, "protected_file_count": 1289, "status": "PASS" }, "report_generation_sources": { "experiments/f36f1e9e2bb64866b8d6c792db158635/refresh_report.py": "d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3", "visual/runtime/test/run_priority_fps_seed_control.py": "e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26" }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957{ "config": { "additional_initial_sweeps": 0, "box_budget": 127, "candidate_normal_feature_recalculation": false, "device": "cpu", "frame": 0, "full_sampling_executed": false, "gpu_executed": false, "input_sha256": { "experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json": "330f451d1424ec05d237070443cd898f5f5b4f6118a1132cfcb06184075577e0", "experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json": "2a0346704763e2a5aca9ef3d52913699ced651501b031a8b1a49c57e6dcdfcff", "visual/data/step2/ep000.npz": "22ad72d776057da9ed5f85014cba47b4603e421623f29763c88edb159a5087ba", "visual/data/step2/segmentation_id_map.json": "ffd4cf9c568b4d3ef2cec161e22c9a49b78212ae0b43c43d763d1fa4bb1f0027", "visual/results/runtime_tracking/ep000/masks.npz": "6bf9555a9c97c83a09d9733e582e9c4b9509f95e9dd06854ba05d3ac25fb7042", "visual/results/runtime_tracking/ep000/tracking.json": "b78ba6064a610b77d8761e4d81fcff4660f1b5120854ec224c88b1e01017f40f", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json": "a88035aa821b879f1e6b87cf5b477af13f0d5858568ca0efa7c26c364894e94c", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json": "6df34b94fa8e513d8872c3259bfe5a3d60b5718875b80d1715e5f8b6522ebbe8", "visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz": "9f6d46356212bc43bd29ceb6df34c1a96ea70b3879f0bb4da2c6ccae535dd058" }, "matching_px_m": [ 2.0, 0.003 ], "methods": [ "S2", "S3" ], "num_points": 256, "numpy": "2.4.6", "orientation_threshold_deg": 20, "phase": 3, "phase1_run_id": "d3f14ee494894daabb8ba2fab8e1b00c", "phase2_run_id": "aa5d71078e0841fd886b5026d6030ebc", "priority_count": 32, "python": "3.11.13", "real_fps_calls_per_method": 1, "reference_count": 103, "simulator_executed": false, "source_run_id": "2551448b0fae4c6bbce3caf48774275f", "source_sha256": { "visual/runtime/geometry.py": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "visual/runtime/rgbd.py": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "visual/runtime/sampling.py": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "visual/runtime/test/run_priority_fps_seed_control.py": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "visual/runtime/test/run_priority_fps_trace.py": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "visual/runtime/test/run_rim_bottleneck.py": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "visual/runtime/test/sampling_evaluation.py": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "visual/runtime/test/test_priority_fps_seed_control.py": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645" }, "structural_ratio": 0.25, "task": "03-D" }, "control": { "S2": { "initial_flat_index": 114957, "initial_xyz_m": [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], "negative_roi": { "contamination": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "same_plane_tracker_cut_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "silhouette_2px": { "count": 0, "denominator": 32, "fraction": 0.0 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 8, "value": 0.07766990291262135 }, "priority_depth_m": { "count": 32, "max": 0.6899999976158142, "median": 0.5055000185966492, "min": 0.30300000309944153, "p95": 0.6652999520301819 }, "priority_reference_count": 8, "priority_reference_ids": [ 38, 40, 42, 78, 79, 80, 91, 92 ], "rim_matching_flat_indices": [ 119042, 114965, 107798 ], "rim_matching_node_count": 3, "selected_candidate_local_indices": [ 152, 3, 89, 59, 33, 271, 120, 213, 174, 105, 127, 111, 285, 198, 186, 140, 98, 165, 55, 112, 223, 156, 126, 78, 292, 65, 160, 43, 200, 193, 208, 0 ], "selected_flat_indices": [ 114957, 95454, 109831, 104212, 98091, 120059, 112394, 118550, 116497, 111367, 112908, 111383, 120073, 118013, 117521, 113933, 110854, 115982, 101595, 111880, 119042, 114965, 112907, 107798, 120080, 105748, 115471, 99555, 118035, 118008, 118523, 95015 ], "selected_xyz_m": [ [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], [ -0.03965039178729057, -0.08225976675748825, 0.30300000309944153 ], [ 0.02021484449505806, -0.11185546964406967, 0.6899999976158142 ], [ 0.03891796991229057, -0.09966796636581421, 0.4860000014305115 ], [ 0.05216601863503456, -0.07734961062669754, 0.3070000112056732 ], [ -0.0087890625, -0.0419921875, 0.5 ], [ 0.02592187561094761, -0.09010937809944153, 0.6320000290870667 ], [ 0.04429687559604645, -0.048234377056360245, 0.5040000081062317 ], [ 0.036845702677965164, -0.060005854815244675, 0.5389999747276306 ], [ 0.019306639209389687, -0.09910742193460464, 0.6589999794960022 ], [ 0.029541015625, -0.08389648795127869, 0.6050000190734863 ], [ 0.045439451932907104, -0.07444336265325546, 0.4950000047683716 ], [ 0.018666015937924385, -0.04224414378404617, 0.503000020980835 ], [ -0.00502929650247097, -0.051298826932907104, 0.5149999856948853 ], [ 0.035820312798023224, -0.05424218624830246, 0.5239999890327454 ], [ 0.031166017055511475, -0.07733789086341858, 0.5910000205039978 ], [ 0.017087889835238457, -0.10384179651737213, 0.6729999780654907 ], [ 0.03126562386751175, -0.06360937654972076, 0.5519999861717224 ], [ -0.04377148672938347, -0.06895507872104645, 0.3070000112056732 ], [ 0.021416015923023224, -0.094482421875, 0.6449999809265137 ], [ 0.0048828125, -0.0458984375, 0.5 ], [ 0.041908204555511475, -0.0614003911614418, 0.49900001287460327 ], [ 0.027806641533970833, -0.08583789318799973, 0.6190000176429749 ], [ 0.04315429553389549, -0.08726757764816284, 0.4909999966621399 ], [ 0.032484374940395355, -0.0423281267285347, 0.5040000081062317 ], [ 0.03979882970452309, -0.0960996076464653, 0.4970000088214874 ], [ 0.0340273417532444, -0.066957026720047, 0.5619999766349792 ], [ -0.03406640514731407, -0.07351171970367432, 0.3059999942779541 ], [ 0.03922851383686066, -0.051298826932907104, 0.5149999856948853 ], [ -0.014560546725988388, -0.04950585961341858, 0.4970000088214874 ], [ -0.008912109769880772, -0.048521488904953, 0.5070000290870667 ], [ 0.04736914113163948, -0.08454492688179016, 0.3070000112056732 ] ], "stage": "C_shared_initial_priority" }, "S3": { "initial_flat_index": 114957, "initial_xyz_m": [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], "negative_roi": { "contamination": { "count": 4, "denominator": 32, "fraction": 0.125 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 9, "denominator": 32, "fraction": 0.28125 }, "occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "same_plane_tracker_cut_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 }, "silhouette_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 3, "value": 0.02912621359223301 }, "priority_depth_m": { "count": 32, "max": 1.4259999990463257, "median": 0.5785000324249268, "min": 0.29499998688697815, "p95": 1.405650019645691 }, "priority_reference_count": 3, "priority_reference_ids": [ 5, 6, 7 ], "rim_matching_flat_indices": [ 108794 ], "rim_matching_node_count": 1, "selected_candidate_local_indices": [ 449, 329, 11, 372, 14, 0, 373, 215, 352, 357, 309, 339, 544, 344, 358, 258, 366, 317, 426, 277, 485, 395, 312, 1, 330, 515, 420, 50, 246, 338, 307, 476 ], "selected_flat_indices": [ 114957, 106747, 87254, 109819, 87767, 84782, 109829, 101170, 108294, 108794, 105738, 107270, 119062, 107771, 108795, 102193, 109318, 105746, 113403, 103135, 116989, 111355, 105741, 84783, 106758, 119032, 112907, 94500, 102117, 107259, 105736, 116497 ], "selected_xyz_m": [ [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], [ -0.025066405534744263, -0.2645898461341858, 1.4259999990463257 ], [ -0.0478222630918026, -0.09852538257837296, 0.29499998688697815 ], [ -0.021638670936226845, -0.1995566338300705, 1.2309999465942383 ], [ -0.07229882478713989, -0.1508456915616989, 0.4569999873638153 ], [ 0.08518945425748825, -0.1657988280057907, 0.4690000116825104 ], [ 0.015124999918043613, -0.11412499845027924, 0.7039999961853027 ], [ 0.06134960800409317, -0.07106835395097733, 0.3109999895095825 ], [ 0.03354101628065109, -0.22962695360183716, 1.3209999799728394 ], [ -0.01044140662997961, -0.0825820341706276, 0.4860000014305115 ], [ 0.02583984285593033, -0.12181640416383743, 0.6299999952316284 ], [ 0.035267580300569534, -0.25229883193969727, 1.3890000581741333 ], [ 0.04429687559604645, -0.0462656244635582, 0.5040000081062317 ], [ -0.02380078099668026, -0.24065233767032623, 1.3539999723434448 ], [ -0.022675780579447746, -0.21919921040534973, 1.2899999618530273 ], [ 0.09455273300409317, -0.10792382806539536, 0.48899999260902405 ], [ 0.03199218586087227, -0.20917968451976776, 1.2599999904632568 ], [ 0.0375058576464653, -0.10035351663827896, 0.5189999938011169 ], [ -0.010669921524822712, -0.08180273324251175, 0.6069999933242798 ], [ -0.060302734375, -0.10112304240465164, 0.4749999940395355 ], [ -0.005205078050494194, -0.057255856692790985, 0.5329999923706055 ], [ -0.011583983898162842, -0.09910742193460464, 0.6589999794960022 ], [ 0.030796874314546585, -0.11292187124490738, 0.5839999914169312 ], [ 0.0580761693418026, -0.11065039038658142, 0.31299999356269836 ], [ 0.03620703145861626, -0.2645898461341858, 1.4259999990463257 ], [ -0.014589843340218067, -0.0457148440182209, 0.49799999594688416 ], [ 0.027806641533970833, -0.08583789318799973, 0.6190000176429749 ], [ 0.06815233826637268, -0.13350389897823334, 0.4779999852180481 ], [ -0.03219335898756981, -0.06863866746425629, 0.3109999895095825 ], [ -0.024416016414761543, -0.25229883193969727, 1.3890000581741333 ], [ 0.02211328223347664, -0.12877734005451202, 0.6660000085830688 ], [ 0.036845702677965164, -0.060005854815244675, 0.5389999747276306 ] ], "stage": "C_shared_initial_priority" } }, "control_node_comparison": { "S2_only": { "count": 29, "flat_indices": [ 95015, 95454, 98091, 99555, 101595, 104212, 105748, 107798, 109831, 110854, 111367, 111383, 111880, 112394, 112908, 113933, 114965, 115471, 115982, 117521, 118008, 118013, 118035, 118523, 118550, 119042, 120059, 120073, 120080 ] }, "S3_only": { "count": 29, "flat_indices": [ 84782, 84783, 87254, 87767, 94500, 101170, 102117, 102193, 103135, 105736, 105738, 105741, 105746, 106747, 106758, 107259, 107270, 107771, 108294, 108794, 108795, 109318, 109819, 109829, 111355, 113403, 116989, 119032, 119062 ] }, "intersection": { "count": 3, "flat_indices": [ 112907, 114957, 116497 ] } }, "control_reference_comparison": { "S2_only": { "count": 8, "reference_ids": [ 38, 40, 42, 78, 79, 80, 91, 92 ] }, "S3_only": { "count": 3, "reference_ids": [ 5, 6, 7 ] }, "intersection": { "count": 0, "reference_ids": [] } }, "fps_source_check": { "current_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "fps_candidate_allocation_ast_exact": true, "saved_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed" }, "initial_control": { "candidate_local_index": { "S2": 152, "S3": 449 }, "exact_initial_xyz_equal": true, "gt_selection_input": false, "initial_flat_index": 114957, "initial_rng_draws": 0, "initial_xyz_m": [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], "real_fps_calls": { "S2": 1, "S3": 1 }, "rule": "sorted(set(C_S2) & set(C_S3))[len(shared)//2]", "shared_count": 252, "shared_flat_indices": [ 95015, 95016, 95017, 95454, 95528, 95529, 95966, 95967, 95968, 95969, 95970, 95971, 96478, 96479, 96480, 96481, 96482, 96483, 96552, 96553, 96994, 96995, 97064, 97065, 97506, 97507, 97576, 97577, 98018, 98090, 98529, 98530, 98600, 98602, 99041, 99042, 99554, 100066, 100067, 100578, 100579, 101084, 101085, 101090, 101091, 101596, 101597, 104212, 104724, 104725, 105237, 105238, 105749, 105750, 105751, 106262, 106263, 106774, 106775, 107286, 107287, 107797, 107798, 107799, 108309, 108310, 108311, 108821, 108822, 108823, 109333, 109334, 109335, 109831, 109845, 109846, 109847, 110343, 110344, 110357, 110358, 110359, 110855, 110856, 110869, 110870, 110871, 111368, 111369, 111381, 111382, 111383, 111880, 111881, 111882, 111893, 111894, 111895, 112393, 112394, 112395, 112405, 112406, 112407, 112906, 112907, 112908, 112917, 112918, 112919, 113419, 113420, 113429, 113430, 113431, 113932, 113933, 113941, 113942, 113943, 114444, 114445, 114446, 114453, 114454, 114455, 114957, 114958, 114959, 114965, 114966, 114967, 115470, 115471, 115472, 115477, 115478, 115479, 115983, 115984, 115985, 115989, 115990, 115991, 116496, 116497, 116501, 116502, 116503, 117008, 117009, 117010, 117013, 117014, 117015, 117521, 117522, 117525, 117526, 117527, 118008, 118009, 118012, 118013, 118037, 118038, 118520, 118521, 118524, 118548, 118549, 118550, 119033, 119034, 119035, 119036, 119038, 119039, 119040, 119041, 119042, 119043, 119044, 119045, 119046, 119047, 119048, 119049, 119050, 119051, 119052, 119053, 119054, 119055, 119056, 119057, 119058, 119059, 119060, 119061, 119062, 119546, 119547, 119548, 119549, 119550, 119551, 119552, 119553, 119554, 119555, 119556, 119557, 119558, 119559, 119560, 119561, 119562, 119563, 119564, 119565, 119566, 119567, 119568, 119569, 119570, 119571, 119572, 120059, 120060, 120061, 120062, 120063, 120064, 120065, 120066, 120067, 120068, 120069, 120070, 120071, 120072, 120073, 120074, 120075, 120076, 120077, 120078, 120079, 120080, 120081, 120082 ], "total_nodes_including_initial": 32 }, "input_hashes_unchanged": true, "interpretation": "Saved Priority ranges: S2 [7, 13], S3 [3, 5] references of 103. At shared initial 114957, S2 covers 8/103 and S3 3/103 (S2 minus S3: 5). This single initialization constrains interpretation to the fixed candidate sets and FPS conditions; candidate count, position, contamination and far depth have not been causally separated. S3 varies by 2 references (1.94 percentage points) across the three saved seeds. The shared-initial gap is 5 references, compared with saved Priority gaps 10/2/4; it is smaller than seed 0 and larger than seeds 1/2. This is descriptive initialization sensitivity, not a causal contribution estimate.", "interpretation_ko": "\uc800\uc7a5\ub41c seed 0/1/2\uc758 B Priority coverage\ub294 S2 7\u201313/103, S3 3\u20135/103\uc774\ub2e4. \uacf5\ud1b5 \ucd08\uae30\uc810 114957\uc758 C Priority\ub294 S2 **8/103**, S3 **3/103** (S2\u2212S3 5 refs)\uc774\ub2e4. \uc774 \ucd08\uae30\uc810\uacfc \uae30\uc874 FPS \uc870\uac74\uc5d0\uc11c\ub3c4 \ud6c4\ubcf4 \uc9d1\ud569 \ucc28\uc774\uc5d0 \ub530\ub978 \uacb0\uacfc \ucc28\uc774\uac00 \ub0a8\ub294\ub2e4. \ub2e8\uc77c \uacf5\ud1b5 \ucd08\uae30\uc810\uc73c\ub85c \ucd08\uae30\uc810 \ud6a8\uacfc\uc758 \uc77c\ubc18\uc801 \ud06c\uae30\ub098 \uac01 \ud6c4\ubcf4 \ud2b9\uc131\uc758 \ub3c5\ub9bd\uc801 \uc778\uacfc \uae30\uc5ec\uc728\uc744 \ucd94\uc815\ud558\uc9c0 \uc54a\ub294\ub2e4.", "pass_all": true, "report_refresh": { "real_fps_reexecuted": false, "reason": "show all points with dynamic axis limits; expand interpretation", "selection_source": "completed result JSON only" }, "run_id": "f36f1e9e2bb64866b8d6c792db158635", "saved": { "S2": { "0": { "final_sampling": { "denominator": 103, "numerator": 16, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.1553398058252427 }, "initial_flat_index": 101598, "initial_xyz_m": [ -0.04030468687415123, -0.06917968392372131, 0.30799999833106995 ], "negative_roi": { "contamination": { "count": 3, "denominator": 32, "fraction": 0.09375 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 3, "denominator": 32, "fraction": 0.09375 }, "occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "same_plane_tracker_cut_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "silhouette_2px": { "count": 0, "denominator": 32, "fraction": 0.0 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 13, "value": 0.1262135922330097 }, "priority_depth_m": { "count": 32, "max": 0.6899999976158142, "median": 0.5060000419616699, "min": 0.30300000309944153, "p95": 0.6652999520301819 }, "priority_reference_count": 13, "priority_reference_ids": [ 46, 48, 50, 64, 66, 68, 69, 83, 84, 85, 96, 97, 98 ], "priority_result_origin": "Phase2 reused; seed0 matcher not called", "rim_matching_flat_indices": [ 110869, 119055, 117525, 119046 ], "rim_matching_node_count": 4, "seed": 0, "selected_flat_indices": [ 101598, 109831, 106775, 113933, 98091, 118520, 117008, 111882, 120074, 114967, 115470, 111367, 120084, 118013, 112907, 120065, 117011, 110869, 110854, 114446, 95971, 112908, 115472, 104212, 119055, 117525, 105748, 116495, 120060, 111880, 118523, 119046 ], "selected_xyz_m": [ [ -0.04030468687415123, -0.06917968392372131, 0.30799999833106995 ], [ 0.02021484449505806, -0.11185546964406967, 0.6899999976158142 ], [ 0.04498047009110451, -0.09091796725988388, 0.49000000953674316 ], [ 0.031166017055511475, -0.07733789086341858, 0.5910000205039978 ], [ 0.05216601863503456, -0.07734961062669754, 0.3070000112056732 ], [ -0.014589843340218067, -0.04766015708446503, 0.49799999594688416 ], [ 0.03435351699590683, -0.057255856692790985, 0.5329999923706055 ], [ 0.026126954704523087, -0.09331054985523224, 0.6370000243186951 ], [ 0.020630860701203346, -0.04224414378404617, 0.503000020980835 ], [ 0.0458984375, -0.0615234375, 0.5 ], [ 0.031832028180360794, -0.066957026720047, 0.5619999766349792 ], [ 0.019306639209389687, -0.09910742193460464, 0.6589999794960022 ], [ 0.04043945297598839, -0.042412109673023224, 0.5049999952316284 ], [ -0.00502929650247097, -0.051298826932907104, 0.5149999856948853 ], [ 0.027806641533970833, -0.08583789318799973, 0.6190000176429749 ], [ 0.0029355469159781933, -0.042076170444488525, 0.5009999871253967 ], [ 0.03930468484759331, -0.05542968586087227, 0.515999972820282 ], [ 0.04148827865719795, -0.07622265070676804, 0.49399998784065247 ], [ 0.017087889835238457, -0.10384179651737213, 0.6729999780654907 ], [ 0.03268164023756981, -0.07325195521116257, 0.5770000219345093 ], [ -0.033732421696186066, -0.08107617497444153, 0.30300000309944153 ], [ 0.029541015625, -0.08389648795127869, 0.6050000190734863 ], [ 0.03551367297768593, -0.06564648449420929, 0.5509999990463257 ], [ 0.03891796991229057, -0.09966796636581421, 0.4860000014305115 ], [ 0.030455078929662704, -0.0461738295853138, 0.503000020980835 ], [ 0.04216015338897705, -0.05196484178304672, 0.5019999742507935 ], [ 0.03979882970452309, -0.0960996076464653, 0.4970000088214874 ], [ 0.03287695348262787, -0.060451168566942215, 0.5429999828338623 ], [ -0.0068359375, -0.0419921875, 0.5 ], [ 0.021416015923023224, -0.094482421875, 0.6449999809265137 ], [ -0.008912109769880772, -0.048521488904953, 0.5070000290870667 ], [ 0.012720703147351742, -0.0459902323782444, 0.5009999871253967 ] ], "stage": "B_saved_priority" }, "1": { "final_sampling": { "denominator": 103, "numerator": 10, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.0970873786407767 }, "initial_flat_index": 119061, "initial_xyz_m": [ 0.0423281267285347, -0.0462656244635582, 0.5040000081062317 ], "negative_roi": { "contamination": { "count": 4, "denominator": 32, "fraction": 0.125 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 4, "denominator": 32, "fraction": 0.125 }, "occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "same_plane_tracker_cut_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "silhouette_2px": { "count": 0, "denominator": 32, "fraction": 0.0 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 7, "value": 0.06796116504854369 }, "priority_depth_m": { "count": 32, "max": 0.6899999976158142, "median": 0.5110000371932983, "min": 0.30300000309944153, "p95": 0.6643999814987183 }, "priority_reference_count": 7, "priority_reference_ids": [ 60, 62, 64, 79, 80, 81, 86 ], "priority_result_origin": "saved Priority evaluated by existing CoverageMatcher", "rim_matching_flat_indices": [ 119061, 119053, 115477 ], "rim_matching_node_count": 3, "seed": 1, "selected_flat_indices": [ 119061, 95454, 109831, 113931, 98091, 118008, 104212, 111881, 115472, 120070, 111895, 111883, 116498, 114957, 118013, 110344, 107799, 101595, 119053, 120062, 111367, 115477, 118034, 112393, 113418, 115985, 114444, 115470, 105748, 99555, 118523, 120081 ], "selected_xyz_m": [ [ 0.0423281267285347, -0.0462656244635582, 0.5040000081062317 ], [ -0.03965039178729057, -0.08225976675748825, 0.30300000309944153 ], [ 0.02021484449505806, -0.11185546964406967, 0.6899999976158142 ], [ 0.026728516444563866, -0.07786133140325546, 0.5950000286102295 ], [ 0.05216601863503456, -0.07734961062669754, 0.3070000112056732 ], [ -0.014560546725988388, -0.04950585961341858, 0.4970000088214874 ], [ 0.03891796991229057, -0.09966796636581421, 0.4860000014305115 ], [ 0.02393554523587227, -0.094482421875, 0.6449999809265137 ], [ 0.03551367297768593, -0.06564648449420929, 0.5509999990463257 ], [ 0.012746092863380909, -0.04216015338897705, 0.5019999742507935 ], [ 0.0455312505364418, -0.07265625149011612, 0.4959999918937683 ], [ 0.027851562947034836, -0.0908203125, 0.6200000047683716 ], [ 0.038083985447883606, -0.05866992473602295, 0.5270000100135803 ], [ 0.030216798186302185, -0.07050585746765137, 0.5730000138282776 ], [ -0.00502929650247097, -0.051298826932907104, 0.5149999856948853 ], [ 0.022279296070337296, -0.10615430027246475, 0.6710000038146973 ], [ 0.04507226496934891, -0.08726757764816284, 0.4909999966621399 ], [ -0.04377148672938347, -0.06895507872104645, 0.3070000112056732 ], [ 0.02652539126574993, -0.0461738295853138, 0.503000020980835 ], [ -0.0029355469159781933, -0.042076170444488525, 0.5009999871253967 ], [ 0.019306639209389687, -0.09910742193460464, 0.6589999794960022 ], [ 0.0419921875, -0.0595703125, 0.5 ], [ 0.03721679747104645, -0.051298826932907104, 0.5149999856948853 ], [ 0.0234531257301569, -0.09010937809944153, 0.6320000290870667 ], [ 0.02489648386836052, -0.08180273324251175, 0.6069999933242798 ], [ 0.036845702677965164, -0.062111325562000275, 0.5389999747276306 ], [ 0.02851562388241291, -0.07414062321186066, 0.5839999914169312 ], [ 0.031832028180360794, -0.066957026720047, 0.5619999766349792 ], [ 0.03979882970452309, -0.0960996076464653, 0.4970000088214874 ], [ -0.03406640514731407, -0.07351171970367432, 0.3059999942779541 ], [ -0.008912109769880772, -0.048521488904953, 0.5070000290870667 ], [ 0.03452148288488388, -0.042412109673023224, 0.5049999952316284 ] ], "stage": "B_saved_priority" }, "2": { "final_sampling": { "denominator": 103, "numerator": 10, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.0970873786407767 }, "initial_flat_index": 112919, "initial_xyz_m": [ 0.0456230491399765, -0.06891991943120956, 0.4970000088214874 ], "negative_roi": { "contamination": { "count": 4, "denominator": 32, "fraction": 0.125 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 4, "denominator": 32, "fraction": 0.125 }, "occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "same_plane_tracker_cut_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "silhouette_2px": { "count": 0, "denominator": 32, "fraction": 0.0 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 7, "value": 0.06796116504854369 }, "priority_depth_m": { "count": 32, "max": 0.6899999976158142, "median": 0.5110000371932983, "min": 0.30300000309944153, "p95": 0.6643999814987183 }, "priority_reference_count": 7, "priority_reference_ids": [ 64, 66, 68, 69, 81, 82, 83 ], "priority_result_origin": "saved Priority evaluated by existing CoverageMatcher", "rim_matching_flat_indices": [ 116501, 119055 ], "rim_matching_node_count": 2, "seed": 2, "selected_flat_indices": [ 112919, 95454, 109831, 113931, 98091, 118520, 116495, 111881, 120074, 104212, 117523, 111883, 114958, 110344, 118013, 120065, 108311, 120084, 101595, 111367, 116501, 112393, 113418, 114444, 115471, 105748, 117010, 114960, 99555, 119055, 120060, 118523 ], "selected_xyz_m": [ [ 0.0456230491399765, -0.06891991943120956, 0.4970000088214874 ], [ -0.03965039178729057, -0.08225976675748825, 0.30300000309944153 ], [ 0.02021484449505806, -0.11185546964406967, 0.6899999976158142 ], [ 0.026728516444563866, -0.07786133140325546, 0.5950000286102295 ], [ 0.05216601863503456, -0.07734961062669754, 0.3070000112056732 ], [ -0.014589843340218067, -0.04766015708446503, 0.49799999594688416 ], [ 0.03287695348262787, -0.060451168566942215, 0.5429999828338623 ], [ 0.02393554523587227, -0.094482421875, 0.6449999809265137 ], [ 0.020630860701203346, -0.04224414378404617, 0.503000020980835 ], [ 0.03891796991229057, -0.09966796636581421, 0.4860000014305115 ], [ 0.03938085958361626, -0.05351758003234863, 0.5170000195503235 ], [ 0.027851562947034836, -0.0908203125, 0.6200000047683716 ], [ 0.03245507925748825, -0.07050585746765137, 0.5730000138282776 ], [ 0.022279296070337296, -0.10615430027246475, 0.6710000038146973 ], [ -0.00502929650247097, -0.051298826932907104, 0.5149999856948853 ], [ 0.0029355469159781933, -0.042076170444488525, 0.5009999871253967 ], [ 0.045164063572883606, -0.08552344143390656, 0.492000013589859 ], [ 0.04043945297598839, -0.042412109673023224, 0.5049999952316284 ], [ -0.04377148672938347, -0.06895507872104645, 0.3070000112056732 ], [ 0.019306639209389687, -0.09910742193460464, 0.6589999794960022 ], [ 0.042076170444488525, -0.055775389075279236, 0.5009999871253967 ], [ 0.0234531257301569, -0.09010937809944153, 0.6320000290870667 ], [ 0.02489648386836052, -0.08180273324251175, 0.6069999933242798 ], [ 0.02851562388241291, -0.07414062321186066, 0.5839999914169312 ], [ 0.0340273417532444, -0.066957026720047, 0.5619999766349792 ], [ 0.03979882970452309, -0.0960996076464653, 0.4970000088214874 ], [ 0.03815624862909317, -0.056718748062849045, 0.527999997138977 ], [ 0.03551367297768593, -0.06779883056879044, 0.5509999990463257 ], [ -0.03406640514731407, -0.07351171970367432, 0.3059999942779541 ], [ 0.030455078929662704, -0.0461738295853138, 0.503000020980835 ], [ -0.0068359375, -0.0419921875, 0.5 ], [ -0.008912109769880772, -0.048521488904953, 0.5070000290870667 ] ], "stage": "B_saved_priority" } }, "S3": { "0": { "final_sampling": { "denominator": 103, "numerator": 3, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.02912621359223301 }, "initial_flat_index": 96553, "initial_xyz_m": [ 0.049605466425418854, -0.08068358898162842, 0.3059999942779541 ], "negative_roi": { "contamination": { "count": 4, "denominator": 32, "fraction": 0.125 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 9, "denominator": 32, "fraction": 0.28125 }, "occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "same_plane_tracker_cut_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 }, "silhouette_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 3, "value": 0.02912621359223301 }, "priority_depth_m": { "count": 32, "max": 1.4259999990463257, "median": 0.5805000066757202, "min": 0.3059999942779541, "p95": 1.405650019645691 }, "priority_reference_count": 3, "priority_reference_ids": [ 3, 4, 5 ], "priority_result_origin": "Phase2 reused; seed0 matcher not called", "rim_matching_flat_indices": [ 107770 ], "rim_matching_node_count": 1, "seed": 0, "selected_flat_indices": [ 96553, 106747, 109829, 118524, 109819, 84782, 87255, 108294, 105741, 87766, 104214, 107270, 112379, 107771, 108795, 109318, 114939, 102629, 100659, 115985, 105737, 107770, 110843, 105744, 112907, 114966, 114446, 106758, 102117, 94500, 107259, 107782 ], "selected_xyz_m": [ [ 0.049605466425418854, -0.08068358898162842, 0.3059999942779541 ], [ -0.025066405534744263, -0.2645898461341858, 1.4259999990463257 ], [ 0.015124999918043613, -0.11412499845027924, 0.7039999961853027 ], [ -0.006931641139090061, -0.048521488904953, 0.5070000290870667 ], [ -0.021638670936226845, -0.1995566338300705, 1.2309999465942383 ], [ 0.08518945425748825, -0.1657988280057907, 0.4690000116825104 ], [ -0.07214062660932541, -0.15229687094688416, 0.4560000002384186 ], [ 0.03354101628065109, -0.22962695360183716, 1.3209999799728394 ], [ 0.030796874314546585, -0.11292187124490738, 0.5839999914169312 ], [ -0.05009179562330246, -0.10199413448572159, 0.3089999854564667 ], [ 0.04271484538912773, -0.09966796636581421, 0.4860000014305115 ], [ 0.035267580300569534, -0.25229883193969727, 1.3890000581741333 ], [ -0.011109375394880772, -0.09010937809944153, 0.6320000290870667 ], [ -0.02380078099668026, -0.24065233767032623, 1.3539999723434448 ], [ -0.022675780579447746, -0.21919921040534973, 1.2899999618530273 ], [ 0.03199218586087227, -0.20917968451976776, 1.2599999904632568 ], [ -0.01007226575165987, -0.07050585746765137, 0.5730000138282776 ], [ -0.04916992038488388, -0.10297851264476776, 0.4749999940395355 ], [ 0.09817187488079071, -0.11342187970876694, 0.4880000054836273 ], [ 0.036845702677965164, -0.062111325562000275, 0.5389999747276306 ], [ 0.024046875536441803, -0.12529687583446503, 0.6480000019073486 ], [ -0.010419921949505806, -0.08620117604732513, 0.48500001430511475 ], [ -0.01183007750660181, -0.10384179651737213, 0.6729999780654907 ], [ 0.03499804437160492, -0.10499414056539536, 0.5429999828338623 ], [ 0.027806641533970833, -0.08583789318799973, 0.6190000176429749 ], [ 0.04385742172598839, -0.0614003911614418, 0.49900001287460327 ], [ 0.03268164023756981, -0.07325195521116257, 0.5770000219345093 ], [ 0.03620703145861626, -0.2645898461341858, 1.4259999990463257 ], [ -0.03219335898756981, -0.06863866746425629, 0.3109999895095825 ], [ 0.06815233826637268, -0.13350389897823334, 0.4779999852180481 ], [ -0.024416016414761543, -0.25229883193969727, 1.3890000581741333 ], [ 0.03437890484929085, -0.24065233767032623, 1.3539999723434448 ] ], "stage": "B_saved_priority" }, "1": { "final_sampling": { "denominator": 103, "numerator": 5, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.04854368932038835 }, "initial_flat_index": 117010, "initial_xyz_m": [ 0.03815624862909317, -0.056718748062849045, 0.527999997138977 ], "negative_roi": { "contamination": { "count": 4, "denominator": 32, "fraction": 0.125 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 9, "denominator": 32, "fraction": 0.28125 }, "occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "same_plane_tracker_cut_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 }, "silhouette_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 5, "value": 0.04854368932038835 }, "priority_depth_m": { "count": 32, "max": 1.4259999990463257, "median": 0.565500020980835, "min": 0.29499998688697815, "p95": 1.405650019645691 }, "priority_reference_count": 5, "priority_reference_ids": [ 1, 2, 3, 87, 88 ], "priority_result_origin": "saved Priority evaluated by existing CoverageMatcher", "rim_matching_flat_indices": [ 106746, 105750 ], "rim_matching_node_count": 2, "seed": 1, "selected_flat_indices": [ 117010, 106747, 87254, 109819, 109829, 87255, 84782, 101170, 108294, 113403, 106746, 107270, 107771, 105742, 108795, 102193, 109318, 105738, 103133, 115963, 105750, 111355, 120062, 113932, 84783, 106257, 106758, 94500, 102117, 107259, 105736, 115471 ], "selected_xyz_m": [ [ 0.03815624862909317, -0.056718748062849045, 0.527999997138977 ], [ -0.025066405534744263, -0.2645898461341858, 1.4259999990463257 ], [ -0.0478222630918026, -0.09852538257837296, 0.29499998688697815 ], [ -0.021638670936226845, -0.1995566338300705, 1.2309999465942383 ], [ 0.015124999918043613, -0.11412499845027924, 0.7039999961853027 ], [ -0.07214062660932541, -0.15229687094688416, 0.4560000002384186 ], [ 0.08518945425748825, -0.1657988280057907, 0.4690000116825104 ], [ 0.06134960800409317, -0.07106835395097733, 0.3109999895095825 ], [ 0.03354101628065109, -0.22962695360183716, 1.3209999799728394 ], [ -0.010669921524822712, -0.08180273324251175, 0.6069999933242798 ], [ -0.010398437269032001, -0.08980468660593033, 0.48399999737739563 ], [ 0.035267580300569534, -0.25229883193969727, 1.3890000581741333 ], [ -0.02380078099668026, -0.24065233767032623, 1.3539999723434448 ], [ 0.032228514552116394, -0.11002148687839508, 0.5690000057220459 ], [ -0.022675780579447746, -0.21919921040534973, 1.2899999618530273 ], [ 0.09455273300409317, -0.10792382806539536, 0.48899999260902405 ], [ 0.03199218586087227, -0.20917968451976776, 1.2599999904632568 ], [ 0.02583984285593033, -0.12181640416383743, 0.6299999952316284 ], [ -0.06387890875339508, -0.10091015696525574, 0.4740000069141388 ], [ -0.00970312487334013, -0.06360937654972076, 0.5519999861717224 ], [ 0.042890626937150955, -0.0943593755364418, 0.4880000054836273 ], [ -0.011583983898162842, -0.09910742193460464, 0.6589999794960022 ], [ -0.0029355469159781933, -0.042076170444488525, 0.5009999871253967 ], [ 0.02905273623764515, -0.07786133140325546, 0.5950000286102295 ], [ 0.0580761693418026, -0.11065039038658142, 0.31299999356269836 ], [ 0.036298830062150955, -0.10059960931539536, 0.531000018119812 ], [ 0.03620703145861626, -0.2645898461341858, 1.4259999990463257 ], [ 0.06815233826637268, -0.13350389897823334, 0.4779999852180481 ], [ -0.03219335898756981, -0.06863866746425629, 0.3109999895095825 ], [ -0.024416016414761543, -0.25229883193969727, 1.3890000581741333 ], [ 0.02211328223347664, -0.12877734005451202, 0.6660000085830688 ], [ 0.0340273417532444, -0.066957026720047, 0.5619999766349792 ] ], "stage": "B_saved_priority" }, "2": { "final_sampling": { "denominator": 103, "numerator": 3, "source": "Task03 f0000_metrics.json", "stage": "A_saved_final", "value": 0.02912621359223301 }, "initial_flat_index": 102621, "initial_xyz_m": [ -0.04191210865974426, -0.06742382794618607, 0.3109999895095825 ], "negative_roi": { "contamination": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "invalid_depth_2px": { "count": 0, "denominator": 32, "fraction": 0.0 }, "known_negative_union": { "count": 10, "denominator": 32, "fraction": 0.3125 }, "occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "plane_interior": { "count": 0, "denominator": 32, "fraction": 0.0 }, "robot_occlusion_2px": { "count": 5, "denominator": 32, "fraction": 0.15625 }, "same_plane_tracker_cut_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 }, "silhouette_2px": { "count": 1, "denominator": 32, "fraction": 0.03125 } }, "node_count": 32, "priority_coverage": { "denominator": 103, "numerator": 3, "value": 0.02912621359223301 }, "priority_depth_m": { "count": 32, "max": 1.4259999990463257, "median": 0.5989999771118164, "min": 0.3089999854564667, "p95": 1.405650019645691 }, "priority_reference_count": 3, "priority_reference_ids": [ 49, 51, 53 ], "priority_result_origin": "saved Priority evaluated by existing CoverageMatcher", "rim_matching_flat_indices": [ 105224 ], "rim_matching_node_count": 1, "seed": 2, "selected_flat_indices": [ 102621, 106758, 109830, 98612, 109819, 87767, 115451, 108294, 84783, 105224, 105739, 107259, 108795, 120058, 109318, 105744, 102629, 117527, 111355, 84782, 113933, 113403, 116496, 101671, 105736, 107270, 106747, 111881, 107771, 93988, 87766, 107782 ], "selected_xyz_m": [ [ -0.04191210865974426, -0.06742382794618607, 0.3109999895095825 ], [ 0.03620703145861626, -0.2645898461341858, 1.4259999990463257 ], [ 0.017875000834465027, -0.11412499845027924, 0.7039999961853027 ], [ 0.09966796636581421, -0.12055078148841858, 0.4860000014305115 ], [ -0.021638670936226845, -0.1995566338300705, 1.2309999465942383 ], [ -0.07229882478713989, -0.1508456915616989, 0.4569999873638153 ], [ -0.009878905490040779, -0.066957026720047, 0.5619999766349792 ], [ 0.03354101628065109, -0.22962695360183716, 1.3209999799728394 ], [ 0.0580761693418026, -0.11065039038658142, 0.31299999356269836 ], [ 0.016103515401482582, -0.0956738293170929, 0.48500001430511475 ], [ 0.02758203260600567, -0.11872266232967377, 0.6140000224113464 ], [ -0.024416016414761543, -0.25229883193969727, 1.3890000581741333 ], [ -0.022675780579447746, -0.21919921040534973, 1.2899999618530273 ], [ -0.0107421875, -0.0419921875, 0.5 ], [ 0.03199218586087227, -0.20917968451976776, 1.2599999904632568 ], [ 0.03499804437160492, -0.10499414056539536, 0.5429999828338623 ], [ -0.04916992038488388, -0.10297851264476776, 0.4749999940395355 ], [ 0.0461738295853138, -0.05206836014986038, 0.503000020980835 ], [ -0.011583983898162842, -0.09910742193460464, 0.6589999794960022 ], [ 0.08518945425748825, -0.1657988280057907, 0.4690000116825104 ], [ 0.031166017055511475, -0.07733789086341858, 0.5910000205039978 ], [ -0.010669921524822712, -0.08180273324251175, 0.6069999933242798 ], [ 0.03499804437160492, -0.060451168566942215, 0.5429999828338623 ], [ 0.04814062640070915, -0.07007812708616257, 0.31200000643730164 ], [ 0.02211328223347664, -0.12877734005451202, 0.6660000085830688 ], [ 0.035267580300569534, -0.25229883193969727, 1.3890000581741333 ], [ -0.025066405534744263, -0.2645898461341858, 1.4259999990463257 ], [ 0.02393554523587227, -0.094482421875, 0.6449999809265137 ], [ -0.02380078099668026, -0.24065233767032623, 1.3539999723434448 ], [ 0.06800976395606995, -0.13508789241313934, 0.47699999809265137 ], [ -0.05009179562330246, -0.10199413448572159, 0.3089999854564667 ], [ 0.03437890484929085, -0.24065233767032623, 1.3539999723434448 ] ], "stage": "B_saved_priority" } } }, "saved_alignment": { "S2_n256_r0.25_t20_s0": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [], "xyz_exact": true }, "S2_n256_r0.25_t20_s1": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [ 86 ], "xyz_exact": true }, "S2_n256_r0.25_t20_s2": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [ 144, 103 ], "xyz_exact": true }, "S3_n256_r0.25_t20_s0": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [], "xyz_exact": true }, "S3_n256_r0.25_t20_s1": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [ 68 ], "xyz_exact": true }, "S3_n256_r0.25_t20_s2": { "candidate_local_global_exact": true, "feature_and_role_alignment": true, "max_abs_xyz_error_m": 0.0, "priority_is_saved_prefix": true, "raster_and_object_support": true, "saved_feature_fields": 23, "saved_final_coverage_unchanged": true, "selected_nodes": 256, "source_frame": 0, "source_keyed_feature_overlap_counts": [ 85, 65 ], "xyz_exact": true } }, "source_contract": { "visual/runtime/edge_evidence.py": { "current_sha256": "2c896cc60e50f50f2b55ea377d34a6e15bffab875df2a8653dfe1b9830d30f2d", "original_sha256": "14ab164cd98a0be16c7f12e2e6679b932b697028e567975b0dc31a939bf903b4", "status": "AST identical (formatting only)" }, "visual/runtime/geometry.py": { "current_sha256": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "original_sha256": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "status": "byte identical" }, "visual/runtime/normal_estimators.py": { "current_sha256": "bf080a3ece0e2de6c7439257b943a3e44fdd8236010e526c202c15bcd57cdf2e", "original_sha256": "bf080a3ece0e2de6c7439257b943a3e44fdd8236010e526c202c15bcd57cdf2e", "status": "byte identical" }, "visual/runtime/pca.py": { "current_sha256": "7a1a5fc459faed561497597d217f037b7b637d70497174d591d87c5156196517", "original_sha256": "7a1a5fc459faed561497597d217f037b7b637d70497174d591d87c5156196517", "status": "byte identical" }, "visual/runtime/rgbd.py": { "current_sha256": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "original_sha256": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "status": "byte identical" }, "visual/runtime/sampling.py": { "current_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "original_sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "status": "byte identical" }, "visual/runtime/test/normal_diagnostics.py": { "current_sha256": "d3da4f81a2452a9e11c4781ade557af5baeed96a2593876fdda768efb89ffddc", "original_sha256": "d3da4f81a2452a9e11c4781ade557af5baeed96a2593876fdda768efb89ffddc", "status": "byte identical" }, "visual/runtime/test/run_normal_comparison.py": { "current_sha256": "b3caa29120144be1affbd8b9329b95ae24750ff3bd7736832cc2e69bc9e1816b", "original_sha256": "b3caa29120144be1affbd8b9329b95ae24750ff3bd7736832cc2e69bc9e1816b", "status": "byte identical" }, "visual/runtime/test/run_normal_diagnostics.py": { "current_sha256": "688c07957dd04e3ee7abbcebf962745199a194df317a266e2642c9d8bdae64aa", "original_sha256": "688c07957dd04e3ee7abbcebf962745199a194df317a266e2642c9d8bdae64aa", "status": "byte identical" }, "visual/runtime/test/run_sampling.py": { "current_sha256": "dcbcb9a20c71555f836a5b13fc5c0b556d73eda430dbff1ecb119d0776689081", "original_sha256": "dcbcb9a20c71555f836a5b13fc5c0b556d73eda430dbff1ecb119d0776689081", "status": "byte identical" }, "visual/runtime/test/run_structural_edges.py": { "current_sha256": "eb123019b2606a37d9c629aac7c4e3f2a77c14b577141485cb7e1a94b117e2fe", "original_sha256": "eb123019b2606a37d9c629aac7c4e3f2a77c14b577141485cb7e1a94b117e2fe", "status": "byte identical" }, "visual/runtime/test/sampling_evaluation.py": { "current_sha256": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "original_sha256": "a99654f398d1e429601459878ed4080100bc3dc19b42e78471572298c6e05e4a", "status": "original definitions unchanged; additive diagnostics only" }, "visual/runtime/test/sampling_plots.py": { "current_sha256": "fca7005f90f5f665c823fc9ae147e1ca1917285367655f6dcb30ed5144a1e223", "original_sha256": "fca7005f90f5f665c823fc9ae147e1ca1917285367655f6dcb30ed5144a1e223", "status": "byte identical" }, "visual/runtime/test/test_sampling.py": { "current_sha256": "84240df749df06534e961db4e98418928230ef3cdbe920946d7489f2fab9dc60", "original_sha256": "84240df749df06534e961db4e98418928230ef3cdbe920946d7489f2fab9dc60", "status": "byte identical" }, "visual/runtime/test/test_sampling_evaluation.py": { "current_sha256": "8ec490314b6e55b3d4c0bc2b05f37036bf07fa3462039fd8b1676227d0a3b0bd", "original_sha256": "1705fd07af7fb611be87f2570d8c4dce3dfd9be8020873018aeeda258924e303", "status": "diagnostic tests extended; not an evaluation dependency" }, "visual/runtime/test/test_sampling_geometry.py": { "current_sha256": "a6df427b8510d0018931f637eb3c3357d3ed57211cd592ab07d7b8c8094de031", "original_sha256": "a6df427b8510d0018931f637eb3c3357d3ed57211cd592ab07d7b8c8094de031", "status": "byte identical" } }, "source_hashes": { "visual/runtime/geometry.py": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "visual/runtime/rgbd.py": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "visual/runtime/sampling.py": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "visual/runtime/test/run_priority_fps_seed_control.py": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "visual/runtime/test/run_priority_fps_trace.py": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "visual/runtime/test/run_rim_bottleneck.py": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "visual/runtime/test/sampling_evaluation.py": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "visual/runtime/test/test_priority_fps_seed_control.py": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645" }, "source_run_id": "2551448b0fae4c6bbce3caf48774275f"}123456789101112131415<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Task03-D Phase 3 — FPS initial control</title><style>body{font:16px system-ui;max-width:1200px;margin:2rem auto;padding:0 1rem}img{max-width:100%;height:auto}table{border-collapse:collapse;width:100%}td,th{padding:.5rem;border:1px solid #bbb;text-align:left;overflow-wrap:anywhere}.scroll{overflow-x:auto}</style><h1>Task03-D Phase 3 — FPS initialization vs candidate distribution</h1><p>Run f36f1e9e2bb64866b8d6c792db158635. Frame 0 Box; FD2/PCA5; n=256, ratio=.25, threshold=20°, Box budget=127, Priority quota=32. Same-pair 2px AND 3mm matching; 103 GT rim line references.</p><p>GT rim marks and negative ROIs are evaluation only. Neither GT nor ROI enters initial-point choice or FPS. Only one shared initial point was tested; no new sampling policy was adopted.</p><p><a href="priority_fps_seed_control.json">priority_fps_seed_control.json</a> | <a href="source_hashes.json">source_hashes.json</a> | <a href="verification.json">verification.json</a> | <a href="tests.log">tests.log</a> | <a href="implementation.patch">implementation.patch</a> | <a href="git_start.json">git_start.json</a> | <a href="git_end.json">git_end.json</a> | <a href="report_snapshot.md">report_snapshot.md</a></p><p>Original read-only results: <a href="../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz">Task03 samples NPZ</a> | <a href="../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json">Task03 frame metrics</a> | <a href="../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json">Task03 config</a> | <a href="../d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json">Phase1 JSON</a> | <a href="../aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json">Phase2 JSON</a> | <a href="../../docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md">Markdown report</a></p><h2>Saved seeds: A Final and B Priority are separate stages</h2><p>A is stored final sampling (127 Box nodes in 256 total); B is the saved 32-node Priority subset. Seed 0 B reuses Phase2; seed 1/2 B use the existing matcher, without FPS replay.</p><div class="scroll"><table><tr><th>Method</th><th>Seed</th><th>First flat</th><th>First XYZ (m)</th><th>B Priority</th><th>A Final</th></tr><tr><td>S2</td><td>0</td><td>101598</td><td>[-0.04030468687415123, -0.06917968392372131, 0.30799999833106995]</td><td>13/103</td><td>16/103</td></tr><tr><td>S2</td><td>1</td><td>119061</td><td>[0.0423281267285347, -0.0462656244635582, 0.5040000081062317]</td><td>7/103</td><td>10/103</td></tr><tr><td>S2</td><td>2</td><td>112919</td><td>[0.0456230491399765, -0.06891991943120956, 0.4970000088214874]</td><td>7/103</td><td>10/103</td></tr><tr><td>S3</td><td>0</td><td>96553</td><td>[0.049605466425418854, -0.08068358898162842, 0.3059999942779541]</td><td>3/103</td><td>3/103</td></tr><tr><td>S3</td><td>1</td><td>117010</td><td>[0.03815624862909317, -0.056718748062849045, 0.527999997138977]</td><td>5/103</td><td>5/103</td></tr><tr><td>S3</td><td>2</td><td>102621</td><td>[-0.04191210865974426, -0.06742382794618607, 0.3109999895095825]</td><td>3/103</td><td>3/103</td></tr></table></div><h2>First selected points</h2><a href="seed_initial_points.png"><img src="seed_initial_points.png" alt="First saved Priority point of each seed"></a><h2>Saved coverage by stage</h2><a href="seed_priority_final_coverage.png"><img src="seed_priority_final_coverage.png" alt="Separate bars for B Priority and A Final coverage"></a><h2>C: common initial point control</h2><p>Shared intersection: 252; initial flat 114957; XYZ [0.030216798186302185, -0.07050585746765137, 0.5730000138282776]. Each method executes one existing FPS call, including the initial point in 32 unique nodes. C is Priority only; A and C are different sampling stages.</p><table><tr><th>Method</th><th>Nodes</th><th>Rim matching nodes</th><th>C Priority</th><th>Unique reference IDs</th></tr><tr><td>S2</td><td>32</td><td>3</td><td>8/103</td><td>[38, 40, 42, 78, 79, 80, 91, 92]</td></tr><tr><td>S3</td><td>32</td><td>1</td><td>3/103</td><td>[5, 6, 7]</td></tr></table><a href="shared_initial_overlay.png"><img src="shared_initial_overlay.png" alt="S2 and S3 2D Priority locations with the same initial point"></a><a href="shared_initial_coverage.png"><img src="shared_initial_coverage.png" alt="Control Priority coverage and unique rim reference positions"></a><p>Saved Priority ranges: S2 [7, 13], S3 [3, 5] references of 103. At shared initial 114957, S2 covers 8/103 and S3 3/103 (S2 minus S3: 5). This single initialization constrains interpretation to the fixed candidate sets and FPS conditions; candidate count, position, contamination and far depth have not been causally separated. S3 varies by 2 references (1.94 percentage points) across the three saved seeds. The shared-initial gap is 5 references, compared with saved Priority gaps 10/2/4; it is smaller than seed 0 and larger than seeds 1/2. This is descriptive initialization sensitivity, not a causal contribution estimate.</p><p>CPU NumPy offline analysis only. Simulator, renderer, CUDA, other frames/episodes and initialization sweeps were not executed.</p></html>12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152test_corrupt_source_feature_role_or_order_fails (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_corrupt_source_feature_role_or_order_fails) ... oktest_joint_same_pair_and_reference_dedup (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_joint_same_pair_and_reference_dedup) ... oktest_seed0_reused_and_only_seed1_2_matched_without_fps (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_seed0_reused_and_only_seed1_2_matched_without_fps) ... oktest_source_feature_role_alignment_without_fps (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_source_feature_role_alignment_without_fps) ... oktest_gt_annotation_change_cannot_change_control_selection (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_gt_annotation_change_cannot_change_control_selection) ... oktest_initial_included_total_32_exact_local_global_no_rng (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_initial_included_total_32_exact_local_global_no_rng) ... oktest_initial_path_never_constructs_rng_even_when_seed_changes (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_initial_path_never_constructs_rng_even_when_seed_changes) ... oktest_intersection_and_initial_mismatch_stop_before_fps (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_intersection_and_initial_mismatch_stop_before_fps) ... oktest_invalid_fps_order_is_rejected (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_invalid_fps_order_is_rejected) ... oktest_order_xyz_and_short_count_mismatch_stop_before_fps (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_order_xyz_and_short_count_mismatch_stop_before_fps) ... oktest_duplicate_xyz_and_annotation_independence (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_duplicate_xyz_and_annotation_independence) ... oktest_exact_tie_and_preselection_competition (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_exact_tie_and_preselection_competition) ... oktest_fps_consumes_one_initial_integer_draw (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_fps_consumes_one_initial_integer_draw) ... oktest_wrong_tie_winner_fails (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_wrong_tie_winner_fails) ... oktest_all_false_candidates_still_respect_contract_and_roles (visual.runtime.test.test_sampling.SamplingTests.test_all_false_candidates_still_respect_contract_and_roles) ... oktest_budget_ratio_observed_uniqueness_alignment_and_reproducibility (visual.runtime.test.test_sampling.SamplingTests.test_budget_ratio_observed_uniqueness_alignment_and_reproducibility) ... oktest_fps_seed_ties_initial_and_coincident_rows (visual.runtime.test.test_sampling.SamplingTests.test_fps_seed_ties_initial_and_coincident_rows) ... oktest_gt_not_accepted_and_rgb_cannot_change_selection (visual.runtime.test.test_sampling.SamplingTests.test_gt_not_accepted_and_rgb_cannot_change_selection) ... oktest_insufficient_both_empty_and_zero_budget (visual.runtime.test.test_sampling.SamplingTests.test_insufficient_both_empty_and_zero_budget) ... oktest_invalid_config_is_explicit (visual.runtime.test.test_sampling.SamplingTests.test_invalid_config_is_explicit) ... oktest_mask_cut_and_invalid_hole_not_structural_but_depth_step_separate (visual.runtime.test.test_sampling.SamplingTests.test_mask_cut_and_invalid_hole_not_structural_but_depth_step_separate) ... oktest_minimums_and_configurable_observation_allocation (visual.runtime.test.test_sampling.SamplingTests.test_minimums_and_configurable_observation_allocation) ... oktest_normal_and_candidate_regression_against_task02_all_fields (visual.runtime.test.test_sampling.SamplingTests.test_normal_and_candidate_regression_against_task02_all_fields) ... oktest_one_object_empty_current_observation_no_cache (visual.runtime.test.test_sampling.SamplingTests.test_one_object_empty_current_observation_no_cache) ... oktest_overlap_invalid_depth_and_input_immutability (visual.runtime.test.test_sampling.SamplingTests.test_overlap_invalid_depth_and_input_immutability) ... oktest_plane_has_no_invented_structural_and_equals_fps (visual.runtime.test.test_sampling.SamplingTests.test_plane_has_no_invented_structural_and_equals_fps) ... oktest_real_crease_priority_hits_visible_edge_and_spreads (visual.runtime.test.test_sampling.SamplingTests.test_real_crease_priority_hits_visible_edge_and_spreads) ... oktest_sparse_candidates_surface_fills_without_duplicates (visual.runtime.test.test_sampling.SamplingTests.test_sparse_candidates_surface_fills_without_duplicates) ... oktest_zero_ratio_matches_general_fps_for_every_method (visual.runtime.test.test_sampling.SamplingTests.test_zero_ratio_matches_general_fps_for_every_method) ... oktest_clustered_candidates_fps_covers_small_remote_region (visual.runtime.test.test_sampling_geometry.SamplingGeometryTests.test_clustered_candidates_fps_covers_small_remote_region) ... oktest_cuboid_visible_seam_is_preserved_by_priority (visual.runtime.test.test_sampling_geometry.SamplingGeometryTests.test_cuboid_visible_seam_is_preserved_by_priority) ... oktest_empty_reference_is_undefined_not_perfect (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_empty_reference_is_undefined_not_perfect) ... oktest_hole_reference_only_observed_entrance_not_hidden_projection (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_hole_reference_only_observed_entrance_not_hidden_projection) ... oktest_joint_tolerance_requires_same_pair (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_joint_tolerance_requires_same_pair) ... oktest_saved_evaluation_logging_all_frames_and_metadata (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_saved_evaluation_logging_all_frames_and_metadata) ... Output: /private/var/folders/_2/xcfq65k14fsfgp0n7w86w3_m0000gn/T/tmp1aofklug/out/e5479ff0bbbe43d58fb42565df8e7143Frames 1/2; 44 conditions eachoktest_staged_sweeps_cover_all_requested_values (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_staged_sweeps_cover_all_requested_values) ... oktest_tracking_and_sampling_losses_have_separate_denominators (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_tracking_and_sampling_losses_have_separate_denominators) ... oktest_empty_points_zero_observation_and_zero_visible (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_empty_points_zero_observation_and_zero_visible) ... oktest_general_fps_candidate_and_priority_are_inapplicable (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_general_fps_candidate_and_priority_are_inapplicable) ... oktest_geometry_alignment_invalid_depth_overlap_and_pixel_centres (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_geometry_alignment_invalid_depth_overlap_and_pixel_centres) ... oktest_historical_evaluation_changes_fail_closed (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_historical_evaluation_changes_fail_closed) ... oktest_invalid_nodes_and_non_partition_are_rejected (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_invalid_nodes_and_non_partition_are_rejected) ... oktest_negative_union_deduplicates_and_depth_bands_cover_paths (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_negative_union_deduplicates_and_depth_bands_cover_paths) ... oktest_reference_overlap_union_and_surface_outside_candidates (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_reference_overlap_union_and_surface_outside_candidates) ... oktest_two_different_nodes_cannot_satisfy_one_reference_pair (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_two_different_nodes_cannot_satisfy_one_reference_pair) ... ok
----------------------------------------------------------------------Ran 45 tests in 0.644s
OK123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259diff --git a/docs/visual-graph-integration/03_sampling.md b/docs/visual-graph-integration/03_sampling.mdindex acb3c0f..ac76cf2 100644--- a/docs/visual-graph-integration/03_sampling.md+++ b/docs/visual-graph-integration/03_sampling.md@@ -7,6 +7,10 @@ S4 depth-only 우선 선택은 이 조건에서 Peg 보존을 낮추고 가림· 이 수치는 **Tracker가 현재 관측한 reference 대비 Sampling 보존율**이다. 최종 detector, threshold, ratio 또는 feature 표현을 채택한 결과는 아니다. +후속 [Task03-D Box rim 병목 분석 Phase 1](03d_box_rim_bottleneck_phase1.md)은 저장된 frame 0/120의+관측·후보·priority·Surface coverage를 분리한다. Frame 0의 S3는 후보 coverage가 더 높지만+priority와 최종 coverage는 더 낮았다. 오염·원거리 depth·FPS 거리 경쟁의 인과 기여율은 미확인이다.+ 최종 run: `2551448b0fae4c6bbce3caf48774275f`. [전체 HTML](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.html), [전체 summary·설정·fidelity JSON](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json), [검증 기록](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/verification.json), [budget/ratio/false selection/latency 그림](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/tradeoffs.png),diff --git a/visual/runtime/test/sampling_evaluation.py b/visual/runtime/test/sampling_evaluation.pyindex ea0f223..e242ecc 100644--- a/visual/runtime/test/sampling_evaluation.py+++ b/visual/runtime/test/sampling_evaluation.py@@ -44,6 +44,25 @@ class CoverageMatcher: @staticmethod def key(px,m): return f'{px:g}px_{m*1000:g}mm' + def reference_hits(self, selected_flat, px=2., m=.003):+ """Reference IDs and matched source nodes from the existing joint adjacency.++ IDs are row positions in the saved reference arrays, not rounded pixels.+ A node can cover multiple IDs; multiple nodes covering one ID count once.+ """+ selected_flat = np.asarray(selected_flat)+ if selected_flat.ndim != 1 or selected_flat.dtype.kind not in 'iu':+ raise ValueError('source indices must be a one-dimensional integer array')+ if len(np.unique(selected_flat)) != len(selected_flat):+ raise ValueError('duplicate source nodes')+ rows = np.searchsorted(self.flat, selected_flat)+ if len(rows) and ((rows >= len(self.flat)).any()+ or not np.array_equal(self.flat[rows], selected_flat)):+ raise ValueError('evaluation points outside observed support')+ adjacency = self.adjacencies[self.key(px, m)][rows]+ return (np.flatnonzero(adjacency.getnnz(axis=0)),+ selected_flat[adjacency.getnnz(axis=1) > 0])+ def score(self, selected_flat): rows = np.searchsorted(self.flat, selected_flat) if len(rows) and ((rows >= len(self.flat)).any() or not np.array_equal(self.flat[rows], selected_flat)):@@ -78,6 +97,61 @@ class CoverageMatcher: return out, arrays +def count_ratio(numerator, denominator):+ """Preserve raw counts, including undefined zero-denominator fractions."""+ return dict(numerator=int(numerator), denominator=int(denominator),+ value=numerator/denominator if denominator else None)+++def staged_reference_coverage(matcher, candidates, priority, surface, final):+ """Saved-set diagnosis only; no candidate extraction or selection is run.++ C/P are None for the General FPS control, rather than empty candidate sets.+ Set differences overlap and must not be summed as causal loss fractions.+ """+ if (candidates is None) != (priority is None):+ raise ValueError('candidate and priority applicability must agree')+ nodes = dict(X=matcher.flat, C=candidates, P=priority, S=surface, F=final)+ hits, stages = {}, {}+ for name, flat in nodes.items():+ if flat is None:+ hits[name] = None+ stages[name] = None+ continue+ ids, matched = matcher.reference_hits(flat)+ hits[name] = set(ids.tolist())+ stages[name] = dict(node_count=len(flat), matched_node_count=len(matched),+ unique_reference_count=len(ids))+ p = np.asarray(priority if priority is not None else [], dtype=np.int64)+ if np.intersect1d(p, surface).size or set(final) != set(p) | set(surface):+ raise ValueError('final nodes must be the disjoint priority/surface union')+ if candidates is not None and not set(p) <= set(candidates):+ raise ValueError('priority nodes outside candidate support')+ v, o = set(range(matcher.nref)), hits['X']+ c, p, s, f = hits['C'], hits['P'], hits['S'], hits['F']+ if not f <= o or (c is not None and not c <= o):+ raise AssertionError('covered references outside observable references')+ if f != (p or set()) | s:+ raise AssertionError('final reference union differs from priority/surface')+ differences = {'V_minus_O': v-o, 'O_minus_F': o-f}+ if c is not None:+ differences.update(O_minus_C=o-c, C_minus_P=c-p, C_minus_F=c-f,+ P_intersect_S=p&s, S_minus_P=s-p, S_minus_C=s-c,+ C_minus_P_intersect_S=(c-p)&s)+ else:+ differences.update({key: None for key in ('O_minus_C', 'C_minus_P', 'C_minus_F',+ 'P_intersect_S', 'S_minus_P', 'S_minus_C', 'C_minus_P_intersect_S')})+ coverage = dict(observation=count_ratio(len(o), len(v)))+ for name, key in [('C', 'candidate'), ('P', 'priority'), ('S', 'surface'), ('F', 'final_retention')]:+ coverage[key] = count_ratio(len(hits[name]), len(o)) if hits[name] is not None else None+ return dict(stages=stages, coverage=coverage,+ gt_final_coverage=count_ratio(len(f), len(v)),+ reference_ids={k: sorted(ids) if ids is not None else None+ for k, ids in dict(V=v, O=o, **hits).items()},+ differences={k: dict(count=len(ids), reference_ids=sorted(ids)) if ids is not None else None+ for k, ids in differences.items()})++ def evaluation_context(frame, evidence, gt, camera, robot_ids): """Reuse unchanged Task02 visible seam/rim definition; GT read after extraction.""" truths, regions, maps = real_truth(frame, evidence.frame, gt, camera)diff --git a/visual/runtime/test/test_sampling_evaluation.py b/visual/runtime/test/test_sampling_evaluation.pyindex 798172c..6975e66 100644--- a/visual/runtime/test/test_sampling_evaluation.py+++ b/visual/runtime/test/test_sampling_evaluation.py@@ -13,7 +13,10 @@ from visual.runtime.rgbd import PEG, BOX from visual.runtime.sampling import extract_sampling_evidence, sample_points, SamplingConfig from visual.runtime.test.normal_diagnostics import synthetic_frame, oracle, box_primitives, rim_region from visual.runtime.test.run_structural_edges import rim_reference-from visual.runtime.test.sampling_evaluation import CoverageMatcher+from visual.runtime.test.sampling_evaluation import CoverageMatcher, staged_reference_coverage+from visual.runtime.test.run_rim_bottleneck import (+ geometry_evidence, validate_saved_selection, occupancy, source_contract,+) from visual.runtime.test.run_sampling import conditions, evaluate @@ -110,4 +113,135 @@ class SamplingEvaluationTests(unittest.TestCase): with self.assertRaises(ValueError):evaluate(episode,masks,root/'out',camera='camera',selected=(),make_plots=False) +class StagedCoverageTests(unittest.TestCase):+ def fixture(self):+ mask = np.zeros((16, 16), bool)+ mask[5, [3, 6, 10]] = True+ k = np.array([[1000., 0, 8], [0, 1000., 8], [0, 0, 1]])+ frame = synthetic_frame(np.full((16, 16), .3, np.float32), k, mask)+ geometry = build_organized_geometry(frame)+ uv = np.array([[2., 5], [4.5, 5], [7., 5], [10., 5]])+ xyz = np.tile(geometry.xyz[5, 6], (4, 1))+ matcher = CoverageMatcher(geometry, PEG, (uv, xyz))+ return frame, geometry, matcher++ def test_reference_overlap_union_and_surface_outside_candidates(self):+ _, _, matcher = self.fixture()+ c, p, s, f = [np.array(a, np.int64) for a in ([83, 86], [83], [86, 90], [90, 83, 86])]+ row = staged_reference_coverage(matcher, c, p, s, f)+ self.assertEqual(row['reference_ids']['C'], [0, 1, 2])+ self.assertEqual(row['reference_ids']['P'], [0, 1])+ self.assertEqual(row['reference_ids']['S'], [1, 2, 3])+ self.assertEqual(row['reference_ids']['F'], [0, 1, 2, 3])+ self.assertEqual(row['stages']['C'], dict(node_count=2, matched_node_count=2, unique_reference_count=3))+ expected = dict(V_minus_O=0, O_minus_C=1, C_minus_P=1, C_minus_F=0,+ P_intersect_S=1, S_minus_P=2, S_minus_C=1,+ C_minus_P_intersect_S=1, O_minus_F=0)+ self.assertEqual({k: v['count'] for k, v in row['differences'].items()}, expected)+ self.assertEqual(row['coverage']['candidate'], dict(numerator=3, denominator=4, value=.75))++ def test_two_different_nodes_cannot_satisfy_one_reference_pair(self):+ frame, _, _ = self.fixture()+ intrinsic = frame.intrinsic.copy(); intrinsic[0, 0] = 100.+ geometry = build_organized_geometry(replace(frame, intrinsic=intrinsic))+ # Node 83 satisfies 2D only; node 90 satisfies 3D only.+ matcher = CoverageMatcher(geometry, PEG, (np.array([[3., 5]]), geometry.xyz[5, 10][None]))+ ids, matched = matcher.reference_hits(np.array([83, 90]))+ self.assertEqual((len(ids), len(matched)), (0, 0))++ def test_empty_points_zero_observation_and_zero_visible(self):+ frame, geometry, matcher = self.fixture()+ empty = np.array([], np.int64)+ row = staged_reference_coverage(matcher, empty, empty, empty, empty)+ self.assertEqual(row['coverage']['final_retention'], dict(numerator=0, denominator=4, value=0.))+ geometry = build_organized_geometry(replace(frame, masks={PEG: np.zeros_like(frame.depth, bool)}))+ for refs in ((matcher.ref_uv, matcher.ref_xyz), (np.empty((0, 2)), np.empty((0, 3)))):+ row = staged_reference_coverage(CoverageMatcher(geometry, PEG, refs), empty, empty, empty, empty)+ self.assertEqual(row['coverage']['final_retention'], dict(numerator=0, denominator=0, value=None))+ self.assertEqual(row['coverage']['observation']['numerator'], 0)+ self.assertEqual(row['coverage']['observation']['denominator'], len(refs[0]))++ def test_general_fps_candidate_and_priority_are_inapplicable(self):+ _, _, matcher = self.fixture()+ flat = matcher.flat+ row = staged_reference_coverage(matcher, None, None, flat, flat)+ for name in ('C', 'P'):+ self.assertIsNone(row['stages'][name])+ self.assertIsNone(row['coverage']['candidate'])+ self.assertIsNone(row['coverage']['priority'])+ self.assertIsNone(row['differences']['O_minus_C'])+ self.assertEqual(row['coverage']['surface'], row['coverage']['final_retention'])++ def test_invalid_nodes_and_non_partition_are_rejected(self):+ _, _, matcher = self.fixture()+ for flat in (np.array([0]), np.array([83, 83]), np.array([256]), np.array([-1]), np.array([83.])):+ with self.assertRaises(ValueError):+ matcher.reference_hits(flat)+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, np.array([83]), np.array([86]), np.array([90]), np.array([86, 90]))+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, matcher.flat, np.array([83]), np.array([83, 90]), np.array([83, 90]))+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, matcher.flat, np.array([83]), np.array([90]), matcher.flat)++ def test_geometry_alignment_invalid_depth_overlap_and_pixel_centres(self):+ frame, _, _ = self.fixture()+ depth = frame.depth.copy()+ depth[5, 6] = 0+ depth[2, 2] = np.nan+ box = np.zeros_like(depth, bool)+ box[5, 10] = True # ambiguous in BOTH masks+ frame = replace(frame, depth=depth, masks={PEG: frame.masks[PEG], BOX: box})+ evidence = geometry_evidence(frame)+ geometry = evidence.frame.geometry+ self.assertEqual(np.flatnonzero(geometry.observed_mask(PEG)).tolist(), [83])+ self.assertFalse(geometry.observed_mask(BOX).any())+ self.assertTrue(np.isnan(geometry.xyz[5, 6]).all())+ z = float(depth[5, 3])+ np.testing.assert_allclose(geometry.xyz[5, 3], [(3.5-8)*z/1000, (5.5-8)*z/1000, z], rtol=1e-7)+ # Minimal evaluation adapter has exactly the existing validity ROI field.+ from visual.runtime.geometry import compute_geometric_features, GeometryParameters+ for oid in (PEG, BOX):+ features = compute_geometric_features(geometry, oid, np.full_like(geometry.xyz, np.nan),+ np.zeros_like(depth, bool), GeometryParameters())+ np.testing.assert_array_equal(evidence.frame.objects[oid].depth_validity_boundary,+ features.depth_validity_boundary)+ key = 'saved'+ archive = {'source_frame': np.array(frame.source_frame), 'shape': np.array(depth.shape),+ key+'/flat_index': np.array([83]), key+'/pixels_vu': np.array([[5, 3]]),+ key+'/object_id': np.array([PEG]), key+'/points': geometry.xyz[5, 3][None].copy(),+ key+'/priority_selected': np.array([False]), key+'/depth_priority_selected': np.array([False])}+ self.assertTrue(validate_saved_selection(archive, key, frame, geometry)['xyz_exact'])+ for field, corrupted in [('points', archive[key+'/points']+.001), ('pixels_vu', np.array([[5, 4]])),+ ('object_id', np.array([BOX]))]:+ with self.assertRaises((ValueError, AssertionError)):+ validate_saved_selection(dict(archive, **{key+'/'+field: corrupted}), key, frame, geometry)+ with self.assertRaises(ValueError):+ validate_saved_selection(dict(archive, source_frame=np.array(frame.source_frame+1)), key, frame, geometry)++ def test_negative_union_deduplicates_and_depth_bands_cover_paths(self):+ frame, _, matcher = self.fixture()+ a = np.zeros_like(frame.depth, bool); b = a.copy()+ a[5, [3, 6]] = True; b[5, [6, 10]] = True+ row = occupancy(frame, dict(X=matcher.flat, C=None, P=None, S=matcher.flat, F=matcher.flat), dict(a=a, b=b))+ roi = row['negative_roi']+ self.assertEqual(roi['a']['F']['count']+roi['b']['F']['count'], 4)+ self.assertEqual(roi['known_negative_union']['F']['count'], 3)+ self.assertIsNone(roi['known_negative_union']['P'])+ self.assertEqual(sum(v['numerator'] for v in row['depth_quantile_occupancy']['F'].values()), 3)++ def test_historical_evaluation_changes_fail_closed(self):+ import hashlib+ with tempfile.TemporaryDirectory() as directory:+ root = Path(directory)+ relative = 'visual/runtime/test/sampling_evaluation.py'+ snapshot = root/'evaluated_source'/relative+ snapshot.parent.mkdir(parents=True)+ source = Path(relative).read_text().replace('<= m', '<= m*2', 1)+ snapshot.write_text(source)+ config = {'source_sha256': {relative: hashlib.sha256(snapshot.read_bytes()).hexdigest()}}+ with self.assertRaisesRegex(ValueError, 'historical evaluation definition'):+ source_contract(root, config)++ if __name__=='__main__':unittest.main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255"""Organized, observation-only NumPy geometry diagnostics (Task 01).
All arrays retain the source (v, u) image layout. This is an internal baseline,not structural classification, sampling, or the final Vision--Graph interface.No RGB values, object GT, erosion, outlier removal, or reconstruction are used."""
from __future__ import annotations
from dataclasses import dataclassfrom time import perf_counter
import numpy as np
from visual.runtime.rgbd import BOX, PEG, TrackedRGBDFrame
@dataclass(frozen=True)class GeometryParameters: """Adjacent z jump > abs + rel * min(z1, z2), in metres.
These are diagnostic baseline thresholds, not edge-classification settings. The same gate prevents a normal stencil from crossing a detected z jump. """
depth_jump_abs_m: float = 0.01 depth_jump_rel: float = 0.02
def __post_init__(self) -> None: values = (self.depth_jump_abs_m, self.depth_jump_rel) if not np.isfinite(values).all() or min(values) < 0: raise ValueError("depth jump thresholds must be finite and nonnegative")
@dataclass(frozen=True)class OrganizedGeometry: """CV-camera XYZ in metres; invalid depth has three NaNs, never a point.
``xyz[v, u]`` corresponds to source pixel centre ``(u+.5, v+.5)``. Finite background geometry is retained, but only ``observed_mask(id)`` may be used as that object's points. Overlapping tracker masks are preserved and marked ambiguous; those pixels are excluded from BOTH object supports. """
xyz: np.ndarray valid_depth: np.ndarray object_masks: dict[int, np.ndarray] overlap_mask: np.ndarray
def observed_mask(self, object_id: int) -> np.ndarray: return self.object_masks[object_id] & self.valid_depth & ~self.overlap_mask
@dataclass(frozen=True)class GeometricFeatures: """Pixel-aligned diagnostics for one object, without semantic edge labels.
Unavailable floating features are NaN and have explicit validity masks. ``depth_jump_m`` compares a supported centre to ANY finite 4-neighbour, including other labels/background; it measures observation discontinuity. Mask, invalid-depth, and image boundaries are separate diagnostic flags. ``mask_boundary`` can include invalid/ambiguous mask pixels: it is NOT a point selection. Geometry selection always requires ``valid_points``. Normal variation is the maximum angle (radians) to supported same-object 4-neighbour normals; even a smooth curved surface can have a large value. """
object_mask: np.ndarray valid_points: np.ndarray normals: np.ndarray normal_valid: np.ndarray depth_jump_m: np.ndarray depth_pair_valid: np.ndarray depth_discontinuity: np.ndarray mask_boundary: np.ndarray depth_validity_boundary: np.ndarray image_boundary: np.ndarray normal_variation_rad: np.ndarray normal_variation_valid: np.ndarray normal_neighbor_count: np.ndarray
@dataclass(frozen=True)class GeometryFrame: source_frame: int camera: str frame_idx: int | None timestamp: float | None geometry: OrganizedGeometry objects: dict[int, GeometricFeatures] timings_ms: dict[str, float]
def build_organized_geometry(frame: TrackedRGBDFrame) -> OrganizedGeometry: """Adapt pointcloud.backproject's pixel-centre equations to dense layout.
Kept NumPy-only rather than importing the legacy plotting/SciPy module. No depth is filtered, filled, smoothed, or selected before feature analysis. """ depth = np.asarray(frame.depth) if depth.ndim != 2 or not min(depth.shape) or not np.issubdtype(depth.dtype, np.floating): raise ValueError("depth must be a nonempty floating point (H,W) array in metres") intrinsic = np.asarray(frame.intrinsic, dtype=np.float64) if (intrinsic.shape != (3, 3) or not np.isfinite(intrinsic).all() or intrinsic[0, 0] <= 0 or intrinsic[1, 1] <= 0): raise ValueError("intrinsic must be finite (3,3) with positive focal lengths") # The legacy equations assume the standard zero-skew CV pinhole intrinsic. if not np.allclose(intrinsic[[0, 1, 2, 2, 2], [1, 0, 0, 1, 2]], [0, 0, 0, 0, 1]): raise ValueError("intrinsic must use the standard zero-skew CV pinhole form") if set(frame.masks) - {PEG, BOX}: raise ValueError("unknown output object ID; expected PEG=0 or BOX=1") masks = {} for object_id in (PEG, BOX): mask = np.asarray(frame.masks.get(object_id, np.zeros(depth.shape, dtype=bool))) if mask.shape != depth.shape or mask.dtype != np.bool_: raise ValueError("object masks must be boolean (H,W) arrays matching depth") masks[object_id] = mask.copy() valid = np.isfinite(depth) & (depth > 0) xyz = np.full((*depth.shape, 3), np.nan, dtype=np.float32) v, u = np.nonzero(valid) # Exactly the equations in visual/scripts/pointcloud.py::backproject. z = depth[v, u] xyz[v, u, 0] = (u + 0.5 - intrinsic[0, 2]) * z / intrinsic[0, 0] xyz[v, u, 1] = (v + 0.5 - intrinsic[1, 2]) * z / intrinsic[1, 1] xyz[v, u, 2] = z if not np.isfinite(xyz[valid]).all(): raise ValueError("finite positive depth/intrinsic must yield representable float32 XYZ") return OrganizedGeometry(xyz, valid, masks, masks[PEG] & masks[BOX])
def _pairs(): """Each in-image horizontal/vertical pair once; no wrap or padded neighbours.""" yield (slice(None), slice(None, -1)), (slice(None), slice(1, None)) yield (slice(None, -1), slice(None)), (slice(1, None), slice(None))
def _jump(z1: np.ndarray, z2: np.ndarray, parameters: GeometryParameters) -> np.ndarray: # Inputs have invalid z replaced by zero by callers, avoiding NaN/Inf math. return np.abs(z1 - z2) > ( parameters.depth_jump_abs_m + parameters.depth_jump_rel * np.minimum(z1, z2) )
def estimate_surface_normals( geometry: OrganizedGeometry, object_id: int, parameters: GeometryParameters,) -> tuple[np.ndarray, np.ndarray]: """Central cross product from a full, same-object 5-pixel (+) stencil.
Centre and four neighbours must have unambiguous valid depth, and none of the four centre-to-neighbour pairs may exceed the z-jump gate. No one-sided fallback or extrapolation is performed at holes, mask/image borders, or tiny fragments. Unit normals point towards the camera (n dot XYZ <= 0). """ xyz = geometry.xyz normals = np.full_like(xyz, np.nan) normal_valid = np.zeros(geometry.valid_depth.shape, dtype=bool) if min(normal_valid.shape) < 3: return normals, normal_valid support = geometry.observed_mask(object_id) centre = (slice(1, -1), slice(1, -1)) neighbours = ((slice(1, -1), slice(None, -2)), (slice(1, -1), slice(2, None)), (slice(None, -2), slice(1, -1)), (slice(2, None), slice(1, -1))) usable = support[centre].copy() z = np.where(geometry.valid_depth, xyz[..., 2], 0) for neighbour in neighbours: usable &= support[neighbour] & ~_jump(z[centre], z[neighbour], parameters) # Compute only complete stencils, so invalid XYZ never enters a cross product. v, u = np.nonzero(usable) v, u = v + 1, u + 1 dx = xyz[v, u + 1].astype(np.float64) - xyz[v, u - 1] dy = xyz[v + 1, u].astype(np.float64) - xyz[v - 1, u] cross = np.cross(dx, dy) length = np.linalg.norm(cross, axis=1) good = np.isfinite(length) & (length > 0) v, u, cross = v[good], u[good], cross[good] / length[good, None] cross[np.einsum("ij,ij->i", cross, xyz[v, u]) > 0] *= -1 normals[v, u] = cross.astype(np.float32) normal_valid[v, u] = True return normals, normal_valid
def compute_geometric_features( geometry: OrganizedGeometry, object_id: int, normals: np.ndarray, normal_valid: np.ndarray, parameters: GeometryParameters,) -> GeometricFeatures: """Measure separate 4-neighbour boundary causes and local normal variation.""" mask = geometry.object_masks[object_id] support = geometry.observed_mask(object_id) shape = mask.shape z = np.where(geometry.valid_depth, geometry.xyz[..., 2], 0) jump_m = np.zeros(shape, np.float32) pair_valid = np.zeros(shape, bool) discontinuity = np.zeros(shape, bool) mask_boundary = np.zeros(shape, bool) validity_boundary = np.zeros(shape, bool) variation = np.zeros(shape, np.float32) count = np.zeros(shape, np.uint8) for a, b in _pairs(): both_depth = geometry.valid_depth[a] & geometry.valid_depth[b] dz = np.abs(z[a] - z[b]) jumps = both_depth & _jump(z[a], z[b], parameters) both_normals = normal_valid[a] & normal_valid[b] angle = np.zeros(both_normals.shape, np.float32) n1, n2 = normals[a][both_normals], normals[b][both_normals] # atan2 is stable near zero, including identical rounded float32 normals. angle[both_normals] = np.arctan2( np.linalg.norm(np.cross(n1, n2), axis=1), np.einsum("ij,ij->i", n1, n2) ) for p, q in ((a, b), (b, a)): available = support[p] & both_depth pair_valid[p] |= available np.maximum(jump_m[p], np.where(available, dz, 0), out=jump_m[p]) discontinuity[p] |= support[p] & jumps mask_boundary[p] |= mask[p] & ~mask[q] validity_boundary[p] |= support[p] & ~geometry.valid_depth[q] np.maximum(variation[p], angle, out=variation[p]) count[p] += both_normals jump_m[~pair_valid] = np.nan variation_valid = normal_valid & (count > 0) variation[~variation_valid] = np.nan image_boundary = np.zeros(shape, bool) image_boundary[[0, -1], :] = mask[[0, -1], :] image_boundary[:, [0, -1]] = mask[:, [0, -1]] return GeometricFeatures( object_mask=mask, valid_points=support, normals=normals, normal_valid=normal_valid, depth_jump_m=jump_m, depth_pair_valid=pair_valid, depth_discontinuity=discontinuity, mask_boundary=mask_boundary, depth_validity_boundary=validity_boundary, image_boundary=image_boundary, normal_variation_rad=variation, normal_variation_valid=variation_valid, normal_neighbor_count=count, )
def process_geometry( frame: TrackedRGBDFrame, parameters: GeometryParameters | None = None,) -> GeometryFrame: """Process one current observation; no cache, final classification, or RGB features.""" parameters = parameters or GeometryParameters() start = perf_counter() geometry = build_organized_geometry(frame) after_geometry = perf_counter() normals = {object_id: estimate_surface_normals(geometry, object_id, parameters) for object_id in geometry.object_masks} after_normals = perf_counter() features = {object_id: compute_geometric_features( geometry, object_id, *normals[object_id], parameters, ) for object_id in geometry.object_masks} end = perf_counter() timings = dict(geometry=(after_geometry - start) * 1000, normals=(after_normals - after_geometry) * 1000, discontinuity_features=(end - after_normals) * 1000, total=(end - start) * 1000) return GeometryFrame(frame.source_frame, frame.camera, frame.frame_idx, frame.timestamp, geometry, features, timings)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152test_corrupt_source_feature_role_or_order_fails (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_corrupt_source_feature_role_or_order_fails) ... oktest_joint_same_pair_and_reference_dedup (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_joint_same_pair_and_reference_dedup) ... oktest_seed0_reused_and_only_seed1_2_matched_without_fps (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_seed0_reused_and_only_seed1_2_matched_without_fps) ... oktest_source_feature_role_alignment_without_fps (visual.runtime.test.test_priority_fps_seed_control.SavedAnalysisTests.test_source_feature_role_alignment_without_fps) ... oktest_gt_annotation_change_cannot_change_control_selection (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_gt_annotation_change_cannot_change_control_selection) ... oktest_initial_included_total_32_exact_local_global_no_rng (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_initial_included_total_32_exact_local_global_no_rng) ... oktest_initial_path_never_constructs_rng_even_when_seed_changes (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_initial_path_never_constructs_rng_even_when_seed_changes) ... oktest_intersection_and_initial_mismatch_stop_before_fps (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_intersection_and_initial_mismatch_stop_before_fps) ... oktest_invalid_fps_order_is_rejected (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_invalid_fps_order_is_rejected) ... oktest_order_xyz_and_short_count_mismatch_stop_before_fps (visual.runtime.test.test_priority_fps_seed_control.SharedInitialTests.test_order_xyz_and_short_count_mismatch_stop_before_fps) ... oktest_duplicate_xyz_and_annotation_independence (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_duplicate_xyz_and_annotation_independence) ... oktest_exact_tie_and_preselection_competition (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_exact_tie_and_preselection_competition) ... oktest_fps_consumes_one_initial_integer_draw (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_fps_consumes_one_initial_integer_draw) ... oktest_wrong_tie_winner_fails (visual.runtime.test.test_priority_fps_trace.PriorityFPSTraceTests.test_wrong_tie_winner_fails) ... oktest_all_false_candidates_still_respect_contract_and_roles (visual.runtime.test.test_sampling.SamplingTests.test_all_false_candidates_still_respect_contract_and_roles) ... oktest_budget_ratio_observed_uniqueness_alignment_and_reproducibility (visual.runtime.test.test_sampling.SamplingTests.test_budget_ratio_observed_uniqueness_alignment_and_reproducibility) ... oktest_fps_seed_ties_initial_and_coincident_rows (visual.runtime.test.test_sampling.SamplingTests.test_fps_seed_ties_initial_and_coincident_rows) ... oktest_gt_not_accepted_and_rgb_cannot_change_selection (visual.runtime.test.test_sampling.SamplingTests.test_gt_not_accepted_and_rgb_cannot_change_selection) ... oktest_insufficient_both_empty_and_zero_budget (visual.runtime.test.test_sampling.SamplingTests.test_insufficient_both_empty_and_zero_budget) ... oktest_invalid_config_is_explicit (visual.runtime.test.test_sampling.SamplingTests.test_invalid_config_is_explicit) ... oktest_mask_cut_and_invalid_hole_not_structural_but_depth_step_separate (visual.runtime.test.test_sampling.SamplingTests.test_mask_cut_and_invalid_hole_not_structural_but_depth_step_separate) ... oktest_minimums_and_configurable_observation_allocation (visual.runtime.test.test_sampling.SamplingTests.test_minimums_and_configurable_observation_allocation) ... oktest_normal_and_candidate_regression_against_task02_all_fields (visual.runtime.test.test_sampling.SamplingTests.test_normal_and_candidate_regression_against_task02_all_fields) ... oktest_one_object_empty_current_observation_no_cache (visual.runtime.test.test_sampling.SamplingTests.test_one_object_empty_current_observation_no_cache) ... oktest_overlap_invalid_depth_and_input_immutability (visual.runtime.test.test_sampling.SamplingTests.test_overlap_invalid_depth_and_input_immutability) ... oktest_plane_has_no_invented_structural_and_equals_fps (visual.runtime.test.test_sampling.SamplingTests.test_plane_has_no_invented_structural_and_equals_fps) ... oktest_real_crease_priority_hits_visible_edge_and_spreads (visual.runtime.test.test_sampling.SamplingTests.test_real_crease_priority_hits_visible_edge_and_spreads) ... oktest_sparse_candidates_surface_fills_without_duplicates (visual.runtime.test.test_sampling.SamplingTests.test_sparse_candidates_surface_fills_without_duplicates) ... oktest_zero_ratio_matches_general_fps_for_every_method (visual.runtime.test.test_sampling.SamplingTests.test_zero_ratio_matches_general_fps_for_every_method) ... oktest_clustered_candidates_fps_covers_small_remote_region (visual.runtime.test.test_sampling_geometry.SamplingGeometryTests.test_clustered_candidates_fps_covers_small_remote_region) ... oktest_cuboid_visible_seam_is_preserved_by_priority (visual.runtime.test.test_sampling_geometry.SamplingGeometryTests.test_cuboid_visible_seam_is_preserved_by_priority) ... oktest_empty_reference_is_undefined_not_perfect (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_empty_reference_is_undefined_not_perfect) ... oktest_hole_reference_only_observed_entrance_not_hidden_projection (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_hole_reference_only_observed_entrance_not_hidden_projection) ... oktest_joint_tolerance_requires_same_pair (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_joint_tolerance_requires_same_pair) ... oktest_saved_evaluation_logging_all_frames_and_metadata (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_saved_evaluation_logging_all_frames_and_metadata) ... Output: /private/var/folders/_2/xcfq65k14fsfgp0n7w86w3_m0000gn/T/tmpo_mqfxya/out/3882b66597fa4b8abaf78f63860f44bbFrames 1/2; 44 conditions eachoktest_staged_sweeps_cover_all_requested_values (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_staged_sweeps_cover_all_requested_values) ... oktest_tracking_and_sampling_losses_have_separate_denominators (visual.runtime.test.test_sampling_evaluation.SamplingEvaluationTests.test_tracking_and_sampling_losses_have_separate_denominators) ... oktest_empty_points_zero_observation_and_zero_visible (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_empty_points_zero_observation_and_zero_visible) ... oktest_general_fps_candidate_and_priority_are_inapplicable (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_general_fps_candidate_and_priority_are_inapplicable) ... oktest_geometry_alignment_invalid_depth_overlap_and_pixel_centres (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_geometry_alignment_invalid_depth_overlap_and_pixel_centres) ... oktest_historical_evaluation_changes_fail_closed (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_historical_evaluation_changes_fail_closed) ... oktest_invalid_nodes_and_non_partition_are_rejected (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_invalid_nodes_and_non_partition_are_rejected) ... oktest_negative_union_deduplicates_and_depth_bands_cover_paths (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_negative_union_deduplicates_and_depth_bands_cover_paths) ... oktest_reference_overlap_union_and_surface_outside_candidates (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_reference_overlap_union_and_surface_outside_candidates) ... oktest_two_different_nodes_cannot_satisfy_one_reference_pair (visual.runtime.test.test_sampling_evaluation.StagedCoverageTests.test_two_different_nodes_cannot_satisfy_one_reference_pair) ... ok
----------------------------------------------------------------------Ran 45 tests in 0.644s
OK123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266"""Current-observation Structural priority / Surface FPS, internal NumPy metadata.
No GT, cache, final node features, graph edges or Vision--Graph packaging. XYZremains in the source CV-camera frame. Selection roles are not semantic types."""from __future__ import annotations
from dataclasses import dataclass, fieldfrom numbers import Integralfrom time import perf_counter
import numpy as np
from visual.runtime.geometry import ( GeometryFrame, GeometryParameters, estimate_surface_normals,)from visual.runtime.pca import build_geometry, cropped_features, local_plane_optimizedfrom visual.runtime.normal_estimators import finite_differencefrom visual.runtime.edge_evidence import PairEvidence, pair_evidencefrom visual.runtime.rgbd import PEG, BOX, TrackedRGBDFrame
METHODS = ('S0', 'S1', 'S2', 'S3', 'S4')
def _integer(value, name): if not isinstance(value, Integral) or isinstance(value, (bool, np.bool_)) or value < 0: raise ValueError(f'{name} must be a nonnegative integer')
@dataclass(frozen=True)class SamplingConfig: """Experimental defaults, not adopted architecture/hyperparameters.
Reserve minimums first, then apportion remaining capacity by observed point counts (or their square roots). Largest remainder, capped by availability; exact ties use ascending object ID. Structural slots are a GLOBAL maximum floor(num_points*ratio), including independently capped S4 depth-only slots. """ num_points: int = 256 structural_ratio: float = .25 min_points: tuple[int, int] = (16, 16) allocation: str = 'observed_points' seed: int = 0 orientation_threshold_deg: float = 20. depth_priority_fraction: float = .25 sampling: str = 'fps'
def __post_init__(self): _integer(self.num_points, 'num_points'); _integer(self.seed, 'seed') if len(self.min_points) != 2: raise ValueError('min_points must contain Peg and Box minimums') for n in self.min_points: _integer(n, 'object minimum') if sum(self.min_points) > self.num_points: raise ValueError('sum of object minimums exceeds num_points') for name in ('structural_ratio', 'depth_priority_fraction'): x = getattr(self, name) if not np.isfinite(x) or not 0 <= x <= 1: raise ValueError(f'{name} must be finite in [0,1]') if not np.isfinite(self.orientation_threshold_deg) or not 0 <= self.orientation_threshold_deg <= 180: raise ValueError('orientation threshold must be in [0,180] degrees') if self.allocation not in ('observed_points', 'sqrt_observed_points'): raise ValueError('unknown allocation rule') if self.sampling != 'fps': raise ValueError('only fps sampling is supported')
def allocate_budget(total, capacities, minimums=(0, 0), weights=None): """Capped proportional integer apportionment, deterministic and availability aware.""" _integer(total, 'budget') cap = np.asarray(capacities) mins = np.asarray(minimums) if cap.shape != (2,) or mins.shape != (2,): raise ValueError('expected two object counts') for x in (*cap, *mins): _integer(x, 'capacity/minimum') if mins.sum() > total: raise ValueError('minimums exceed total budget') cap, mins = cap.astype(np.int64), mins.astype(np.int64) weight = cap.astype(float) if weights is None else np.asarray(weights, float) if weight.shape != (2,) or not np.isfinite(weight).all() or (weight < 0).any(): raise ValueError('weights must be two finite nonnegative values') out = np.minimum(cap, mins) left = min(total, int(cap.sum()))-int(out.sum()) while left: room = cap-out w = np.where(room > 0, weight, 0) if not w.any(): w = (room > 0).astype(float) quota = left*w/w.sum() take = np.minimum(room, np.floor(quota).astype(np.int64)) out += take; left -= int(take.sum()) # Largest fractional remainder; saturated objects are skipped. If a # quota exceeded capacity, the next pass redistributes the surplus. order = np.argsort(-(quota-np.floor(quota)), kind='stable') for i in order: if out[i] < cap[i] and left: out[i] += 1; left -= 1 return out
def fps_indices(points, count, *, seed=0, initial=()): """Legacy pointcloud.fps distance update, returning unique source row indices.
No random pre-reduction. Uniform seeded first row; argmax ties choose the first source row. An initial selection seeds distances for Surface coverage. All initial rows precede newly selected rows. Even coincident XYZ is never selected twice by row index. Computes squared distances in float64. """ _integer(count, 'FPS count'); _integer(seed, 'FPS seed') xyz = np.asarray(points, dtype=float) if xyz.ndim != 2 or xyz.shape[1] != 3 or not np.isfinite(xyz).all(): raise ValueError('FPS requires finite [N,3] observed coordinates') initial = np.asarray(initial, dtype=np.int64) if initial.ndim != 1 or len(np.unique(initial)) != len(initial) or ((initial < 0) | (initial >= len(xyz))).any(): raise ValueError('initial FPS rows must be distinct valid indices') count = min(count, len(xyz)) if len(initial) > count: raise ValueError('initial rows exceed FPS count') if not count: return np.empty(0, np.int64) chosen = list(initial) distance = np.full(len(xyz), np.inf) x, y, z = (np.ascontiguousarray(xyz[:, i]) for i in range(3)) def update(j): np.minimum(distance, (x-x[j])**2+(y-y[j])**2+(z-z[j])**2, out=distance) distance[j] = -np.inf for j in chosen: update(j) if not chosen: chosen.append(int(np.random.default_rng(seed).integers(len(xyz)))) update(chosen[-1]) while len(chosen) < count: j = int(distance.argmax()); chosen.append(j); update(j) return np.asarray(chosen, np.int64)
@dataclass(frozen=True)class SamplingEvidence: """Detector output before thresholding. Contains observations only.""" frame: GeometryFrame pairs: dict[int, PairEvidence] estimator: str timings_ms: dict[str, float]
@dataclass(frozen=True)class ObjectCandidates: """Only valid observed rows, in original raster order; all evidence stays aligned.""" flat_index: np.ndarray points: np.ndarray metadata: dict[str, np.ndarray]
@dataclass(frozen=True)class SampledPoints: """Internal selection, variable N; no padding, no final GNN feature encoding.
priority_selected / depth_priority_selected record selection paths, whereas metadata['structural_candidate'] records detector eligibility. Surface FPS may select more detector candidates than the structural priority slot cap. """ source_frame: int camera: str points: np.ndarray pixels_vu: np.ndarray flat_index: np.ndarray object_id: np.ndarray priority_selected: np.ndarray depth_priority_selected: np.ndarray metadata: dict[str, np.ndarray] object_budgets: dict[int, int] counts: dict[int, dict[str, int]] timings_ms: dict[str, float] = field(default_factory=dict)
def extract_sampling_evidence(frame: TrackedRGBDFrame, estimator='pca5', parameters=GeometryParameters()): """Reuse Task02 estimators and pair operator; optimized PCA5 analytic solver.""" if estimator not in ('baseline', 'fd2', 'pca5'): raise ValueError('unknown normal estimator') t0 = perf_counter(); geometry = build_geometry(frame); t1 = perf_counter() normals = {} for oid in (PEG, BOX): if estimator == 'baseline': normals[oid] = estimate_surface_normals(geometry, oid, parameters) elif estimator == 'fd2': normals[oid] = finite_difference(geometry, oid, 2, parameters) else: normals[oid] = local_plane_optimized(geometry, oid, parameters, solver='analytic') t2 = perf_counter() features = {i: cropped_features(geometry, i, *normals[i], parameters) for i in (PEG, BOX)} t3 = perf_counter() pairs = {i: pair_evidence(geometry, i, *normals[i], parameters) for i in (PEG, BOX)} t4 = perf_counter() timing = dict(geometry=(t1-t0)*1000, normals=(t2-t1)*1000, features=(t3-t2)*1000, pair_evidence=(t4-t3)*1000, extraction_total=(t4-t0)*1000) result = GeometryFrame(frame.source_frame, frame.camera, frame.frame_idx, frame.timestamp, geometry, features, timing) return SamplingEvidence(result, pairs, estimator, timing)
def extract_candidates(evidence: SamplingEvidence, config: SamplingConfig, method='S3'): """Threshold at observed pixels; boundary flags alone never imply eligibility.""" if method not in METHODS: raise ValueError('unknown sampling method') expected = dict(S1='baseline', S2='fd2', S3='pca5', S4='pca5') if method in expected and evidence.estimator != expected[method]: raise ValueError('method and normal estimator disagree') g = evidence.frame.geometry result = {} for oid in (PEG, BOX): idx = np.flatnonzero(g.observed_mask(oid)) f = evidence.frame.objects[oid] maps = evidence.pairs[oid].candidates(config.orientation_threshold_deg) metadata = {name: getattr(f, name).reshape((-1, 3) if name == 'normals' else (-1,))[idx].copy() for name in f.__dataclass_fields__} metadata.update({f'{name}_evidence': m.ravel()[idx] for name, m in maps.items() if name != 'union'}) orientation = maps['orientation'].ravel()[idx] depth_only = maps['depth'].ravel()[idx] & ~orientation metadata.update(orientation_score_deg=np.rad2deg(f.normal_variation_rad.ravel()[idx]), orientation_candidate=orientation, depth_only_candidate=depth_only, structural_candidate=orientation | (depth_only if method == 'S4' and config.depth_priority_fraction > 0 else False)) result[oid] = ObjectCandidates(idx, g.xyz.reshape(-1, 3)[idx].copy(), metadata) return result
def sample_points(evidence: SamplingEvidence, config=SamplingConfig(), *, method='S3'): """Object budgets -> Structural FPS -> remaining-support FPS seeded by priority.""" t0 = perf_counter(); objects = extract_candidates(evidence, config, method); t1 = perf_counter() available = np.array([len(objects[i].points) for i in (PEG, BOX)]) weights = np.sqrt(available) if config.allocation == 'sqrt_observed_points' else available budgets = allocate_budget(config.num_points, available, config.min_points, weights) cap = int(np.floor(config.num_points*config.structural_ratio)) if method != 'S0' else 0 capacities = np.array([min(budgets[i], int(objects[i].metadata['structural_candidate'].sum())) for i in (PEG, BOX)]) slots = allocate_budget(cap, capacities, weights=budgets) depth_cap = int(np.floor(cap*config.depth_priority_fraction)) if method == 'S4' else 0 depth_capacity = [min(slots[i], int(objects[i].metadata['depth_only_candidate'].sum())) for i in (PEG, BOX)] depth_slots = allocate_budget(depth_cap, depth_capacity, weights=budgets) t2 = perf_counter() selections, priority_sizes, depth_sizes = {}, {}, {} for i in (PEG, BOX): obj = objects[i]; m = obj.metadata # Each object always uses its own stream, invariant to missing other objects. seed = int(np.random.SeedSequence([config.seed, i]).generate_state(1)[0]) oi = np.flatnonzero(m['orientation_candidate']) di = np.flatnonzero(m['depth_only_candidate']) # Unused depth reservation can be used by orientation, never vice versa. dn = min(int(depth_slots[i]), len(di)) on = min(int(slots[i])-dn, len(oi)) orientation = oi[fps_indices(obj.points[oi], on, seed=seed)] depth = di[fps_indices(obj.points[di], dn, seed=seed,)] selections[i] = np.concatenate((orientation, depth)) priority_sizes[i], depth_sizes[i] = on+dn, dn t3 = perf_counter() for i in (PEG, BOX): seed = int(np.random.SeedSequence([config.seed, i]).generate_state(1)[0]) selections[i] = fps_indices(objects[i].points, int(budgets[i]), seed=seed, initial=selections[i]) t4 = perf_counter() flat, xyz, ids, priority, depth_priority, metadata = [], [], [], [], [], {} counts = {} for i in (PEG, BOX): obj = objects[i]; rows = selections[i]; n = len(rows); pn = priority_sizes[i]; dn = depth_sizes[i] flat.append(obj.flat_index[rows]); xyz.append(obj.points[rows]); ids.append(np.full(n, i, np.int64)) priority.append(np.arange(n) < pn) depth_priority.append((np.arange(n) >= pn-dn) & (np.arange(n) < pn)) for name, values in obj.metadata.items(): metadata.setdefault(name, []).append(values[rows]) counts[i] = dict(observed=len(obj.points), budget=int(budgets[i]), candidates=int(obj.metadata['structural_candidate'].sum()), priority=pn, orientation_priority=pn-dn, depth_priority=dn, surface_fps=n-pn, selected_candidates=int(obj.metadata['structural_candidate'][rows].sum()), selected=n) flat = np.concatenate(flat) timing = dict(candidate_selection=(t1-t0)*1000, budget_allocation=(t2-t1)*1000, structural_sampling=(t3-t2)*1000, surface_fps=(t4-t3)*1000) result = SampledPoints(evidence.frame.source_frame, evidence.frame.camera, np.concatenate(xyz), np.column_stack(np.unravel_index(flat, evidence.frame.geometry.valid_depth.shape)), flat, np.concatenate(ids), np.concatenate(priority), np.concatenate(depth_priority), {k: np.concatenate(v) for k, v in metadata.items()}, {i: int(budgets[i]) for i in (PEG, BOX)}, counts, timing) timing['sampling_total'] = (perf_counter()-t0)*1000 timing['geometry_sampling_total'] = evidence.timings_ms['extraction_total']+timing['sampling_total'] return result123version https://git-lfs.github.com/spec/v1oid sha256:56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266bsize 488117123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263{ "status": "PASS", "required_tests": { "status": "PASS", "summary": "Ran 45 tests in 0.644s; OK", "modules": [ "visual.runtime.test.test_priority_fps_seed_control", "visual.runtime.test.test_priority_fps_trace", "visual.runtime.test.test_sampling", "visual.runtime.test.test_sampling_geometry", "visual.runtime.test.test_sampling_evaluation" ] }, "source_and_input_contract": "PASS", "seed0_phase2_ids_reused": "PASS", "saved_source_feature_role_alignment": "PASS", "saved_analysis_fps_calls": 0, "shared_candidate_count": 252, "shared_initial": 114957, "initial_xyz_exact": "PASS", "initial_rng_draws": 0, "real_fps_calls": { "S2": 1, "S3": 1 }, "unique_count_includes_initial": 32, "raster_local_global_membership": "PASS", "gt_annotation_independence": "PASS (synthetic tests; no GT argument in selection)", "same_pair_joint_matching_and_reference_dedup": "PASS", "negative_roi_union": "PASS", "inputs_unchanged": "PASS", "original_preservation": { "status": "PASS", "protected_file_count": 1289, "all_sha256_unchanged": true }, "skipped": [ "simulator", "renderer", "GPU/CUDA", "other frame/episode", "initialization sweep", "new sampling policy", "external upload", "dependency installation", "commit" ], "html_and_markdown_local_links": { "status": "PASS", "markdown_link_count": 21 }, "png_readback": "PASS (all 4 PNGs decoded; dynamic bounds include all initial/selected points)", "report_refresh": { "status": "PASS", "only_saved_results": true, "real_fps_reexecuted": false }, "git_diff_check": "PASS (existing diff and all three new files)", "scope_check": "PASS (only two implementation/test files plus requested Markdown added)", "source_snapshots": "PASS (executed and final presentation sources separately hashed)", "visual_review": "PASS (4 PNGs inspected; all six first points and all 64 control selections within axes)", "artifact_registration": "PASS (finished local run, registered output sidecars present)"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244"""Phase3 contracts. All FPS calls here use synthetic points, never Task03 data."""import copyfrom types import SimpleNamespaceimport unittestfrom unittest.mock import patch
import numpy as np
from visual.runtime.rgbd import PEG, BOXfrom visual.runtime.sampling import fps_indicesfrom visual.runtime.test import run_priority_fps_seed_control as controlfrom visual.runtime.test.sampling_evaluation import CoverageMatcher
class Archive(dict): @property def files(self): return list(self)
def synthetic_candidates(): # Common source pixels always point at exactly the same source XYZ. def method(flat): xyz = np.column_stack((np.sin(flat*.3), np.cos(flat*.2), flat*.01)).astype(np.float32) return dict(flat=flat, points=xyz) return dict(S2=method(np.arange(100, 148)), S3=method(np.arange(108, 156)))
def saved_fixture(): """Synthetic 256-row archives with the real shape/quota/field contracts.""" shape = (512, 512) flat = np.arange(np.prod(shape)) xyz = np.column_stack((flat*.001, flat*.002, np.ones(len(flat)))).astype(np.float32).reshape(*shape, 3) geometry = SimpleNamespace(xyz=xyz, observed_mask=lambda oid: (flat < 90000 if oid == PEG else flat >= 90000).reshape(shape)) frame = SimpleNamespace(source_frame=0, depth=np.ones(shape, np.float32)) archive = Archive(source_frame=np.array(0), shape=np.array(shape)) config, metrics, phase2 = dict(conditions={}), {}, dict(methods={}) field_names = ['object_mask', 'valid_points', 'normals', 'normal_valid', 'depth_jump_m', 'depth_pair_valid', 'depth_discontinuity', 'mask_boundary', 'depth_validity_boundary', 'image_boundary', 'normal_variation_rad', 'normal_variation_valid', 'normal_neighbor_count', 'orientation_evidence', 'depth_evidence', 'occluding_evidence', 'occluded_evidence', 'invalid_evidence', 'mask_evidence', 'orientation_score_deg', 'orientation_candidate', 'depth_only_candidate', 'structural_candidate'] for method, (estimator, _, count, _, _) in control.METHODS.items(): candidates = np.sort(np.r_[np.arange(90000, 90000+count-3), control.FIRST[method]]) archive[f'evidence/{estimator}/1/20/orientation_flat'] = candidates phase2['methods'][method] = dict(candidate_flat_indices=candidates.tolist()) for seed in (0, 1, 2): key = f'{method}_n256_r0.25_t20_s{seed}' config['conditions'][key] = dict(method=method, num_points=256, structural_ratio=.25, orientation_threshold_deg=20, seed=seed) first = control.FIRST[method][seed] selected = np.r_[np.arange(129), first, candidates[candidates != first][:126]] box = np.arange(256) >= 129 archive[key+'/flat_index'] = selected archive[key+'/points'] = xyz.reshape(-1, 3)[selected] archive[key+'/pixels_vu'] = np.column_stack(np.unravel_index(selected, shape)) archive[key+'/object_id'] = box.astype(np.int64) archive[key+'/priority_selected'] = np.r_[np.arange(129) < 32, np.arange(127) < 32] archive[key+'/depth_priority_selected'] = np.zeros(256, bool) for name in field_names: value = np.zeros((256, 3), np.float32) if name == 'normals' else np.zeros(256, bool) if name in ('object_mask', 'valid_points'): value[:] = True if name in ('orientation_candidate', 'structural_candidate'): value[box] = True archive[key+'/metadata/'+name] = value objects = {} for name, budget in [('peg', 129), ('box', 127)]: objects[name] = dict(counts=dict(budget=budget, selected=budget, priority=32, orientation_priority=32, depth_priority=0, surface_fps=budget-32)) n = control.FINAL[method][seed] objects['box']['structural'] = dict(tolerance={'2px_3mm': dict(gt_visible=103, sampled=n, gt_coverage=n/103)}) metrics[key] = dict(objects=objects) return archive, config, metrics, frame, geometry, phase2
class SharedInitialTests(unittest.TestCase): def select(self, candidates=None): return control.select_control(synthetic_candidates() if candidates is None else candidates, expected_shared=40, expected_initial=128)
def test_initial_included_total_32_exact_local_global_no_rng(self): candidates = synthetic_candidates() before = copy.deepcopy(candidates) with patch.object(control, 'fps_indices', wraps=fps_indices) as calls: orders, info = self.select(candidates) self.assertEqual(calls.call_count, 2) self.assertEqual(info['candidate_local_index'], {'S2': 28, 'S3': 20}) self.assertEqual(info['initial_rng_draws'], 0) for method, row in orders.items(): self.assertEqual(len(row['flat']), 32) self.assertEqual(len(set(row['flat'])), 32) self.assertEqual(row['flat'][0], 128) np.testing.assert_array_equal(candidates[method]['flat'][row['local']], row['flat']) np.testing.assert_array_equal(candidates[method]['points'][row['local']], row['xyz']) for field in ('flat', 'points'): np.testing.assert_array_equal(candidates[method][field], before[method][field]) np.testing.assert_array_equal(orders['S2']['xyz'][0], orders['S3']['xyz'][0])
def test_initial_path_never_constructs_rng_even_when_seed_changes(self): points = synthetic_candidates()['S2']['points'] with patch('visual.runtime.sampling.np.random.default_rng', side_effect=AssertionError('RNG draw')): a = fps_indices(points, 32, seed=0, initial=[28]) b = fps_indices(points, 32, seed=98765, initial=[28]) np.testing.assert_array_equal(a, b) self.assertEqual(a[0], 28)
def test_intersection_and_initial_mismatch_stop_before_fps(self): for kwargs in (dict(expected_shared=39, expected_initial=128), dict(expected_shared=40, expected_initial=127)): with patch.object(control, 'fps_indices', side_effect=AssertionError('must stop before FPS')): with self.assertRaises(ValueError): control.select_control(synthetic_candidates(), **kwargs)
def test_order_xyz_and_short_count_mismatch_stop_before_fps(self): for mutation in ('order', 'xyz', 'count'): c = synthetic_candidates() if mutation == 'order': c['S2']['flat'] = c['S2']['flat'][::-1] elif mutation == 'xyz': c['S3']['points'][20, 0] += .001 else: c['S2'] = {k: v[:31] for k, v in c['S2'].items()} with patch.object(control, 'fps_indices', side_effect=RuntimeError('must stop before FPS')): with self.assertRaises((ValueError, AssertionError)): self.select(c)
def test_invalid_fps_order_is_rejected(self): for order in (np.zeros(32, np.int64), np.arange(31), np.r_[28, np.arange(30), 999]): with patch.object(control, 'fps_indices', return_value=order): with self.assertRaises(ValueError): self.select() with patch.object(control, 'fps_indices', return_value=np.arange(32)): with self.assertRaisesRegex(ValueError, 'initial included'): self.select()
def test_gt_annotation_change_cannot_change_control_selection(self): candidates = synthetic_candidates() orders_a, _ = self.select(candidates) xyz = np.zeros((1, 200, 3), np.float32) geometry = SimpleNamespace(valid_depth=np.ones((1, 200), bool), xyz=xyz, observed_mask=lambda oid: np.ones((1, 200), bool)) frame = SimpleNamespace(depth=np.ones((1, 200), np.float32)) annotations = [((np.array([[128., 0.]]), np.zeros((1, 3))), np.zeros((1, 200), bool)), ((np.array([[999., 999.]]), np.ones((1, 3))*100), np.ones((1, 200), bool))] scores = [] for refs, negative in annotations: matcher = CoverageMatcher(geometry, BOX, refs) scores.append(control.score_control(orders_a, matcher, frame, {'negative': negative})) orders_b, _ = self.select(candidates) # synthetic repeat only for method in control.METHODS: np.testing.assert_array_equal(orders_a[method]['flat'], orders_b[method]['flat']) self.assertNotEqual(scores[0][method]['negative_roi'], scores[1][method]['negative_roi']) with self.assertRaises(TypeError): control.select_control(candidates, gt={})
class SavedAnalysisTests(unittest.TestCase): def test_source_feature_role_alignment_without_fps(self): fixture = saved_fixture() with control.forbid_sampling(): candidates, selected, checks = control.load_saved(*fixture) self.assertEqual(len(checks), 6) for method in control.METHODS: self.assertEqual(len(candidates[method]['flat']), control.METHODS[method][2]) for seed in (0, 1, 2): self.assertEqual(selected[method][seed]['flat'][0], control.FIRST[method][seed]) self.assertTrue(all(c['feature_and_role_alignment'] for c in checks.values()))
def test_corrupt_source_feature_role_or_order_fails(self): key = 'S2_n256_r0.25_t20_s1' for field in ('points', 'metadata/normals', 'metadata/orientation_candidate', 'priority_selected', 'pixels_vu'): fixture = saved_fixture() array = fixture[0][key+'/'+field] fixture[0][key+'/'+field] = array.copy() array = fixture[0][key+'/'+field] if field == 'metadata/normals': array[0, 0] = 1 # same source pixel, inconsistent saved feature elif field == 'priority_selected': array[129] = False elif field == 'metadata/orientation_candidate': array[129] = False else: array[0, 0] += 1 with control.forbid_sampling(), self.assertRaises((ValueError, AssertionError)): control.load_saved(*fixture)
def test_seed0_reused_and_only_seed1_2_matched_without_fps(self): flat = np.arange(32, dtype=np.int64) xyz = np.zeros((32, 3), np.float32) frame = SimpleNamespace(depth=np.ones((1, 32), np.float32)) negatives = dict(negative=np.zeros((1, 32), bool)) rows = {m: {s: dict(flat=flat, xyz=xyz, final=dict(sampled=10, gt_coverage=10/103)) for s in (0, 1, 2)} for m in control.METHODS} trace = [dict(xyz_m=p.tolist(), flat_index=int(f), depth_m=1., rim_reference_matched=i == 1, matched_rim_reference_ids=[2, 3] if i == 1 else [], selected_negative_roi=dict(negative=False, known_negative_union=False)) for i, (p, f) in enumerate(zip(xyz, flat))] phase2 = dict(methods={m: dict(stored_priority_flat_indices=flat.tolist(), trace=trace, priority_reference_ids=[2, 3], priority_reference_count=2) for m in control.METHODS}) phase1 = dict(frames=[dict(conditions={m: dict(reference_ids=dict(P=[2, 3])) for m in control.METHODS})]) calls = [] def match(selected, **kwargs): calls.append(selected.copy()) self.assertEqual(kwargs, dict(px=2., m=.003)) return np.array([2, 3]), selected[1:2] with control.forbid_sampling(): result = control.summarize_saved(rows, phase1, phase2, SimpleNamespace(reference_hits=match), frame, negatives) self.assertEqual(len(calls), 4) for method in control.METHODS: self.assertEqual(result[method]['0']['priority_reference_ids'], [2, 3]) self.assertEqual(result[method]['0']['rim_matching_node_count'], 1) self.assertEqual(result[method]['0']['final_sampling']['numerator'], 10) phase2['methods']['S2']['priority_reference_ids'] = [2, 4] with control.forbid_sampling(), self.assertRaisesRegex(ValueError, 'Phase1/2 IDs'): control.summarize_saved(rows, phase1, phase2, SimpleNamespace(reference_hits=match), frame, negatives)
def test_joint_same_pair_and_reference_dedup(self): shape = (1, 10) xyz = np.zeros((*shape, 3), np.float32) xyz[0, 3] = [.1, 0, 0] geometry = SimpleNamespace(valid_depth=np.ones(shape, bool), xyz=xyz, observed_mask=lambda oid: np.ones(shape, bool)) # Selected nodes: 0 is near ref 0 only in 2D, 3 only in XYZ. refs = (np.array([[0., 0.], [7., 0.]]), np.array([[.1, 0, 0], [0, 0, 0]])) matcher = CoverageMatcher(geometry, BOX, refs) ids, hits = matcher.reference_hits(np.array([0, 3], np.int64)) self.assertEqual(ids.tolist(), []) self.assertEqual(hits.tolist(), []) ids, hits = matcher.reference_hits(np.array([6, 7, 8], np.int64)) self.assertEqual(ids.tolist(), [1]) self.assertEqual(len(hits), 3) frame = SimpleNamespace(depth=np.ones(shape, np.float32)) a = np.zeros(shape, bool); b = a.copy(); a[0, [6, 7]] = True; b[0, [7, 8]] = True summary = control.point_summary(np.array([6, 7, 8]), frame, dict(a=a, b=b), ids, hits, xyz[0, [6, 7, 8]]) self.assertEqual(summary['negative_roi']['known_negative_union']['count'], 3) self.assertEqual(summary['priority_reference_count'], 1) with self.assertRaisesRegex(ValueError, 'deduplicated'): control.point_summary(np.array([6, 7, 8]), frame, dict(a=a), [1, 1], hits, xyz[0, [6, 7, 8]])
if __name__ == '__main__': unittest.main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112# Task 03-D Phase 3 — FPS Initialization vs Candidate Distribution
**상태: 완료 / 승인 범위 종료.**
저장된 seed 0/1/2의 B Priority coverage는 S2 7–13/103, S3 3–5/103이다. 공통 초기점 114957의 C Priority는 S2 **8/103**, S3 **3/103** (S2−S3 5 refs)이다. 이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. 단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.
## 실행 조건과 재사용 artifact
- 새 run: `f36f1e9e2bb64866b8d6c792db158635`. 기존 ExperimentLogger / artifact manifest·sidecar 계약 재사용, `WANDB_MODE=disabled` 로컬 기록.- Frame 0, Box, S2(FD2) / S3(PCA5), num_points=256, structural_ratio=.25, threshold=20°, Box budget=127, Priority quota=32.- 동일 GT rim line reference 103개. 동일 point/reference pair에서 `2px AND 3mm`, reference ID 중복 제거. GT rim/negative ROI는 평가 전용이다.- [Task03 samples](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz), [frame metrics](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json), [config](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json) (`2551448b0fae4c6bbce3caf48774275f`).- [Phase1 JSON](../../experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json) (`d3f14ee494894daabb8ba2fab8e1b00c`), [Phase2 JSON](../../experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json) (`aa5d71078e0841fd886b5026d6030ebc`). Seed 0 Priority ID/coverage 및 matched node는 Phase2를 그대로 사용하고 Phase1과 대조했다.- 저장 결과 분석은 FPS·candidate·normal·feature를 재실행하지 않았다. Source geometry와 기존 matcher/ROI만 재사용했다. Final coverage는 저장 metrics 값을 그대로 보존했다.
## A. 저장된 Final / B. 저장된 Priority
| 방법 | Seed | 첫 flat | 첫 XYZ (m) | B rim node /32 | B Priority refs /103 | A Final refs /103 | Negative union /32 || --- | ---: | ---: | --- | ---: | ---: | ---: | ---: || S2 | 0 | 101598 | (-0.0403046869, -0.0691796839, 0.307999998) | 4 | 13 (12.62%) | 16 | 3 || S2 | 1 | 119061 | (0.0423281267, -0.0462656245, 0.504000008) | 3 | 7 (6.80%) | 10 | 4 || S2 | 2 | 112919 | (0.0456230491, -0.0689199194, 0.497000009) | 2 | 7 (6.80%) | 10 | 4 || S3 | 0 | 96553 | (0.0496054664, -0.080683589, 0.305999994) | 1 | 3 (2.91%) | 3 | 9 || S3 | 1 | 117010 | (0.0381562486, -0.0567187481, 0.527999997) | 2 | 5 (4.85%) | 5 | 9 || S3 | 2 | 102621 | (-0.0419121087, -0.0674238279, 0.31099999) | 1 | 3 (2.91%) | 3 | 10 |
A는 최종 256점 중 Box 127점의 저장 coverage, B는 그중 실제 Priority 32점의 coverage다. B의 새 진단값으로 A를 바꾸지 않았다.
| 방법 / Seed | Priority depth min / median / p95 / max (m) | Unique GT reference IDs (B) || --- | --- | --- || S2 / 0 | 0.303000003 / 0.506000042 / 0.665299952 / 0.689999998 | [46, 48, 50, 64, 66, 68, 69, 83, 84, 85, 96, 97, 98] || S2 / 1 | 0.303000003 / 0.511000037 / 0.664399981 / 0.689999998 | [60, 62, 64, 79, 80, 81, 86] || S2 / 2 | 0.303000003 / 0.511000037 / 0.664399981 / 0.689999998 | [64, 66, 68, 69, 81, 82, 83] || S3 / 0 | 0.305999994 / 0.580500007 / 1.40565002 / 1.426 | [3, 4, 5] || S3 / 1 | 0.294999987 / 0.565500021 / 1.40565002 / 1.426 | [1, 2, 3, 87, 88] || S3 / 2 | 0.308999985 / 0.598999977 / 1.40565002 / 1.426 | [49, 51, 53] |
## C. 동일 초기점 offline control
후보 교집합은 252개다. GT와 무관한 `shared = sorted(set(C_S2) & set(C_S3)); initial_flat = shared[len(shared)//2]` 규칙으로 **114957**를 선택했다. XYZ는 `[0.030216798186302185, -0.07050585746765137, 0.5730000138282776]` m이며 S2/S3에서 exact equality다. Candidate-local index는 `{'S2': 152, 'S3': 449}`다.
- 각 후보 입력은 저장된 오름차순 raster 순서(S2 297개 / S3 599개)를 유지했다. 기존 `fps_indices(..., 32, seed=fps_seed(0, BOX), initial=[local])`를 방법당 정확히 1회 호출했다.- `seed`는 기존 SeedSequence 계약에 맞게 전달했으며 initial 경로에서 RNG 생성/최초 draw가 없음을 실행 중 차단 검증했다. 초기점 포함 32개의 고유 source index다.- 두 FPS가 끝난 후에만 control을 GT matcher 및 negative ROI로 평가했다. 전체 32-step trace는 생성하지 않았다.
| 방법 | 실제 node | Rim matching node | C Priority refs /103 | Unique GT reference IDs | Negative union /32 | Depth min / median / p95 / max (m) || --- | ---: | ---: | ---: | --- | ---: | --- || S2 | 32 | 3 | 8 (7.77%) | [38, 40, 42, 78, 79, 80, 91, 92] | 5 | 0.303000003 / 0.505500019 / 0.665299952 / 0.689999998 || S3 | 32 | 1 | 3 (2.91%) | [5, 6, 7] | 9 | 0.294999987 / 0.578500032 / 1.40565002 / 1.426 |
공통 초기점 control의 실제 선택 flat index는 선택 순서대로 다음과 같다.
- S2: `[114957, 95454, 109831, 104212, 98091, 120059, 112394, 118550, 116497, 111367, 112908, 111383, 120073, 118013, 117521, 113933, 110854, 115982, 101595, 111880, 119042, 114965, 112907, 107798, 120080, 105748, 115471, 99555, 118035, 118008, 118523, 95015]`- S3: `[114957, 106747, 87254, 109819, 87767, 84782, 109829, 101170, 108294, 108794, 105738, 107270, 119062, 107771, 108795, 102193, 109318, 105746, 113403, 103135, 116989, 111355, 105741, 84783, 106758, 119032, 112907, 94500, 102117, 107259, 105736, 116497]`
Reference 집합 비교(C):
- intersection: 0개, `[]`- S2_only: 8개, `[38, 40, 42, 78, 79, 80, 91, 92]`- S3_only: 3개, `[5, 6, 7]`
선택 source index 교집합은 3개 (`[112907, 114957, 116497]`), S2-only / S3-only는 각각 29 / 29개다. 각 선택 XYZ 및 candidate-local index와 전체 차집합은 아래 JSON에 보존했다.
## 해석과 연구적 판단
저장된 seed 0/1/2의 B Priority coverage는 S2 7–13/103, S3 3–5/103이다. 공통 초기점 114957의 C Priority는 S2 **8/103**, S3 **3/103** (S2−S3 5 refs)이다. 이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. 단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.
- 저장 seed의 S3 Priority 변동 폭은 2 references(1.94%p), S2는 6 references(5.83%p)다. S3의 덮인 ID 집합도 seed에 따라 달라진다. 이는 관측된 초기점 민감성의 범위이며 초기점의 독립적인 인과 효과를 정량화한 값은 아니다.- 같은 seed끼리의 B S2−S3 차이는 seed 0/1/2에서 10/2/4 references다. C의 차이 5는 seed 0보다 작고 seed 1/2보다 크다. 따라서 seed 0의 큰 차이 전부가 지속되는 것은 아니지만, 이 공통 초기점에서도 S3의 낮은 coverage는 남는다.- 관측된 seed별 B Priority 범위 및 같은 초기점 C를 함께 읽어야 한다. A와 C는 sampling 단계가 다르므로 동일 조건 성능 비교로 사용하지 않는다.- 한 공통 초기점 결과를 전체 seed·episode에 일반화하지 않는다. 후보 수·위치·오염·원거리 depth의 독립적인 인과 기여율은 분해하지 않았다. Phase2의 기존 경로 분석을 재사용하며 새 trace를 만들지 않았다.- 다음 연구 판단은 초기점 민감성과 후보 집합 효과를 함께 검토하는 것이다. 새 sampling 정책, 후보 제거, depth cutoff, GT quota, FPS 변형의 채택 근거로 사용하지 않는다. 추가 초기점/episode 검증은 별도 승인 대상이다.
## 구현·검증·source hash
- 추가 구현: [run_priority_fps_seed_control.py](../../visual/runtime/test/run_priority_fps_seed_control.py), [test_priority_fps_seed_control.py](../../visual/runtime/test/test_priority_fps_seed_control.py). 기존 production·Phase1/2·run_sampling 파일은 보존했다.- Phase1 source geometry/matcher helper와 Phase2 `verify_fps_source` 검증 경로를 재사용했다. 새 sampler나 logger/publisher 구현은 추가하지 않았다.- **PASS**: 신규 및 관련 기존 테스트. `Ran 45 tests in 0.644s; OK`. [test log](../../experiments/f36f1e9e2bb64866b8d6c792db158635/tests.log). 테스트의 FPS/전체 sampler 반복은 합성 입력에만 적용했다.- **PASS**: evaluated source와 현재 FPS·candidate·allocation 정의 일치, seed0 Phase1/2 reference ID 및 저장 순서 일치, seed1/2 source/feature/role alignment, 23 metadata row 및 seed 간 공통 source feature equality.- **PASS**: 저장 분석 FPS 호출 차단, 후보 교집합 252 / initial 114957, initial XYZ exact equality, 초기 RNG draw 차단, 32 unique indices·초기점 포함·실제 후보 membership·local/global 대응·raster 순서 유지.- **PASS**: 합성 GT annotation 변경 시 선택 불변, 기존 same-pair joint matching 및 reference 중복 제거, 저장 negative ROI union 점유 일치, 원본 artifact·입력·기존 파일 hash 불변, HTML/Markdown 상대 링크와 PNG 생성 확인.- **FAIL**: 없음. 불일치 시 assertion·tolerance·GT·seed 규칙을 변경하지 않고 중단하도록 구현했다.- **SKIP / 미검증**: simulator·renderer·CUDA/GPU backend, 다른 frame/episode, 추가 공통 초기점 sweep, PCL·Graph·BC·정책/학습 실험, 외부 upload·dependency 설치·commit. 현재 호스트에서는 CPU NumPy offline 진단만 실행했다.- Git 시작/종료 및 보존한 기존 변경: [start](../../experiments/f36f1e9e2bb64866b8d6c792db158635/git_start.json), [end](../../experiments/f36f1e9e2bb64866b8d6c792db158635/git_end.json), [diff](../../experiments/f36f1e9e2bb64866b8d6c792db158635/implementation.patch). 시작 Git dirty 상태이므로 commit만으로 재현할 수 없으며 source snapshot과 hash를 함께 보존했다.
| Source / input | SHA-256 || --- | --- || `visual/runtime/geometry.py` | `36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9` || `visual/runtime/rgbd.py` | `be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164` || `visual/runtime/sampling.py` | `45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed` || `visual/runtime/test/run_priority_fps_seed_control.py` | `75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827` || `visual/runtime/test/run_priority_fps_trace.py` | `f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b` || `visual/runtime/test/run_rim_bottleneck.py` | `8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3` || `visual/runtime/test/sampling_evaluation.py` | `daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b` || `visual/runtime/test/test_priority_fps_seed_control.py` | `69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645` |
위 표는 실제 진단 실행 시점의 source hash다. 전체 입력/evaluated source hash와 원본 보존 기록은 아래 JSON에 있다. 그림·보고서만 저장 결과로 갱신한 경우 실제 실행 source는 `execution_source/`, 최종 source는 `diagnostic_source/` 및 `source_hashes.json`의 `report_generation_sources`로 구분한다. FPS 결과는 재실행하지 않는다.
## 산출물
- [priority_fps_seed_control.html](../../experiments/f36f1e9e2bb64866b8d6c792db158635/priority_fps_seed_control.html)- [priority_fps_seed_control.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/priority_fps_seed_control.json)- [seed_initial_points.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/seed_initial_points.png)- [seed_priority_final_coverage.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/seed_priority_final_coverage.png)- [shared_initial_overlay.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/shared_initial_overlay.png)- [shared_initial_coverage.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/shared_initial_coverage.png)- [source_hashes.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/source_hashes.json)- [verification.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/verification.json)- [tests.log](../../experiments/f36f1e9e2bb64866b8d6c792db158635/tests.log)- [implementation.patch](../../experiments/f36f1e9e2bb64866b8d6c792db158635/implementation.patch)
**Phase 3 결과 제출 후 중단한다. 후속 변경은 별도 승인 후 진행한다.**123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588"""Task03-D Phase 3: saved Priority evaluation and one shared-initial FPS pair.
WANDB_MODE=disabled .venv/bin/python -m visual.runtime.test.run_priority_fps_seed_control \ --baseline /path/to/baseline.json
Only the two control selections call FPS on real data. No full sampler, feature,normal or candidate extraction runs. GT annotations enter control scoring onlywhen both selections are complete. Tests repeat FPS only on synthetic inputs."""from __future__ import annotations
import argparsefrom contextlib import ExitStackimport htmlimport jsonimport osfrom pathlib import Pathimport platformimport reimport shutilimport subprocessimport sysfrom unittest.mock import patch
import matplotlibmatplotlib.use('Agg')import matplotlib.pyplot as pltimport numpy as np
from utils.experiment_artifacts import digestsfrom utils.experiment_logger import ExperimentLoggerfrom visual.runtime.rgbd import BOX, PEGfrom visual.runtime.sampling import fps_indicesfrom visual.runtime.test.run_priority_fps_trace import ( REPO, METHODS, _frame_and_context, fps_seed, verify_fps_source,)from visual.runtime.test.run_rim_bottleneck import ( SOURCE_RUN, compare_ids, depth_summary, geometry_evidence, require_equal, source_contract, validate_saved_selection, write_json,)from visual.runtime.test.sampling_evaluation import CoverageMatcher, evaluation_context
PHASE1 = 'd3f14ee494894daabb8ba2fab8e1b00c'PHASE2 = 'aa5d71078e0841fd886b5026d6030ebc'REPORT = REPO/'docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md'FINAL = {'S2': [16, 10, 10], 'S3': [3, 5, 3]}FIRST = {'S2': [101598, 119061, 112919], 'S3': [96553, 117010, 102621]}COUNT = 32TEST_MODULES = [f'visual.runtime.test.{name}' for name in ( 'test_priority_fps_seed_control', 'test_priority_fps_trace', 'test_sampling', 'test_sampling_geometry', 'test_sampling_evaluation')]
def hashes(paths): return {str(p.relative_to(REPO)): digests(p)[1] for p in sorted(set(paths))}
def verify_preserved(baseline): actual = hashes([REPO/p for p in baseline['hashes']]) require_equal(actual, baseline['hashes'], 'pre-existing workspace/artifact hashes') return {'status': 'PASS', 'protected_file_count': len(actual), 'all_sha256_unchanged': True}
def forbid_sampling(): """Scoped tripwires, including both the imported FPS alias and its source.""" stack = ExitStack() for target in ('visual.runtime.sampling.fps_indices', __name__+'.fps_indices', 'visual.runtime.sampling.sample_points', 'visual.runtime.sampling.extract_sampling_evidence', 'visual.runtime.sampling.extract_candidates'): stack.enter_context(patch(target, side_effect=AssertionError('forbidden in saved analysis: '+target))) return stack
def load_saved(archive, config, metrics, frame, geometry, phase2): """Read/validate saved arrays; never regenerate features, candidates or FPS.""" candidates, selections, checks = {}, {}, {} for method, (estimator, _, n_candidates, _, _) in METHODS.items(): candidate = np.asarray(archive[f'evidence/{estimator}/1/20/orientation_flat']) if candidate.ndim != 1 or candidate.dtype.kind not in 'iu': raise ValueError('candidate flat indices must be one-dimensional integers') require_equal(len(candidate), n_candidates, method+' candidate count') if not np.all(candidate[:-1] < candidate[1:]): raise ValueError('candidate raster order changed') if not geometry.observed_mask(BOX).ravel()[candidate].all(): raise ValueError('candidate outside observed Box') np.testing.assert_array_equal(candidate, phase2['methods'][method]['candidate_flat_indices']) candidates[method] = dict(flat=candidate.copy(), points=geometry.xyz.reshape(-1, 3)[candidate].copy()) selections[method] = {} previous = [] for seed in (0, 1, 2): key = f'{method}_n256_r0.25_t20_s{seed}' expected = dict(method=method, num_points=256, structural_ratio=.25, orientation_threshold_deg=20, seed=seed) require_equal(config['conditions'][key], expected, key+' condition') alignment = validate_saved_selection(archive, key, frame, geometry) flat, ids = archive[key+'/flat_index'], archive[key+'/object_id'] priority = archive[key+'/priority_selected'] require_equal(len(flat), 256, key+' total nodes') for oid, name, budget in ((PEG, 'peg', 129), (BOX, 'box', 127)): choose = ids == oid require_equal(int(choose.sum()), budget, key+' '+name+' budget') np.testing.assert_array_equal(priority[choose], np.arange(budget) < COUNT) counts = metrics[key]['objects'][name]['counts'] for field, value in dict(budget=budget, selected=budget, priority=COUNT, orientation_priority=COUNT, depth_priority=0, surface_fps=budget-COUNT).items(): require_equal(counts[field], value, key+' '+name+' '+field) names = sorted(k for k in archive.files if k.startswith(key+'/metadata/')) require_equal(len(names), 23, key+' metadata fields') features = {k.split('/metadata/')[1]: archive[k] for k in names} if any(len(v) != len(flat) for v in features.values()): raise ValueError('feature row alignment mismatch') box = ids == BOX np.testing.assert_array_equal(features['orientation_candidate'][box], np.isin(flat[box], candidate)) np.testing.assert_array_equal(features['structural_candidate'][box], np.isin(flat[box], candidate)) if not features['orientation_candidate'][box & priority].all() or features['depth_only_candidate'][box & priority].any(): raise ValueError('Priority orientation/depth role mismatch') if not (features['object_mask'].all() and features['valid_points'].all()): raise ValueError('saved metadata support mismatch') # Source-keyed equality of every saved feature wherever seeds overlap. overlap_counts = [] for old_flat, old_features in previous: shared, a, b = np.intersect1d(flat, old_flat, return_indices=True) for name, value in features.items(): np.testing.assert_array_equal(value[a], old_features[name][b], err_msg=key+'/'+name) overlap_counts.append(len(shared)) previous.append((flat.copy(), features)) selected = flat[box & priority] require_equal(len(selected), COUNT, key+' Priority count') require_equal(int(selected[0]), FIRST[method][seed], key+' first flat') positions = np.searchsorted(candidate, selected) if (positions >= len(candidate)).any(): raise ValueError('saved Priority outside candidates') np.testing.assert_array_equal(candidate[positions], selected) np.testing.assert_array_equal(candidates[method]['points'][positions], archive[key+'/points'][box & priority]) final = metrics[key]['objects']['box']['structural']['tolerance']['2px_3mm'] require_equal(final['gt_visible'], 103, key+' final denominator') require_equal(final['sampled'], FINAL[method][seed], key+' stored Final coverage') require_equal(final['gt_coverage'], FINAL[method][seed]/103, key+' stored Final fraction') selections[method][seed] = dict(flat=selected.copy(), local=positions, xyz=archive[key+'/points'][box & priority].copy(), final=dict(final)) checks[key] = dict(**alignment, saved_feature_fields=23, source_keyed_feature_overlap_counts=overlap_counts, feature_and_role_alignment=True, candidate_local_global_exact=True, priority_is_saved_prefix=True, saved_final_coverage_unchanged=True) return candidates, selections, checks
def point_summary(flat, frame, negatives, reference_ids, matching_flat, xyz): flat = np.asarray(flat, np.int64) masks = dict(negatives) masks['known_negative_union'] = np.logical_or.reduce(list(negatives.values())) occupancy = {name: dict(count=int(mask.ravel()[flat].sum()), denominator=len(flat), fraction=float(mask.ravel()[flat].mean())) for name, mask in masks.items()} ids = list(map(int, reference_ids)) if ids != sorted(set(ids)): raise ValueError('reference IDs must be sorted and deduplicated') return dict(node_count=len(flat), selected_flat_indices=flat.tolist(), selected_xyz_m=np.asarray(xyz).tolist(), initial_flat_index=int(flat[0]), initial_xyz_m=np.asarray(xyz)[0].tolist(), rim_matching_node_count=len(matching_flat), rim_matching_flat_indices=list(map(int, matching_flat)), priority_reference_ids=ids, priority_reference_count=len(ids), priority_coverage=dict(numerator=len(ids), denominator=103, value=len(ids)/103), priority_depth_m=depth_summary(frame.depth.ravel()[flat]), negative_roi=occupancy)
def summarize_saved(selections, phase1, phase2, matcher, frame, negatives): """Seed 0 IDs/hits come ONLY from Phase2; only seed 1/2 call the matcher.""" results = {} for method in METHODS: results[method] = {} for seed, row in selections[method].items(): flat, xyz = row['flat'], row['xyz'] if seed == 0: original = phase2['methods'][method] np.testing.assert_array_equal(flat, original['stored_priority_flat_indices']) np.testing.assert_array_equal(xyz, [t['xyz_m'] for t in original['trace']]) np.testing.assert_array_equal(frame.depth.ravel()[flat], [t['depth_m'] for t in original['trace']]) ref_ids = original['priority_reference_ids'] require_equal(ref_ids, phase1['frames'][0]['conditions'][method]['reference_ids']['P'], method+' seed0 Phase1/2 IDs') require_equal(sorted({i for t in original['trace'] for i in t['matched_rim_reference_ids']}), ref_ids, method+' seed0 trace reference union') require_equal(len(ref_ids), original['priority_reference_count'], method+' seed0 coverage') hits = [t['flat_index'] for t in original['trace'] if t['rim_reference_matched']] origin = 'Phase2 reused; seed0 matcher not called' else: ref_ids, hits = matcher.reference_hits(flat, px=2., m=.003) origin = 'saved Priority evaluated by existing CoverageMatcher' result = point_summary(flat, frame, negatives, ref_ids, hits, xyz) if seed == 0: for name in result['negative_roi']: require_equal(result['negative_roi'][name]['count'], sum(t['selected_negative_roi'][name] for t in original['trace']), method+' seed0 ROI '+name) if result['priority_reference_count'] > row['final']['sampled']: raise ValueError('Priority coverage exceeds stored Final coverage') result.update(seed=seed, stage='B_saved_priority', priority_result_origin=origin, final_sampling=dict(stage='A_saved_final', source='Task03 f0000_metrics.json', numerator=row['final']['sampled'], denominator=103, value=row['final']['gt_coverage'])) results[method][str(seed)] = result return results
def select_control(candidates, *, expected_shared=252, expected_initial=114957): """GT-free selection boundary. Preserve candidate raster order and XYZ.""" require_equal(set(candidates), {'S2', 'S3'}, 'control methods') for method, row in candidates.items(): flat, xyz = row['flat'], row['points'] if flat.ndim != 1 or flat.dtype.kind not in 'iu' or not np.all(flat[:-1] < flat[1:]): raise ValueError('control candidates must keep ascending raster order') if xyz.shape != (len(flat), 3) or not np.isfinite(xyz).all() or len(flat) < COUNT: raise ValueError('invalid control candidate XYZ/count') shared = sorted(set(candidates['S2']['flat']) & set(candidates['S3']['flat'])) require_equal(len(shared), expected_shared, 'candidate intersection') initial = int(shared[len(shared)//2]) require_equal(initial, expected_initial, 'deterministic shared initial') local = {m: int(np.searchsorted(c['flat'], initial)) for m, c in candidates.items()} xyz = {m: c['points'][local[m]] for m, c in candidates.items()} np.testing.assert_array_equal(xyz['S2'], xyz['S3']) orders = {} # No RNG factory or integer draw may occur in the real initial path. with patch('visual.runtime.sampling.np.random.default_rng', side_effect=AssertionError('initial control must not consume RNG')): for method, candidate in candidates.items(): order = fps_indices(candidate['points'], COUNT, seed=fps_seed(0, BOX), initial=[local[method]]) if len(order) != COUNT or len(np.unique(order)) != COUNT or ((order < 0) | (order >= len(candidate['flat']))).any(): raise ValueError('control requires 32 unique candidate rows') require_equal(int(order[0]), local[method], method+' initial included') selected = candidate['flat'][order] require_equal(len(np.unique(selected)), COUNT, method+' unique source nodes') np.testing.assert_array_equal(np.searchsorted(candidate['flat'], selected), order) orders[method] = dict(flat=selected.copy(), xyz=candidate['points'][order].copy(), local=order.copy()) return orders, dict(rule='sorted(set(C_S2) & set(C_S3))[len(shared)//2]', shared_count=len(shared), shared_flat_indices=list(map(int, shared)), initial_flat_index=initial, initial_xyz_m=xyz['S2'].tolist(), candidate_local_index=local, exact_initial_xyz_equal=True, initial_rng_draws=0, real_fps_calls={'S2': 1, 'S3': 1}, total_nodes_including_initial=COUNT, gt_selection_input=False)
def score_control(orders, matcher, frame, negatives): results = {} for method, row in orders.items(): ids, hits = matcher.reference_hits(row['flat'], px=2., m=.003) results[method] = dict(stage='C_shared_initial_priority', selected_candidate_local_indices=row['local'].tolist(), **point_summary(row['flat'], frame, negatives, ids, hits, row['xyz'])) return results
def create_plots(output, frame, saved, control, refs): colors = {'S2': '#1976b9', 'S3': '#df6d16'} fig, ax = plt.subplots(figsize=(9, 7), constrained_layout=True) ax.imshow(frame.rgb) for method, rows in saved.items(): for seed, row in rows.items(): v, u = divmod(row['initial_flat_index'], frame.depth.shape[1]) ax.scatter(u, v, s=90, color=colors[method], marker=['o', 's', '^'][int(seed)], edgecolors='white') ax.annotate(f'{method} seed {seed}', (u, v), xytext=(6, 6), textcoords='offset points', color=colors[method], fontsize=9, bbox=dict(facecolor='white', alpha=.8, pad=1)) ax.set(title='Saved seed 0/1/2: first Box Priority point', xlim=(130, 280), ylim=(270, 160), xlabel='u (px)', ylabel='v (px)') fig.savefig(output/'seed_initial_points.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(12, 4), sharey=True, constrained_layout=True) for ax, method in zip(axes, METHODS): x = np.arange(3); rows = list(saved[method].values()) for dx, field, label, color in [(-.18, 'priority_reference_count', 'B: saved Priority (32)', colors[method]), (.18, 'final_sampling', 'A: stored Final (127 Box)', '#999999')]: values = [r[field] if field != 'final_sampling' else r[field]['numerator'] for r in rows] bars = ax.bar(x+dx, values, .34, label=label, color=color) ax.bar_label(bars, labels=[f'{n}/103' for n in values], fontsize=9) ax.set(title=method, xticks=x, xticklabels=['seed 0', 'seed 1', 'seed 2'], ylim=(0, 20), ylabel='Unique GT rim reference IDs (of 103)') ax.legend(fontsize=8); ax.grid(axis='y', alpha=.2) fig.savefig(output/'seed_priority_final_coverage.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(14, 6), constrained_layout=True) for ax, method in zip(axes, METHODS): row = control[method]; vu = np.column_stack(np.unravel_index(row['selected_flat_indices'], frame.depth.shape)) ax.imshow(frame.rgb) ax.scatter(refs[:, 0], refs[:, 1], marker='+', s=18, color='#e226bd', label='GT rim: evaluation only') ax.scatter(vu[:, 1], vu[:, 0], s=50, edgecolors='white', linewidths=.6, color=colors[method], label='32 Priority selections') ax.scatter(vu[0, 1], vu[0, 0], s=180, color='#ffe243', edgecolors='black', marker='*', label='shared initial') ax.set(title=f"{method}: C Priority {row['priority_reference_count']}/103", xlim=(120, 285), ylim=(275, 140), xlabel='u (px)', ylabel='v (px)') ax.legend(fontsize=8, loc='upper right') fig.savefig(output/'shared_initial_overlay.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(12, 4), constrained_layout=True) values = [control[m]['priority_reference_count'] for m in METHODS] bars = axes[0].bar(list(METHODS), values, color=list(colors.values())) axes[0].bar_label(bars, labels=[f'{n}/103 ({100*n/103:.2f}%)' for n in values]) axes[0].set(title='C: same initial point, 32 Priority nodes', ylabel='Unique GT rim references', ylim=(0, max(values)+5)) axes[1].scatter(refs[:, 0], refs[:, 1], color='#cccccc', s=24, label='103 GT refs: evaluation only') for method in METHODS: selected = refs[control[method]['priority_reference_ids']] axes[1].scatter(selected[:, 0], selected[:, 1], color=colors[method], marker='o' if method == 'S2' else 'x', s=50, label=method+' covered refs') axes[1].invert_yaxis(); axes[1].set_aspect('equal'); axes[1].legend(fontsize=8) axes[1].set(title='Unique reference coverage after control FPS', xlabel='u (px)', ylabel='v (px)') fig.savefig(output/'shared_initial_coverage.png', dpi=160); plt.close(fig)
def create_html(output, result, source): def link(path, label): return f'<a href="{html.escape(os.path.relpath(path, output))}">{html.escape(label)}</a>' links = ' | '.join(link(output/name, name) for name in ( 'priority_fps_seed_control.json', 'source_hashes.json', 'verification.json', 'tests.log', 'implementation.patch', 'git_start.json', 'git_end.json', 'report_snapshot.md')) originals = ' | '.join(link(path, label) for path, label in ( (source/'f0000_samples.npz', 'Task03 samples NPZ'), (source/'f0000_metrics.json', 'Task03 frame metrics'), (source/'comparison.json', 'Task03 config'), (REPO/'experiments'/PHASE1/'diagnostic.json', 'Phase1 JSON'), (REPO/'experiments'/PHASE2/'priority_fps_trace.json', 'Phase2 JSON'), (REPORT, 'Markdown report'))) rows = ''.join(f"<tr><td>{m}</td><td>{s}</td><td>{r['initial_flat_index']}</td><td>{r['initial_xyz_m']}</td>" f"<td>{r['priority_reference_count']}/103</td><td>{r['final_sampling']['numerator']}/103</td></tr>" for m, seeds in result['saved'].items() for s, r in seeds.items()) control_rows = ''.join(f"<tr><td>{m}</td><td>{r['node_count']}</td><td>{r['rim_matching_node_count']}</td>" f"<td>{r['priority_reference_count']}/103</td><td>{r['priority_reference_ids']}</td></tr>" for m, r in result['control'].items()) body = f'''<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Task03-D Phase 3 — FPS initial control</title><style>body{{font:16px system-ui;max-width:1200px;margin:2rem auto;padding:0 1rem}}img{{max-width:100%;height:auto}}table{{border-collapse:collapse;width:100%}}td,th{{padding:.5rem;border:1px solid #bbb;text-align:left;overflow-wrap:anywhere}}.scroll{{overflow-x:auto}}</style><h1>Task03-D Phase 3 — FPS initialization vs candidate distribution</h1><p>Run {result['run_id']}. Frame 0 Box; FD2/PCA5; n=256, ratio=.25, threshold=20°, Box budget=127, Priority quota=32. Same-pair 2px AND 3mm matching; 103 GT rim line references.</p><p>GT rim marks and negative ROIs are evaluation only. Neither GT nor ROI enters initial-point choice or FPS. Only one shared initial point was tested; no new sampling policy was adopted.</p><p>{links}</p><p>Original read-only results: {originals}</p><h2>Saved seeds: A Final and B Priority are separate stages</h2><p>A is stored final sampling (127 Box nodes in 256 total); B is the saved 32-node Priority subset. Seed 0 B reuses Phase2; seed 1/2 B use the existing matcher, without FPS replay.</p><div class="scroll"><table><tr><th>Method</th><th>Seed</th><th>First flat</th><th>First XYZ (m)</th><th>B Priority</th><th>A Final</th></tr>{rows}</table></div><h2>First selected points</h2><a href="seed_initial_points.png"><img src="seed_initial_points.png" alt="First saved Priority point of each seed"></a><h2>Saved coverage by stage</h2><a href="seed_priority_final_coverage.png"><img src="seed_priority_final_coverage.png" alt="Separate bars for B Priority and A Final coverage"></a><h2>C: common initial point control</h2><p>Shared intersection: {result['initial_control']['shared_count']}; initial flat {result['initial_control']['initial_flat_index']}; XYZ {result['initial_control']['initial_xyz_m']}. Each method executes one existing FPS call, including the initial point in 32 unique nodes. C is Priority only; A and C are different sampling stages.</p><table><tr><th>Method</th><th>Nodes</th><th>Rim matching nodes</th><th>C Priority</th><th>Unique reference IDs</th></tr>{control_rows}</table><a href="shared_initial_overlay.png"><img src="shared_initial_overlay.png" alt="S2 and S3 2D Priority locations with the same initial point"></a><a href="shared_initial_coverage.png"><img src="shared_initial_coverage.png" alt="Control Priority coverage and unique rim reference positions"></a><p>{html.escape(result['interpretation'])}</p><p>CPU NumPy offline analysis only. Simulator, renderer, CUDA, other frames/episodes and initialization sweeps were not executed.</p></html>''' (output/'priority_fps_seed_control.html').write_text(body, encoding='utf-8')
def create_markdown(output, result, test_summary): rel = lambda path: os.path.relpath(path, REPORT.parent) saved, control = result['saved'], result['control'] lines = [ '# Task 03-D Phase 3 — FPS Initialization vs Candidate Distribution', '', '**상태: 완료 / 승인 범위 종료.**', '', result['interpretation_ko'], '', '## 실행 조건과 재사용 artifact', '', f"- 새 run: `{result['run_id']}`. 기존 ExperimentLogger / artifact manifest·sidecar 계약 재사용, `WANDB_MODE=disabled` 로컬 기록.", '- Frame 0, Box, S2(FD2) / S3(PCA5), num_points=256, structural_ratio=.25, threshold=20°, Box budget=127, Priority quota=32.', '- 동일 GT rim line reference 103개. 동일 point/reference pair에서 `2px AND 3mm`, reference ID 중복 제거. GT rim/negative ROI는 평가 전용이다.', f'- [Task03 samples]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_samples.npz")}), [frame metrics]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_metrics.json")}), [config]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"comparison.json")}) (`{SOURCE_RUN}`).', f'- [Phase1 JSON]({rel(REPO/"experiments"/PHASE1/"diagnostic.json")}) (`{PHASE1}`), [Phase2 JSON]({rel(REPO/"experiments"/PHASE2/"priority_fps_trace.json")}) (`{PHASE2}`). Seed 0 Priority ID/coverage 및 matched node는 Phase2를 그대로 사용하고 Phase1과 대조했다.', '- 저장 결과 분석은 FPS·candidate·normal·feature를 재실행하지 않았다. Source geometry와 기존 matcher/ROI만 재사용했다. Final coverage는 저장 metrics 값을 그대로 보존했다.', '', '## A. 저장된 Final / B. 저장된 Priority', '', '| 방법 | Seed | 첫 flat | 첫 XYZ (m) | B rim node /32 | B Priority refs /103 | A Final refs /103 | Negative union /32 |', '| --- | ---: | ---: | --- | ---: | ---: | ---: | ---: |'] for method, seeds in saved.items(): for seed, row in seeds.items(): xyz = ', '.join(f'{v:.9g}' for v in row['initial_xyz_m']) lines.append(f"| {method} | {seed} | {row['initial_flat_index']} | ({xyz}) | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['final_sampling']['numerator']} | {row['negative_roi']['known_negative_union']['count']} |") lines += ['', 'A는 최종 256점 중 Box 127점의 저장 coverage, B는 그중 실제 Priority 32점의 coverage다. B의 새 진단값으로 A를 바꾸지 않았다.', '', '| 방법 / Seed | Priority depth min / median / p95 / max (m) | Unique GT reference IDs (B) |', '| --- | --- | --- |'] for method, seeds in saved.items(): for seed, row in seeds.items(): d = row['priority_depth_m'] lines.append(f"| {method} / {seed} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} | {row['priority_reference_ids']} |") initial = result['initial_control'] lines += ['', '## C. 동일 초기점 offline control', '', f"후보 교집합은 {initial['shared_count']}개다. GT와 무관한 `shared = sorted(set(C_S2) & set(C_S3)); initial_flat = shared[len(shared)//2]` 규칙으로 **{initial['initial_flat_index']}**를 선택했다. XYZ는 `{initial['initial_xyz_m']}` m이며 S2/S3에서 exact equality다. Candidate-local index는 `{initial['candidate_local_index']}`다.", '', '- 각 후보 입력은 저장된 오름차순 raster 순서(S2 297개 / S3 599개)를 유지했다. 기존 `fps_indices(..., 32, seed=fps_seed(0, BOX), initial=[local])`를 방법당 정확히 1회 호출했다.', '- `seed`는 기존 SeedSequence 계약에 맞게 전달했으며 initial 경로에서 RNG 생성/최초 draw가 없음을 실행 중 차단 검증했다. 초기점 포함 32개의 고유 source index다.', '- 두 FPS가 끝난 후에만 control을 GT matcher 및 negative ROI로 평가했다. 전체 32-step trace는 생성하지 않았다.', '', '| 방법 | 실제 node | Rim matching node | C Priority refs /103 | Unique GT reference IDs | Negative union /32 | Depth min / median / p95 / max (m) |', '| --- | ---: | ---: | ---: | --- | ---: | --- |'] for method, row in control.items(): d = row['priority_depth_m'] lines.append(f"| {method} | {row['node_count']} | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['priority_reference_ids']} | {row['negative_roi']['known_negative_union']['count']} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} |") lines += ['', '공통 초기점 control의 실제 선택 flat index는 선택 순서대로 다음과 같다.', ''] for method, row in control.items(): lines += [f"- {method}: `{row['selected_flat_indices']}`"] lines += ['', 'Reference 집합 비교(C):', ''] for name, row in result['control_reference_comparison'].items(): lines += [f"- {name}: {row['count']}개, `{row['reference_ids']}`"] lines += ['', f"선택 source index 교집합/차집합: `{result['control_node_comparison']}`. 각 선택 XYZ 및 candidate-local index는 아래 JSON에 보존했다.", '', '## 해석과 연구적 판단', '', result['interpretation_ko'], '', '- 관측된 seed별 B Priority 범위 및 같은 초기점 C를 함께 읽어야 한다. A와 C는 sampling 단계가 다르므로 동일 조건 성능 비교로 사용하지 않는다.', '- 한 공통 초기점 결과를 전체 seed·episode에 일반화하지 않는다. 후보 수·위치·오염·원거리 depth의 독립적인 인과 기여율은 분해하지 않았다. Phase2의 기존 경로 분석을 재사용하며 새 trace를 만들지 않았다.', '- 다음 연구 판단은 초기점 민감성과 후보 집합 효과를 함께 검토하는 것이다. 새 sampling 정책, 후보 제거, depth cutoff, GT quota, FPS 변형의 채택 근거로 사용하지 않는다. 추가 초기점/episode 검증은 별도 승인 대상이다.', '', '## 구현·검증·source hash', '', '- 추가 구현: [run_priority_fps_seed_control.py](../../visual/runtime/test/run_priority_fps_seed_control.py), [test_priority_fps_seed_control.py](../../visual/runtime/test/test_priority_fps_seed_control.py). 기존 production·Phase1/2·run_sampling 파일은 보존했다.', '- Phase1 source geometry/matcher helper와 Phase2 `verify_fps_source` 검증 경로를 재사용했다. 새 sampler나 logger/publisher 구현은 추가하지 않았다.', f'- **PASS**: 신규 및 관련 기존 테스트. `{test_summary}`. [test log]({rel(output/"tests.log")}). 테스트의 FPS/전체 sampler 반복은 합성 입력에만 적용했다.', '- **PASS**: evaluated source와 현재 FPS·candidate·allocation 정의 일치, seed0 Phase1/2 reference ID 및 저장 순서 일치, seed1/2 source/feature/role alignment, 23 metadata row 및 seed 간 공통 source feature equality.', '- **PASS**: 저장 분석 FPS 호출 차단, 후보 교집합 252 / initial 114957, initial XYZ exact equality, 초기 RNG draw 차단, 32 unique indices·초기점 포함·실제 후보 membership·local/global 대응·raster 순서 유지.', '- **PASS**: 합성 GT annotation 변경 시 선택 불변, 기존 same-pair joint matching 및 reference 중복 제거, 저장 negative ROI union 점유 일치, 원본 artifact·입력·기존 파일 hash 불변, HTML/Markdown 상대 링크와 PNG 생성 확인.', '- **FAIL**: 없음. 불일치 시 assertion·tolerance·GT·seed 규칙을 변경하지 않고 중단하도록 구현했다.', '- **SKIP / 미검증**: simulator·renderer·CUDA/GPU backend, 다른 frame/episode, 추가 공통 초기점 sweep, PCL·Graph·BC·정책/학습 실험, 외부 upload·dependency 설치·commit. 현재 호스트에서는 CPU NumPy offline 진단만 실행했다.', f'- Git 시작/종료 및 보존한 기존 변경: [start]({rel(output/"git_start.json")}), [end]({rel(output/"git_end.json")}), [diff]({rel(output/"implementation.patch")}). 시작 Git dirty 상태이므로 commit만으로 재현할 수 없으며 source snapshot과 hash를 함께 보존했다.', '', '| Source / input | SHA-256 |', '| --- | --- |'] for path, digest in result['source_hashes'].items(): lines.append(f'| `{path}` | `{digest}` |') lines += ['', '전체 입력/evaluated source hash와 원본 보존 기록은 아래 JSON에 있다.', '', '## 산출물', ''] for filename in ('priority_fps_seed_control.html', 'priority_fps_seed_control.json', 'seed_initial_points.png', 'seed_priority_final_coverage.png', 'shared_initial_overlay.png', 'shared_initial_coverage.png', 'source_hashes.json', 'verification.json', 'tests.log', 'implementation.patch'): lines.append(f'- [{filename}]({rel(output/filename)})') lines += ['', '**Phase 3 결과 제출 후 중단한다. 후속 변경은 별도 승인 후 진행한다.**', ''] REPORT.write_text('\n'.join(lines), encoding='utf-8') shutil.copyfile(REPORT, output/'report_snapshot.md')
def diagnose(source, output_root, baseline_path): if os.environ.get('WANDB_MODE') != 'disabled': raise ValueError('set WANDB_MODE=disabled for local-only execution') if REPORT.exists(): raise FileExistsError('refuse to overwrite Phase3 report') baseline = json.loads(Path(baseline_path).read_text()) verify_preserved(baseline) source = Path(source).resolve() comparison = json.loads((source/'comparison.json').read_text()) require_equal(comparison['run_id'], SOURCE_RUN, 'Task03 run') config = comparison['config'] source_checks = source_contract(source, config) fps_checks = verify_fps_source(source, config['source_sha256']['visual/runtime/sampling.py']) phase1_path = REPO/'experiments'/PHASE1/'diagnostic.json' phase2_path = REPO/'experiments'/PHASE2/'priority_fps_trace.json' phase1, phase2 = (json.loads(p.read_text()) for p in (phase1_path, phase2_path)) for obj, run, phase in ((phase1, PHASE1, 1), (phase2, PHASE2, 2)): require_equal(obj['run_id'], run, f'Phase{phase} run') require_equal(obj['source_run_id'], SOURCE_RUN, f'Phase{phase} Task03 source') require_equal(phase1['inputs_unchanged'], True, 'Phase1 inputs unchanged') for field in ('saved_reference_order_and_geometry_exact', 'target_coverage_exact', 'saved_negative_roi_counts_exact'): require_equal(phase1['frames'][0][field], True, 'Phase1 Frame0 '+field) require_equal(phase2['pass_all'], True, 'Phase2 pass_all') for relative, expected in phase2['config']['source_sha256'].items(): require_equal(digests(REPO/relative)[1], expected, 'Phase2 diagnostic source '+relative) episode, masks = Path(config['input']), Path(config['masks']) inputs = [source/'comparison.json', source/'f0000_samples.npz', source/'f0000_metrics.json', episode, masks, episode.with_name('segmentation_id_map.json'), masks.with_name('tracking.json'), phase1_path, phase2_path] for name, expected in phase2['config']['input_sha256'].items(): require_equal(digests(Path(name))[1], expected, 'Phase2 input '+name) before = hashes(inputs) current_sources = [Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'), Path(__file__).with_name('run_priority_fps_trace.py'), Path(__file__).with_name('run_rim_bottleneck.py'), Path(__file__).with_name('sampling_evaluation.py'), REPO/'visual/runtime/sampling.py', REPO/'visual/runtime/geometry.py', REPO/'visual/runtime/rgbd.py'] source_hashes = hashes(current_sources) run_config = dict(task='03-D', phase=3, source_run_id=SOURCE_RUN, phase1_run_id=PHASE1, phase2_run_id=PHASE2, frame=0, methods=list(METHODS), num_points=256, structural_ratio=.25, orientation_threshold_deg=20, box_budget=127, priority_count=32, matching_px_m=[2., .003], reference_count=103, input_sha256=before, source_sha256=source_hashes, real_fps_calls_per_method=1, additional_initial_sweeps=0, simulator_executed=False, gpu_executed=False, device='cpu', full_sampling_executed=False, candidate_normal_feature_recalculation=False, python=platform.python_version(), numpy=np.__version__) with ExperimentLogger(team='visual', config=run_config, seed=0, model='task03d_priority_fps_seed_control', job_type='evaluate', root=output_root) as logger: output = logger.directory write_json(output/'git_start.json', baseline) shutil.copyfile(Path(baseline_path).with_name('git_start.diff'), output/'git_start.diff') # Tests precede real control, so any failing contract stops the experiment. with (output/'tests.log').open('w') as log: test = subprocess.run([sys.executable, '-m', 'unittest', *TEST_MODULES, '-v'], cwd=REPO, stdout=log, stderr=subprocess.STDOUT, check=False) logger.link_output(output/'tests.log', kind='reports') if test.returncode: write_json(output/'verification.json', dict(status='FAIL', reason='required tests failed', real_fps_calls=0)) logger.link_output(output/'verification.json', kind='reports') raise RuntimeError('required tests failed; see tests.log; no real FPS executed') test_lines = (output/'tests.log').read_text().splitlines() test_summary = next(line for line in test_lines if line.startswith('Ran '))+'; '+test_lines[-1] frame, geometry, gt = _frame_and_context(comparison, episode, masks) metrics = json.loads((source/'f0000_metrics.json').read_text()) with np.load(source/'f0000_samples.npz', allow_pickle=False) as archive, forbid_sampling(): candidates, selections, alignment = load_saved(archive, config, metrics, frame, geometry, phase2) context = evaluation_context(frame, geometry_evidence(frame), gt, config['camera'], config['robot_ids']) refs = tuple(archive[f'evaluation/box/reference_{suffix}'] for suffix in ('uv', 'xyz')) require_equal(len(refs[0]), 103, 'GT reference count') for a, b in zip(refs, context['references']['box']): np.testing.assert_array_equal(a, b) matcher = CoverageMatcher(geometry, BOX, refs) saved = summarize_saved(selections, phase1, phase2, matcher, frame, context['negatives']['box']) for method, seeds in saved.items(): for seed, row in seeds.items(): key = f'{method}_n256_r0.25_t20_s{seed}' for name, roi in row['negative_roi'].items(): require_equal(roi['count'], metrics[key]['objects']['box']['negative'][name]['priority'], key+' ROI '+name) # No GT/ROI/matcher parameter crosses this selection boundary. with patch(__name__+'.fps_indices', wraps=fps_indices) as calls: orders, initial = select_control(candidates) require_equal(calls.call_count, 2, 'total real FPS call count') # Only now may selected control points enter the matcher/negative ROIs. with forbid_sampling(): control = score_control(orders, matcher, frame, context['negatives']['box']) require_equal(hashes(inputs), before, 'input hashes after evaluation') preservation = verify_preserved(baseline) difference = control['S2']['priority_reference_count']-control['S3']['priority_reference_count'] ranges = {m: [min(r['priority_reference_count'] for r in seeds.values()), max(r['priority_reference_count'] for r in seeds.values())] for m, seeds in saved.items()} interpretation = (f"Saved Priority ranges: S2 {ranges['S2']}, S3 {ranges['S3']} references of 103. " f"At shared initial 114957, S2 covers {control['S2']['priority_reference_count']}/103 and S3 " f"{control['S3']['priority_reference_count']}/103 (S2 minus S3: {difference}). " 'This single initialization constrains interpretation to the fixed candidate sets and FPS conditions; ' 'candidate count, position, contamination and far depth have not been causally separated.') interpretation_ko = (f"저장된 seed 0/1/2의 B Priority coverage는 S2 {ranges['S2'][0]}–{ranges['S2'][1]}/103, " f"S3 {ranges['S3'][0]}–{ranges['S3'][1]}/103이다. 공통 초기점 114957의 C Priority는 " f"S2 **{control['S2']['priority_reference_count']}/103**, S3 **{control['S3']['priority_reference_count']}/103** " f"(S2−S3 {difference} refs)이다. " + ('이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. ' if difference > 0 else '저장 seed에서 관측한 차이가 이 공통 초기점에서는 축소되거나 역전되어 초기점 민감성의 근거가 된다. ') + '단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.') result = dict(run_id=logger.run_id, source_run_id=SOURCE_RUN, config=run_config, source_contract=source_checks, fps_source_check=fps_checks, source_hashes=source_hashes, saved=saved, saved_alignment=alignment, initial_control=initial, control=control, control_reference_comparison=compare_ids(*(control[m]['priority_reference_ids'] for m in METHODS)), control_node_comparison=compare_ids(*(control[m]['selected_flat_indices'] for m in METHODS)), interpretation=interpretation, interpretation_ko=interpretation_ko, input_hashes_unchanged=True, pass_all=True) write_json(output/'priority_fps_seed_control.json', result) write_json(output/'source_hashes.json', dict(inputs_before=before, inputs_after=hashes(inputs), diagnostic_sources=source_hashes, evaluated_fps=fps_checks, original_preservation=preservation)) create_plots(output, frame, saved, control, refs[0]) create_markdown(output, result, test_summary) create_html(output, result, source) for path in current_sources: dest = output/'diagnostic_source'/path.relative_to(REPO) dest.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(path, dest) logger.link_output(dest, kind='reports') diff = subprocess.check_output(['git', 'diff', '--binary'], cwd=REPO) for path in (Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'), REPORT): delta = subprocess.run(['git', 'diff', '--no-index', '--', '/dev/null', str(path.relative_to(REPO))], cwd=REPO, stdout=subprocess.PIPE, check=False) if delta.returncode != 1: raise ValueError('cannot preserve added-file diff') diff += delta.stdout (output/'implementation.patch').write_bytes(diff) write_json(output/'git_end.json', dict(git_status=subprocess.check_output(['git', 'status', '--short'], cwd=REPO).decode(), git_head=subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=REPO).decode().strip(), original_preservation=verify_preserved(baseline))) verification = dict(status='PASS', required_tests=dict(status='PASS', summary=test_summary, modules=TEST_MODULES), source_and_input_contract='PASS', seed0_phase2_ids_reused='PASS', saved_source_feature_role_alignment='PASS', saved_analysis_fps_calls=0, shared_candidate_count=252, shared_initial=114957, initial_xyz_exact='PASS', initial_rng_draws=0, real_fps_calls=initial['real_fps_calls'], unique_count_includes_initial=COUNT, raster_local_global_membership='PASS', gt_annotation_independence='PASS (synthetic tests; no GT argument in selection)', same_pair_joint_matching_and_reference_dedup='PASS', negative_roi_union='PASS', inputs_unchanged='PASS', original_preservation=preservation, skipped=['simulator', 'renderer', 'GPU/CUDA', 'other frame/episode', 'initialization sweep', 'new sampling policy', 'external upload', 'dependency installation', 'commit']) write_json(output/'verification.json', verification) # Check all local href/src targets without browser/network dependencies. from html.parser import HTMLParser class Links(HTMLParser): def handle_starttag(self, tag, attrs): for attr, value in attrs: if attr in ('href', 'src') and value and not (output/value).is_file(): raise ValueError('broken local HTML link: '+value) Links().feed((output/'priority_fps_seed_control.html').read_text()) markdown_links = re.findall(r'\]\(([^)]+)\)', REPORT.read_text()) for target in markdown_links: if not (REPORT.parent/target).is_file(): raise ValueError('broken local Markdown link: '+target) for png in output.glob('*.png'): pixels = plt.imread(png) if pixels.ndim != 3 or min(pixels.shape[:2]) < 400: raise ValueError('invalid report PNG: '+str(png)) verification['html_and_markdown_local_links'] = dict(status='PASS', markdown_link_count=len(markdown_links)) verification['png_readback'] = 'PASS (4 PNGs, dimensions and pixel decode)' write_json(output/'verification.json', verification) for path in sorted(output.iterdir()): if path.is_file() and path.name not in ('metadata.json', 'manifest.json', 'config.yaml', 'metrics.json') and not path.name.endswith('.tracking.json'): logger.link_output(path, kind='metrics' if path.name in ('priority_fps_seed_control.json','source_hashes.json') else 'reports') logger.log({m: {'saved_priority_seed'+s: r['priority_reference_count'] for s, r in seeds.items()} for m, seeds in saved.items()}, step=0, prefix='eval/task03d/saved') logger.log({m: dict(priority_references=r['priority_reference_count'], rim_matching_nodes=r['rim_matching_node_count']) for m, r in control.items()}, step=0, prefix='eval/task03d/control') logger.record(source_run_id=SOURCE_RUN, phase1_run_id=PHASE1, phase2_run_id=PHASE2, real_fps_calls=initial['real_fps_calls'], inputs_unchanged=True, simulator_executed=False, gpu_executed=False) return output
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--source', type=Path, default=REPO/'visual/results/sampling'/SOURCE_RUN) parser.add_argument('--out', type=Path, default=REPO/'experiments') parser.add_argument('--baseline', type=Path, required=True, help='pre-change workspace/artifact SHA256 and git status snapshot') args = parser.parse_args() print(diagnose(args.source, args.out, args.baseline))
if __name__ == '__main__': main()123456789{ "git_status": " M docs/visual-graph-integration/03_sampling.md\n M visual/runtime/test/sampling_evaluation.py\n M visual/runtime/test/test_sampling_evaluation.py\n?? docs/visual-graph-integration/03d_box_rim_bottleneck_phase1.md\n?? docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md\n?? docs/visual-graph-integration/03d_priority_fps_seed_control_phase3_plan.md\n?? docs/visual-graph-integration/03d_priority_fps_trace_phase2.md\n?? docs/visual-graph-integration/03d_priority_fps_trace_phase2_plan.md\n?? visual/runtime/test/run_priority_fps_seed_control.py\n?? visual/runtime/test/run_priority_fps_trace.py\n?? visual/runtime/test/run_rim_bottleneck.py\n?? visual/runtime/test/test_priority_fps_seed_control.py\n?? visual/runtime/test/test_priority_fps_trace.py\n", "git_head": "2e10a51736826aa980f2fe79a801eb6c9da8e288", "original_preservation": { "status": "PASS", "protected_file_count": 1289, "all_sha256_unchanged": true }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342"""Task03-D Phase 1: diagnose ONLY saved frames 0/120 and S0/S2/S3.
WANDB_MODE=disabled .venv/bin/python -m visual.runtime.test.run_rim_bottleneck
No sampler, normal estimator, candidate extraction, FPS or simulator is called.Results go to a new ExperimentLogger UUID directory; inputs remain read-only."""from __future__ import annotations
import argparseimport astimport jsonimport osfrom pathlib import Pathimport platformimport shutilfrom types import SimpleNamespace
import numpy as np
from utils.experiment_artifacts import digestsfrom utils.experiment_logger import ExperimentLoggerfrom visual.runtime.geometry import build_organized_geometryfrom visual.runtime.rgbd import BOX, PEG, attach_rgbdfrom visual.runtime.test.normal_diagnostics import endpointsfrom visual.runtime.test.sampling_evaluation import ( CoverageMatcher, count_ratio, evaluation_context, staged_reference_coverage,)
REPO = Path(__file__).resolve().parents[3]SOURCE_RUN = '2551448b0fae4c6bbce3caf48774275f'CONDITIONS = dict(S0='S0_n256_r0_t20_s0', S2='S2_n256_r0.25_t20_s0', S3='S3_n256_r0.25_t20_s0')FRAMES = (0, 120)TARGETS = {0: (103, 103, (6, 16, 3)), 120: (41, 8, (3, 0, 2))}
def write_json(path, value): path.write_text(json.dumps(value, indent=2, allow_nan=False)+'\n', encoding='utf-8')
def require_equal(actual, expected, label): if actual != expected: raise ValueError(f'{label} mismatch: {actual!r} != {expected!r}')
def source_contract(source, config): """Fail closed on historical evaluation changes; permit additive diagnostics.
Every original top-level function and every original CoverageMatcher method must retain its AST. Evaluation imports/constants remain unchanged too. """ records = {} for relative, expected in config['source_sha256'].items(): saved, current = source/'evaluated_source'/relative, REPO/relative require_equal(digests(saved)[1], expected, f'source snapshot {relative}') saved_tree, current_tree = ast.parse(saved.read_text()), ast.parse(current.read_text()) if relative.endswith('/sampling_evaluation.py'): functions = {n.name: n for n in current_tree.body if isinstance(n, (ast.FunctionDef, ast.ClassDef))} for node in saved_tree.body: if isinstance(node, ast.ClassDef): replacement = functions[node.name] methods = {n.name: n for n in replacement.body if isinstance(n, ast.FunctionDef)} replacement = ast.ClassDef(name=node.name, bases=replacement.bases, keywords=replacement.keywords, body=[methods[n.name] if isinstance(n, ast.FunctionDef) else n for n in node.body], decorator_list=replacement.decorator_list) elif isinstance(node, ast.FunctionDef): replacement = functions[node.name] else: if ast.dump(node) not in [ast.dump(n) for n in current_tree.body]: raise ValueError(f'historical evaluation import/constant changed: {relative}') replacement = node require_equal(ast.dump(replacement), ast.dump(node), f'historical evaluation definition {relative}') status = 'original definitions unchanged; additive diagnostics only' elif relative.endswith('/test_sampling_evaluation.py'): status = 'diagnostic tests extended; not an evaluation dependency' else: require_equal(ast.dump(current_tree), ast.dump(saved_tree), f'historical source AST {relative}') status = 'byte identical' if digests(current)[1] == expected else 'AST identical (formatting only)' records[relative] = dict(original_sha256=expected, current_sha256=digests(current)[1], status=status) return records
def geometry_evidence(frame): """Only the mask/validity fields read by the unchanged evaluation_context.
endpoints(support, ~valid_depth) is the original in-image four-neighbour depth_validity_boundary rule. No normals/features/candidates are extracted. """ geometry = build_organized_geometry(frame) objects = {oid: SimpleNamespace(object_mask=geometry.object_masks[oid], depth_validity_boundary=endpoints(geometry.observed_mask(oid), ~geometry.valid_depth)) for oid in (PEG, BOX)} return SimpleNamespace(frame=SimpleNamespace(geometry=geometry, objects=objects))
def validate_saved_selection(archive, key, frame, geometry): """Exact source raster, object support and float32 XYZ equality, no epsilon.""" require_equal(int(archive['source_frame']), frame.source_frame, 'source_frame') np.testing.assert_array_equal(archive['shape'], frame.depth.shape) flat, vu = archive[key+'/flat_index'], archive[key+'/pixels_vu'] oid, points = archive[key+'/object_id'], archive[key+'/points'] priority = archive[key+'/priority_selected'] if flat.ndim != 1 or flat.dtype.kind not in 'iu' or len(np.unique(flat)) != len(flat): raise ValueError('invalid/duplicate saved source pixels') if ((flat < 0) | (flat >= frame.depth.size)).any(): raise ValueError('source pixel outside raster') np.testing.assert_array_equal(vu, np.column_stack(np.unravel_index(flat, frame.depth.shape))) np.testing.assert_array_equal(flat, vu[:, 0]*frame.depth.shape[1]+vu[:, 1]) require_equal(len(oid), len(flat), 'object ID length') if not np.isin(oid, [PEG, BOX]).all() or priority.shape != flat.shape or priority.dtype != bool: raise ValueError('invalid object IDs/selection roles') np.testing.assert_array_equal(points, geometry.xyz.reshape(-1, 3)[flat]) for object_id in (PEG, BOX): if not geometry.observed_mask(object_id).ravel()[flat[oid == object_id]].all(): raise ValueError('saved selection outside valid unambiguous object support') if archive[key+'/depth_priority_selected'].any(): raise ValueError('unexpected depth priority in S0/S2/S3') return dict(source_frame=frame.source_frame, selected_nodes=len(flat), xyz_exact=True, max_abs_xyz_error_m=0., raster_and_object_support=True)
def depth_summary(values): values = np.asarray(values) if len(values) and not (np.isfinite(values) & (values > 0)).all(): raise ValueError('nonpositive/nonfinite depth in observed support') return dict(count=len(values), min=float(values.min()) if len(values) else None, median=float(np.median(values)) if len(values) else None, p95=float(np.percentile(values, 95)) if len(values) else None, max=float(values.max()) if len(values) else None)
def occupancy(frame, node_sets, negatives): """Per-path node occupancy; overlapping ROIs and their deduplicated union.""" masks = dict(negatives) masks['known_negative_union'] = np.logical_or.reduce(list(negatives.values())) x = node_sets['X'] roi = {} for name, mask in masks.items(): observed = int(mask.ravel()[x].sum()) roi[name] = {} for stage, flat in node_sets.items(): if flat is None: roi[name][stage] = None continue count = int(mask.ravel()[flat].sum()) roi[name][stage] = dict(count=count, fraction_of_path=count_ratio(count, len(flat)), fraction_of_observed_roi=count_ratio(count, observed)) depth = {name: depth_summary(frame.depth.ravel()[flat]) if flat is not None else None for name, flat in node_sets.items()} # Observation-derived quantile bands describe depth occupancy without an # arbitrary far cutoff or reclassifying ordinary surface nodes as errors. bounds = depth['X'] bands = {} if len(x): for stage, flat in node_sets.items(): if flat is None: bands[stage] = None continue z = frame.depth.ravel()[flat] counts = (int((z <= bounds['median']).sum()), int(((z > bounds['median']) & (z <= bounds['p95'])).sum()), int((z > bounds['p95']).sum())) bands[stage] = {name: count_ratio(n, len(z)) for name, n in zip(('z_le_X_median', 'X_median_lt_z_le_X_p95', 'z_gt_X_p95'), counts)} return dict(negative_roi=roi, depth_m=depth, depth_quantile_occupancy=bands, depth_band_bounds_m=dict(median=bounds['median'], p95=bounds['p95']))
def compare_ids(first, second): first, second = set(first), set(second) return {name: dict(count=len(ids), reference_ids=sorted(ids)) for name, ids in [('intersection', first & second), ('S2_only', first-second), ('S3_only', second-first)]}
def diagnose_frame(frame, gt, robot_ids, source): evidence = geometry_evidence(frame) geometry = evidence.frame.geometry context = evaluation_context(frame, evidence, gt, frame.camera, robot_ids) metrics = json.loads((source/f'f{frame.source_frame:04d}_metrics.json').read_text()) results, alignments = {}, {} with np.load(source/f'f{frame.source_frame:04d}_samples.npz', allow_pickle=False) as archive: # Recomputed Task02 references must be bit-exact, including ID order. # Actual matching below always uses the saved arrays. for suffix, recomputed in zip(('uv', 'xyz'), context['references']['box']): np.testing.assert_array_equal(archive[f'evaluation/box/reference_{suffix}'], recomputed) reference = tuple(archive['evaluation/box/reference_'+s] for s in ('uv', 'xyz')) matcher = CoverageMatcher(geometry, BOX, reference) for method, key in CONDITIONS.items(): require_equal(metrics[key]['source_frame'], frame.source_frame, 'metric source row') alignments[method] = validate_saved_selection(archive, key, frame, geometry) choose = archive[key+'/object_id'] == BOX f = archive[key+'/flat_index'][choose] role = archive[key+'/priority_selected'][choose] p, s = f[role], f[~role] c = None if method == 'S0' else archive[f'evidence/{"fd2" if method == "S2" else "pca5"}/1/20/orientation_flat'] if method == 'S0' and len(p): raise ValueError('General FPS unexpectedly has priority nodes') row = staged_reference_coverage(matcher, c, p if c is not None else None, s, f) original = metrics[key]['objects']['box'] rescored, _ = matcher.score(f) require_equal(rescored['tolerance'], original['structural']['tolerance'], 'frame-level coverage') counts = original['counts'] for name, n in [('observed', len(matcher.flat)), ('budget', len(f)), ('priority', len(p)), ('surface_fps', len(s)), ('selected', len(f))]: require_equal(n, counts[name], 'Box '+name) if c is not None: require_equal(len(c), counts['candidates'], 'Box candidates') require_equal(int(np.isin(f, c).sum()), counts['selected_candidates'], 'selected candidate nodes') nodes = dict(X=matcher.flat, C=c, P=p if c is not None else None, S=s, F=f) row.update(occupancy(frame, nodes, context['negatives']['box'])) for name, oid in [('peg', PEG), ('box', BOX)]: obj = archive[key+'/object_id'] == oid obj_flat = archive[key+'/flat_index'][obj] obj_priority = archive[key+'/priority_selected'][obj] estimator = 'fd2' if method == 'S2' else 'pca5' obj_candidates = archive[f'evidence/{estimator}/{oid}/20/orientation_flat'] saved_counts = metrics[key]['objects'][name]['counts'] expected_counts = dict(observed=int(geometry.observed_mask(oid).sum()), budget=len(obj_flat), candidates=len(obj_candidates), priority=int(obj_priority.sum()), orientation_priority=int(obj_priority.sum()), depth_priority=0, surface_fps=int((~obj_priority).sum()), selected=len(obj_flat), selected_candidates=int(np.isin(obj_flat, obj_candidates).sum())) require_equal(saved_counts, expected_counts, name+' allocation counters') # Prove existing ROI occupancy is reproduced, not a new ROI definition. for name, saved in original['negative'].items(): actual = row['negative_roi'][name] for old, stage in [('observed', 'X'), ('selected', 'F'), ('priority', 'P')]: require_equal(actual[stage]['count'] if actual[stage] is not None else 0, saved[old], 'saved negative ROI '+name+'/'+old) row.update(condition=key, control='General FPS; C/P not applicable' if c is None else None, allocation={name: metrics[key]['objects'][name]['counts'] for name in ('box', 'peg')}, original_frame_coverage_exact=True) results[method] = row expected_v, expected_o, expected_final = TARGETS[frame.source_frame] require_equal(len(results['S0']['reference_ids']['V']), expected_v, 'target GT') require_equal(len(results['S0']['reference_ids']['O']), expected_o, 'target observed') for method, n in zip(CONDITIONS, expected_final): require_equal(results[method]['stages']['F']['unique_reference_count'], n, 'target '+method) # Allocation targets requested explicitly, separate from reference counts. box = {m: results[m]['allocation']['box'] for m in CONDITIONS} if frame.source_frame == 0: for m in CONDITIONS: require_equal((box[m]['observed'], box[m]['budget']), (11665, 127), 'frame 0 allocation') expected = {'S2': (297, 32), 'S3': (599, 32)} else: expected = {'S2': (24, 24), 'S3': (65, 49)} for m, pair in expected.items(): require_equal((box[m]['candidates'], box[m]['priority']), pair, 'candidate/priority target '+m) comparison = {stage: compare_ids(results['S2']['reference_ids'][stage], results['S3']['reference_ids'][stage]) for stage in ('C', 'P', 'F')} return dict(source_frame=frame.source_frame, conditions=results, S2_vs_S3=comparison, alignment=alignments, saved_reference_order_and_geometry_exact=True, target_coverage_exact=True, saved_negative_roi_counts_exact=True)
def diagnose(source, output_root): if os.environ.get('WANDB_MODE') != 'disabled': raise ValueError('set WANDB_MODE=disabled for this local-only diagnostic') source = Path(source).resolve() comparison_path = source/'comparison.json' original = json.loads(comparison_path.read_text()) require_equal(original['run_id'], SOURCE_RUN, 'Task03 source run') config = original['config'] source_checks = source_contract(source, config) episode, masks = Path(config['input']), Path(config['masks']) inputs = [comparison_path, episode, masks] require_equal(digests(episode)[1], config['input_sha256'], 'episode SHA256') require_equal(digests(masks)[1], config['masks_sha256'], 'tracker mask SHA256') require_equal(config['tolerances_px_m'], [[1., .002], [2., .003], [3., .005]], 'evaluation tolerances') segmap = episode.with_name('segmentation_id_map.json') require_equal(digests(segmap)[1], config['segmentation_map_sha256'], 'segmentation map SHA256') inputs.append(segmap) tracking_path = masks.with_name('tracking.json') if tracking_path.exists(): tracking = json.loads(tracking_path.read_text()) require_equal(tracking['camera'], config['camera'], 'tracker camera') require_equal(Path(tracking['input']).resolve(), episode.resolve(), 'tracker source episode') inputs.append(tracking_path) for f in FRAMES: inputs.extend(source/f'f{f:04d}_{suffix}' for suffix in ('samples.npz', 'metrics.json')) before = {str(p): digests(p)[1] for p in inputs} current_sources = {str(p.relative_to(REPO)): digests(p)[1] for p in (Path(__file__), Path(__file__).with_name('sampling_evaluation.py'), Path(__file__).with_name('test_sampling_evaluation.py'))} diagnostic_config = dict(task='03-D', phase=1, source_run_id=SOURCE_RUN, source_directory=str(source), frames=FRAMES, conditions=CONDITIONS, tolerance_px_m=[2., .003], input_sha256=before, source_sha256=current_sources, device='cpu', gpu_executed=False, gt_diagnostic_only=True, sampler_executed=False, candidate_extraction_executed=False, normal_estimation_executed=False, python=platform.python_version(), numpy=np.__version__) with ExperimentLogger(team='visual', config=diagnostic_config, seed=0, model='task03d_rim_bottleneck', job_type='evaluate', root=output_root) as logger: output = logger.directory logger.record(source_run_id=SOURCE_RUN, evaluation_device='cpu', gpu_executed=False) print('Output:', output, flush=True) with np.load(episode, allow_pickle=False) as ep, np.load(masks, allow_pickle=False) as mask: gt_keys = [f'{config["camera"]}/seg', 'peg_id', 'box_id', 'peg_pose', 'box_pose', 'box_hole_pose', 'peg_half_sizes', 'box_hole_radii'] gt = {k: ep[k] for k in gt_keys} sources = mask['source_frame'] np.testing.assert_array_equal(sources, np.arange(len(gt[gt_keys[0]]))) peg_masks, box_masks = mask['peg'], mask['box'] selected_rows = [int(np.flatnonzero(sources == f).item()) for f in FRAMES] tracking_rows = ((i, {1: peg_masks[row], 2: box_masks[row]}) for i, row in enumerate(selected_rows)) frames = attach_rgbd(tracking_rows, ep, camera=config['camera'], source_frames=sources[selected_rows]) rows = [diagnose_frame(frame, gt, config['robot_ids'], source) for frame in frames] require_equal(tuple(r['source_frame'] for r in rows), FRAMES, 'diagnosed sources') after = {str(p): digests(p)[1] for p in inputs} require_equal(after, before, 'input preservation SHA256') result = dict(run_id=logger.run_id, source_run_id=SOURCE_RUN, config=diagnostic_config, source_contract=source_checks, inputs_unchanged=True, frames=rows, notes=['Reference IDs index saved evaluation/box/reference_uv and reference_xyz rows.', 'All coverage uses the same pair within 2px AND 3mm.', 'Overlapping set differences and ROI counts are not additive causal losses.', 'S0 saved candidate diagnostics appear only in allocation; C/P are inapplicable.', 'Depth bands are empirical X quantiles, not filtering or far/error labels.', 'No FPS trace or causal counterfactual was executed.']) write_json(output/'diagnostic.json', result) for relative in current_sources: dest = output/'diagnostic_source'/relative dest.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(REPO/relative, dest) logger.link_output(dest, kind='reports') logger.link_output(output/'diagnostic.json', kind='metrics') for row in rows: logger.log({m: r['coverage'] for m, r in row['conditions'].items()}, step=row['source_frame'], prefix='eval/task03d') logger.record(inputs_unchanged=True, evaluated_frames=len(rows), all_target_coverage_exact=True, source_contract_verified=True) return output
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--source', type=Path, default=REPO/'visual/results/sampling'/SOURCE_RUN) parser.add_argument('--out', type=Path, default=REPO/'experiments') args = parser.parse_args() print(diagnose(args.source, args.out))
if __name__ == '__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202"""Join Visual tracker masks with their recorded RGB-D observations.
Only camera observations and TCP kinematics are read. Object GT, simulatorsegmentation IDs, point sampling, and graph construction are outside this adapter."""
from __future__ import annotations
from collections.abc import Iterable, Iterator, Mapping, Sequencefrom dataclasses import dataclassfrom operator import indexfrom pathlib import Path
import numpy as np
# Visual output object IDs consumed by Graph, distinct from graph node types.PEG = 0BOX = 1TRACKER_TO_GRAPH_ID = {1: PEG, 2: BOX}MASK_NAME_TO_TRACKER_ID = {"peg": 1, "box": 2}
@dataclass(frozen=True)class TrackedRGBDFrame: """One source observation with masks keyed by Visual output object ID.
Arrays are CPU NumPy arrays. Depth is recorded CV-camera z in metres; ``cam2world`` maps CV-camera coordinates to world. ``tcp_pose`` is the world pose ``[x, y, z, qw, qx, qy, qz]``. ``source_frame`` is the episode array row, while ``frame_idx`` is the recorded simulator step, if present. Missing tracked objects have empty boolean masks. Arrays may share storage with the input; consumers should not modify them in place. """
source_frame: int camera: str rgb: np.ndarray depth: np.ndarray intrinsic: np.ndarray cam2world: np.ndarray tcp_pose: np.ndarray masks: dict[int, np.ndarray] frame_idx: int | None timestamp: float | None
def _observations(episode: Mapping[str, object], camera: str) -> dict[str, np.ndarray]: keys = { name: f"{camera}/{name}" for name in ("rgb", "depth", "intrinsic", "cam2world") } keys["tcp_pose"] = "tcp_pose" missing = [key for key in keys.values() if key not in episode] if missing: raise ValueError( f"episode is missing required observations: {', '.join(missing)}" ) arrays = {name: np.asarray(episode[key]) for name, key in keys.items()} rgb = arrays["rgb"] if rgb.ndim != 4 or rgb.shape[-1] != 3: raise ValueError(f"{camera}/rgb must have shape (T,H,W,3), got {rgb.shape}") count, height, width = rgb.shape[:3] shapes = { "depth": (count, height, width), "intrinsic": (count, 3, 3), "cam2world": (count, 4, 4), "tcp_pose": (count, 7), } for name, shape in shapes.items(): if arrays[name].shape != shape: raise ValueError( f"{keys[name]} must have shape {shape}, got {arrays[name].shape}" ) if not np.issubdtype(arrays["depth"].dtype, np.floating): raise ValueError( "recorded depth must be floating point metres, not raw millimetres" ) for name in ("frame_idx", "timestamp"): if name in episode: arrays[name] = np.asarray(episode[name]) if arrays[name].shape != (count,): raise ValueError( f"{name} must have shape ({count},), got {arrays[name].shape}" ) return arrays
def _source_frames(values: Sequence[int] | np.ndarray, count: int) -> np.ndarray: frames = np.asarray(values) if frames.ndim != 1 or not np.issubdtype(frames.dtype, np.integer): raise ValueError("source_frame must be a one-dimensional integer array") if np.any(frames < 0) or np.any(frames >= count): raise ValueError(f"source_frame indices must be in [0, {count})") return frames
def attach_rgbd( tracking: Iterable[tuple[int, Mapping[int, object]]], episode: Mapping[str, object], *, camera: str = "base_camera", source_frames: Sequence[int] | np.ndarray | None = None,) -> Iterator[TrackedRGBDFrame]: """Attach recorded observations to the existing ``SAM2Tracker.track`` output.
Tracker indices address its processed video. If that video was subsampled, pass the exact source row for every processed frame in ``source_frames``. Direct full-episode tracking uses the tracker index as the source row. Torch masks are detached and copied to CPU without importing SAM2 or Torch. Unknown tracker IDs and mismatched image sizes raise instead of being guessed or resized. Empty masks and invalid recorded depth values are preserved. """ arrays = _observations(episode, camera) count, height, width = arrays["rgb"].shape[:3] selected = None if source_frames is None else _source_frames(source_frames, count) tracker_count = count if selected is None else len(selected) for local_frame, tracker_masks in tracking: try: local_frame = index(local_frame) except TypeError as exc: raise ValueError("tracker frame index must be an integer") from exc if not 0 <= local_frame < tracker_count: raise ValueError( f"tracker frame index {local_frame} must be in [0, {tracker_count})" ) source = local_frame if selected is None else int(selected[local_frame]) masks = { graph_id: np.zeros((height, width), dtype=bool) for graph_id in TRACKER_TO_GRAPH_ID.values() } for tracker_id, mask in tracker_masks.items(): if tracker_id not in TRACKER_TO_GRAPH_ID: raise ValueError( f"unknown tracker object ID {tracker_id}; expected 1 (peg) or 2 (box)" ) if hasattr(mask, "detach"): mask = mask.detach().cpu().numpy() mask = np.asarray(mask) if mask.dtype != np.bool_ or mask.shape != (height, width): raise ValueError( f"tracker mask {tracker_id} must be boolean with shape " f"{(height, width)}, got {mask.dtype} {mask.shape}" ) masks[TRACKER_TO_GRAPH_ID[tracker_id]] = mask yield TrackedRGBDFrame( source_frame=source, camera=camera, rgb=arrays["rgb"][source], depth=arrays["depth"][source], intrinsic=arrays["intrinsic"][source], cam2world=arrays["cam2world"][source], tcp_pose=arrays["tcp_pose"][source], masks=masks, frame_idx=( int(arrays["frame_idx"][source]) if "frame_idx" in arrays else None ), timestamp=( float(arrays["timestamp"][source]) if "timestamp" in arrays else None ), )
def iter_saved_rgbd( episode_path: str | Path, masks_path: str | Path, *, camera: str = "base_camera",) -> Iterator[TrackedRGBDFrame]: """Join runtime ``masks.npz`` with its original episode using ``source_frame``.
Pass the original episode and camera used by ``run_tracking.py`` (recorded in its ``tracking.json``). Frame rows are never inferred from array lengths or timestamps. No detector, tracker checkpoint, or simulator is required. """ with np.load(episode_path, allow_pickle=False) as episode, np.load( masks_path, allow_pickle=False ) as saved: required = ["source_frame", *MASK_NAME_TO_TRACKER_ID] missing = [name for name in required if name not in saved] if missing: raise ValueError( f"mask archive is missing required arrays: {', '.join(missing)}" ) source_frames = saved["source_frame"] if source_frames.ndim != 1: raise ValueError("source_frame must be a one-dimensional integer array") masks = { tracker_id: saved[name] for name, tracker_id in MASK_NAME_TO_TRACKER_ID.items() } for tracker_id, values in masks.items(): if values.ndim != 3 or len(values) != len(source_frames): raise ValueError( f"saved masks for tracker {tracker_id} must have shape " "(len(source_frame), H, W)" ) tracking = ( (row, {tracker_id: values[row] for tracker_id, values in masks.items()}) for row in range(len(source_frames)) ) yield from attach_rgbd( tracking, episode, camera=camera, source_frames=source_frames )1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677"""Regenerate presentation assets from completed Phase3 JSON; FPS is forbidden."""import jsonimport osfrom pathlib import Pathimport reimport shutilimport subprocessfrom html.parser import HTMLParserfrom unittest.mock import patch
from utils.experiment_artifacts import register_existing_outputfrom visual.runtime.rgbd import iter_saved_rgbdfrom visual.runtime.test import run_priority_fps_seed_control as report
output = report.REPO/'experiments/f36f1e9e2bb64866b8d6c792db158635'source = report.REPO/'visual/results/sampling'/report.SOURCE_RUNresult = json.loads((output/'priority_fps_seed_control.json').read_text())comparison = json.loads((source/'comparison.json').read_text())config = comparison['config']executed_hashes = json.loads((output/'source_hashes.json').read_text())for row in result['control_node_comparison'].values(): if 'reference_ids' in row: row['flat_indices'] = row.pop('reference_ids')result['report_refresh'] = dict(selection_source='completed result JSON only', real_fps_reexecuted=False, reason='show all points with dynamic axis limits; expand interpretation')result['interpretation'] += (' S3 varies by 2 references (1.94 percentage points) across the three saved seeds. ' 'The shared-initial gap is 5 references, compared with saved Priority gaps 10/2/4; ' 'it is smaller than seed 0 and larger than seeds 1/2. This is descriptive initialization sensitivity, not a causal contribution estimate.')report.write_json(output/'priority_fps_seed_control.json', result)with report.forbid_sampling(): frame = next(f for f in iter_saved_rgbd(config['input'], config['masks'], camera=config['camera']) if f.source_frame == 0) import numpy as np with np.load(source/'f0000_samples.npz', allow_pickle=False) as archive: refs = archive['evaluation/box/reference_uv'].copy() report.create_plots(output, frame, result['saved'], result['control'], refs) test_command = [os.fspath(report.REPO/'.venv/bin/python'), '-m', 'unittest', *report.TEST_MODULES, '-v'] with (output/'tests.log').open('w') as log: subprocess.run(test_command, cwd=report.REPO, stdout=log, stderr=subprocess.STDOUT, check=True) test_lines = (output/'tests.log').read_text().splitlines() summary = next(line for line in test_lines if line.startswith('Ran '))+'; '+test_lines[-1] report.create_markdown(output, result, summary) report.create_html(output, result, source)current = Path(report.__file__).resolve()shutil.copyfile(current, output/'diagnostic_source'/current.relative_to(report.REPO))executed_hashes['executed_diagnostic_sources'] = executed_hashes['diagnostic_sources'].copy()executed_hashes['report_generation_sources'] = report.hashes([current, Path(__file__).resolve()])report.write_json(output/'source_hashes.json', executed_hashes)diff = subprocess.check_output(['git', 'diff', '--binary'], cwd=report.REPO)for path in [current, current.with_name('test_priority_fps_seed_control.py'), report.REPORT]: delta = subprocess.run(['git', 'diff', '--no-index', '--', '/dev/null', str(path.relative_to(report.REPO))], cwd=report.REPO, stdout=subprocess.PIPE, check=False) assert delta.returncode == 1 diff += delta.stdout(output/'implementation.patch').write_bytes(diff)report.write_json(output/'git_end.json', dict(git_status=subprocess.check_output(['git', 'status', '--short'], cwd=report.REPO).decode(), git_head=subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=report.REPO).decode().strip(), original_preservation=report.verify_preserved(json.loads((output/'git_start.json').read_text()))))verification = json.loads((output/'verification.json').read_text())verification['required_tests']['summary'] = summaryverification['report_refresh'] = dict(status='PASS', only_saved_results=True, real_fps_reexecuted=False)class Links(HTMLParser): def handle_starttag(self, tag, attrs): for attr, value in attrs: if attr in ('href', 'src') and value: assert (output/value).is_file(), valueLinks().feed((output/'priority_fps_seed_control.html').read_text())for link in re.findall(r'\]\(([^)]+)\)', report.REPORT.read_text()): assert (report.REPORT.parent/link).is_file(), linkfor png in output.glob('*.png'): pixels = report.plt.imread(png) assert min(pixels.shape[:2]) >= 400verification['png_readback'] = 'PASS (all 4 PNGs decoded; dynamic bounds include all initial/selected points)'report.write_json(output/'verification.json', verification)for path in output.rglob('*'): if path.is_file() and path.name not in ('metadata.json', 'manifest.json', 'config.yaml', 'metrics.json') and not path.name.endswith('.tracking.json'): register_existing_output(output, path, kind='metrics' if path.name in ('priority_fps_seed_control.json', 'source_hashes.json') else 'reports')print(output)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244diff --git a/docs/visual-graph-integration/03_sampling.md b/docs/visual-graph-integration/03_sampling.mdindex acb3c0f..ac76cf2 100644--- a/docs/visual-graph-integration/03_sampling.md+++ b/docs/visual-graph-integration/03_sampling.md@@ -7,6 +7,10 @@ S4 depth-only 우선 선택은 이 조건에서 Peg 보존을 낮추고 가림· 이 수치는 **Tracker가 현재 관측한 reference 대비 Sampling 보존율**이다. 최종 detector, threshold, ratio 또는 feature 표현을 채택한 결과는 아니다. +후속 [Task03-D Box rim 병목 분석 Phase 1](03d_box_rim_bottleneck_phase1.md)은 저장된 frame 0/120의+관측·후보·priority·Surface coverage를 분리한다. Frame 0의 S3는 후보 coverage가 더 높지만+priority와 최종 coverage는 더 낮았다. 오염·원거리 depth·FPS 거리 경쟁의 인과 기여율은 미확인이다.+ 최종 run: `2551448b0fae4c6bbce3caf48774275f`. [전체 HTML](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.html), [전체 summary·설정·fidelity JSON](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json), [검증 기록](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/verification.json), [budget/ratio/false selection/latency 그림](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/tradeoffs.png),diff --git a/visual/runtime/test/sampling_evaluation.py b/visual/runtime/test/sampling_evaluation.pyindex ea0f223..e242ecc 100644--- a/visual/runtime/test/sampling_evaluation.py+++ b/visual/runtime/test/sampling_evaluation.py@@ -44,6 +44,25 @@ class CoverageMatcher: @staticmethod def key(px,m): return f'{px:g}px_{m*1000:g}mm' + def reference_hits(self, selected_flat, px=2., m=.003):+ """Reference IDs and matched source nodes from the existing joint adjacency.++ IDs are row positions in the saved reference arrays, not rounded pixels.+ A node can cover multiple IDs; multiple nodes covering one ID count once.+ """+ selected_flat = np.asarray(selected_flat)+ if selected_flat.ndim != 1 or selected_flat.dtype.kind not in 'iu':+ raise ValueError('source indices must be a one-dimensional integer array')+ if len(np.unique(selected_flat)) != len(selected_flat):+ raise ValueError('duplicate source nodes')+ rows = np.searchsorted(self.flat, selected_flat)+ if len(rows) and ((rows >= len(self.flat)).any()+ or not np.array_equal(self.flat[rows], selected_flat)):+ raise ValueError('evaluation points outside observed support')+ adjacency = self.adjacencies[self.key(px, m)][rows]+ return (np.flatnonzero(adjacency.getnnz(axis=0)),+ selected_flat[adjacency.getnnz(axis=1) > 0])+ def score(self, selected_flat): rows = np.searchsorted(self.flat, selected_flat) if len(rows) and ((rows >= len(self.flat)).any() or not np.array_equal(self.flat[rows], selected_flat)):@@ -78,6 +97,61 @@ class CoverageMatcher: return out, arrays +def count_ratio(numerator, denominator):+ """Preserve raw counts, including undefined zero-denominator fractions."""+ return dict(numerator=int(numerator), denominator=int(denominator),+ value=numerator/denominator if denominator else None)+++def staged_reference_coverage(matcher, candidates, priority, surface, final):+ """Saved-set diagnosis only; no candidate extraction or selection is run.++ C/P are None for the General FPS control, rather than empty candidate sets.+ Set differences overlap and must not be summed as causal loss fractions.+ """+ if (candidates is None) != (priority is None):+ raise ValueError('candidate and priority applicability must agree')+ nodes = dict(X=matcher.flat, C=candidates, P=priority, S=surface, F=final)+ hits, stages = {}, {}+ for name, flat in nodes.items():+ if flat is None:+ hits[name] = None+ stages[name] = None+ continue+ ids, matched = matcher.reference_hits(flat)+ hits[name] = set(ids.tolist())+ stages[name] = dict(node_count=len(flat), matched_node_count=len(matched),+ unique_reference_count=len(ids))+ p = np.asarray(priority if priority is not None else [], dtype=np.int64)+ if np.intersect1d(p, surface).size or set(final) != set(p) | set(surface):+ raise ValueError('final nodes must be the disjoint priority/surface union')+ if candidates is not None and not set(p) <= set(candidates):+ raise ValueError('priority nodes outside candidate support')+ v, o = set(range(matcher.nref)), hits['X']+ c, p, s, f = hits['C'], hits['P'], hits['S'], hits['F']+ if not f <= o or (c is not None and not c <= o):+ raise AssertionError('covered references outside observable references')+ if f != (p or set()) | s:+ raise AssertionError('final reference union differs from priority/surface')+ differences = {'V_minus_O': v-o, 'O_minus_F': o-f}+ if c is not None:+ differences.update(O_minus_C=o-c, C_minus_P=c-p, C_minus_F=c-f,+ P_intersect_S=p&s, S_minus_P=s-p, S_minus_C=s-c,+ C_minus_P_intersect_S=(c-p)&s)+ else:+ differences.update({key: None for key in ('O_minus_C', 'C_minus_P', 'C_minus_F',+ 'P_intersect_S', 'S_minus_P', 'S_minus_C', 'C_minus_P_intersect_S')})+ coverage = dict(observation=count_ratio(len(o), len(v)))+ for name, key in [('C', 'candidate'), ('P', 'priority'), ('S', 'surface'), ('F', 'final_retention')]:+ coverage[key] = count_ratio(len(hits[name]), len(o)) if hits[name] is not None else None+ return dict(stages=stages, coverage=coverage,+ gt_final_coverage=count_ratio(len(f), len(v)),+ reference_ids={k: sorted(ids) if ids is not None else None+ for k, ids in dict(V=v, O=o, **hits).items()},+ differences={k: dict(count=len(ids), reference_ids=sorted(ids)) if ids is not None else None+ for k, ids in differences.items()})++ def evaluation_context(frame, evidence, gt, camera, robot_ids): """Reuse unchanged Task02 visible seam/rim definition; GT read after extraction.""" truths, regions, maps = real_truth(frame, evidence.frame, gt, camera)diff --git a/visual/runtime/test/test_sampling_evaluation.py b/visual/runtime/test/test_sampling_evaluation.pyindex 798172c..6975e66 100644--- a/visual/runtime/test/test_sampling_evaluation.py+++ b/visual/runtime/test/test_sampling_evaluation.py@@ -13,7 +13,10 @@ from visual.runtime.rgbd import PEG, BOX from visual.runtime.sampling import extract_sampling_evidence, sample_points, SamplingConfig from visual.runtime.test.normal_diagnostics import synthetic_frame, oracle, box_primitives, rim_region from visual.runtime.test.run_structural_edges import rim_reference-from visual.runtime.test.sampling_evaluation import CoverageMatcher+from visual.runtime.test.sampling_evaluation import CoverageMatcher, staged_reference_coverage+from visual.runtime.test.run_rim_bottleneck import (+ geometry_evidence, validate_saved_selection, occupancy, source_contract,+) from visual.runtime.test.run_sampling import conditions, evaluate @@ -110,4 +113,135 @@ class SamplingEvaluationTests(unittest.TestCase): with self.assertRaises(ValueError):evaluate(episode,masks,root/'out',camera='camera',selected=(),make_plots=False) +class StagedCoverageTests(unittest.TestCase):+ def fixture(self):+ mask = np.zeros((16, 16), bool)+ mask[5, [3, 6, 10]] = True+ k = np.array([[1000., 0, 8], [0, 1000., 8], [0, 0, 1]])+ frame = synthetic_frame(np.full((16, 16), .3, np.float32), k, mask)+ geometry = build_organized_geometry(frame)+ uv = np.array([[2., 5], [4.5, 5], [7., 5], [10., 5]])+ xyz = np.tile(geometry.xyz[5, 6], (4, 1))+ matcher = CoverageMatcher(geometry, PEG, (uv, xyz))+ return frame, geometry, matcher++ def test_reference_overlap_union_and_surface_outside_candidates(self):+ _, _, matcher = self.fixture()+ c, p, s, f = [np.array(a, np.int64) for a in ([83, 86], [83], [86, 90], [90, 83, 86])]+ row = staged_reference_coverage(matcher, c, p, s, f)+ self.assertEqual(row['reference_ids']['C'], [0, 1, 2])+ self.assertEqual(row['reference_ids']['P'], [0, 1])+ self.assertEqual(row['reference_ids']['S'], [1, 2, 3])+ self.assertEqual(row['reference_ids']['F'], [0, 1, 2, 3])+ self.assertEqual(row['stages']['C'], dict(node_count=2, matched_node_count=2, unique_reference_count=3))+ expected = dict(V_minus_O=0, O_minus_C=1, C_minus_P=1, C_minus_F=0,+ P_intersect_S=1, S_minus_P=2, S_minus_C=1,+ C_minus_P_intersect_S=1, O_minus_F=0)+ self.assertEqual({k: v['count'] for k, v in row['differences'].items()}, expected)+ self.assertEqual(row['coverage']['candidate'], dict(numerator=3, denominator=4, value=.75))++ def test_two_different_nodes_cannot_satisfy_one_reference_pair(self):+ frame, _, _ = self.fixture()+ intrinsic = frame.intrinsic.copy(); intrinsic[0, 0] = 100.+ geometry = build_organized_geometry(replace(frame, intrinsic=intrinsic))+ # Node 83 satisfies 2D only; node 90 satisfies 3D only.+ matcher = CoverageMatcher(geometry, PEG, (np.array([[3., 5]]), geometry.xyz[5, 10][None]))+ ids, matched = matcher.reference_hits(np.array([83, 90]))+ self.assertEqual((len(ids), len(matched)), (0, 0))++ def test_empty_points_zero_observation_and_zero_visible(self):+ frame, geometry, matcher = self.fixture()+ empty = np.array([], np.int64)+ row = staged_reference_coverage(matcher, empty, empty, empty, empty)+ self.assertEqual(row['coverage']['final_retention'], dict(numerator=0, denominator=4, value=0.))+ geometry = build_organized_geometry(replace(frame, masks={PEG: np.zeros_like(frame.depth, bool)}))+ for refs in ((matcher.ref_uv, matcher.ref_xyz), (np.empty((0, 2)), np.empty((0, 3)))):+ row = staged_reference_coverage(CoverageMatcher(geometry, PEG, refs), empty, empty, empty, empty)+ self.assertEqual(row['coverage']['final_retention'], dict(numerator=0, denominator=0, value=None))+ self.assertEqual(row['coverage']['observation']['numerator'], 0)+ self.assertEqual(row['coverage']['observation']['denominator'], len(refs[0]))++ def test_general_fps_candidate_and_priority_are_inapplicable(self):+ _, _, matcher = self.fixture()+ flat = matcher.flat+ row = staged_reference_coverage(matcher, None, None, flat, flat)+ for name in ('C', 'P'):+ self.assertIsNone(row['stages'][name])+ self.assertIsNone(row['coverage']['candidate'])+ self.assertIsNone(row['coverage']['priority'])+ self.assertIsNone(row['differences']['O_minus_C'])+ self.assertEqual(row['coverage']['surface'], row['coverage']['final_retention'])++ def test_invalid_nodes_and_non_partition_are_rejected(self):+ _, _, matcher = self.fixture()+ for flat in (np.array([0]), np.array([83, 83]), np.array([256]), np.array([-1]), np.array([83.])):+ with self.assertRaises(ValueError):+ matcher.reference_hits(flat)+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, np.array([83]), np.array([86]), np.array([90]), np.array([86, 90]))+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, matcher.flat, np.array([83]), np.array([83, 90]), np.array([83, 90]))+ with self.assertRaises(ValueError):+ staged_reference_coverage(matcher, matcher.flat, np.array([83]), np.array([90]), matcher.flat)++ def test_geometry_alignment_invalid_depth_overlap_and_pixel_centres(self):+ frame, _, _ = self.fixture()+ depth = frame.depth.copy()+ depth[5, 6] = 0+ depth[2, 2] = np.nan+ box = np.zeros_like(depth, bool)+ box[5, 10] = True # ambiguous in BOTH masks+ frame = replace(frame, depth=depth, masks={PEG: frame.masks[PEG], BOX: box})+ evidence = geometry_evidence(frame)+ geometry = evidence.frame.geometry+ self.assertEqual(np.flatnonzero(geometry.observed_mask(PEG)).tolist(), [83])+ self.assertFalse(geometry.observed_mask(BOX).any())+ self.assertTrue(np.isnan(geometry.xyz[5, 6]).all())+ z = float(depth[5, 3])+ np.testing.assert_allclose(geometry.xyz[5, 3], [(3.5-8)*z/1000, (5.5-8)*z/1000, z], rtol=1e-7)+ # Minimal evaluation adapter has exactly the existing validity ROI field.+ from visual.runtime.geometry import compute_geometric_features, GeometryParameters+ for oid in (PEG, BOX):+ features = compute_geometric_features(geometry, oid, np.full_like(geometry.xyz, np.nan),+ np.zeros_like(depth, bool), GeometryParameters())+ np.testing.assert_array_equal(evidence.frame.objects[oid].depth_validity_boundary,+ features.depth_validity_boundary)+ key = 'saved'+ archive = {'source_frame': np.array(frame.source_frame), 'shape': np.array(depth.shape),+ key+'/flat_index': np.array([83]), key+'/pixels_vu': np.array([[5, 3]]),+ key+'/object_id': np.array([PEG]), key+'/points': geometry.xyz[5, 3][None].copy(),+ key+'/priority_selected': np.array([False]), key+'/depth_priority_selected': np.array([False])}+ self.assertTrue(validate_saved_selection(archive, key, frame, geometry)['xyz_exact'])+ for field, corrupted in [('points', archive[key+'/points']+.001), ('pixels_vu', np.array([[5, 4]])),+ ('object_id', np.array([BOX]))]:+ with self.assertRaises((ValueError, AssertionError)):+ validate_saved_selection(dict(archive, **{key+'/'+field: corrupted}), key, frame, geometry)+ with self.assertRaises(ValueError):+ validate_saved_selection(dict(archive, source_frame=np.array(frame.source_frame+1)), key, frame, geometry)++ def test_negative_union_deduplicates_and_depth_bands_cover_paths(self):+ frame, _, matcher = self.fixture()+ a = np.zeros_like(frame.depth, bool); b = a.copy()+ a[5, [3, 6]] = True; b[5, [6, 10]] = True+ row = occupancy(frame, dict(X=matcher.flat, C=None, P=None, S=matcher.flat, F=matcher.flat), dict(a=a, b=b))+ roi = row['negative_roi']+ self.assertEqual(roi['a']['F']['count']+roi['b']['F']['count'], 4)+ self.assertEqual(roi['known_negative_union']['F']['count'], 3)+ self.assertIsNone(roi['known_negative_union']['P'])+ self.assertEqual(sum(v['numerator'] for v in row['depth_quantile_occupancy']['F'].values()), 3)++ def test_historical_evaluation_changes_fail_closed(self):+ import hashlib+ with tempfile.TemporaryDirectory() as directory:+ root = Path(directory)+ relative = 'visual/runtime/test/sampling_evaluation.py'+ snapshot = root/'evaluated_source'/relative+ snapshot.parent.mkdir(parents=True)+ source = Path(relative).read_text().replace('<= m', '<= m*2', 1)+ snapshot.write_text(source)+ config = {'source_sha256': {relative: hashlib.sha256(snapshot.read_bytes()).hexdigest()}}+ with self.assertRaisesRegex(ValueError, 'historical evaluation definition'):+ source_contract(root, config)++ if __name__=='__main__':unittest.main()diff --git a/visual/runtime/test/run_priority_fps_seed_control.py b/visual/runtime/test/run_priority_fps_seed_control.pynew file mode 100644index 0000000..0baf081--- /dev/null+++ b/visual/runtime/test/run_priority_fps_seed_control.py@@ -0,0 +1,611 @@+"""Task03-D Phase 3: saved Priority evaluation and one shared-initial FPS pair.++WANDB_MODE=disabled .venv/bin/python -m visual.runtime.test.run_priority_fps_seed_control \+ --baseline /path/to/baseline.json++Only the two control selections call FPS on real data. No full sampler, feature,+normal or candidate extraction runs. GT annotations enter control scoring only+when both selections are complete. Tests repeat FPS only on synthetic inputs.+"""+from __future__ import annotations++import argparse+from contextlib import ExitStack+import html+import json+import os+from pathlib import Path+import platform+import re+import shutil+import subprocess+import sys+from unittest.mock import patch++import matplotlib+matplotlib.use('Agg')+import matplotlib.pyplot as plt+import numpy as np++from utils.experiment_artifacts import digests+from utils.experiment_logger import ExperimentLogger+from visual.runtime.rgbd import BOX, PEG+from visual.runtime.sampling import fps_indices+from visual.runtime.test.run_priority_fps_trace import (+ REPO, METHODS, _frame_and_context, fps_seed, verify_fps_source,+)+from visual.runtime.test.run_rim_bottleneck import (+ SOURCE_RUN, compare_ids, depth_summary, geometry_evidence, require_equal,+ source_contract, validate_saved_selection, write_json,+)+from visual.runtime.test.sampling_evaluation import CoverageMatcher, evaluation_context++PHASE1 = 'd3f14ee494894daabb8ba2fab8e1b00c'+PHASE2 = 'aa5d71078e0841fd886b5026d6030ebc'+REPORT = REPO/'docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md'+FINAL = {'S2': [16, 10, 10], 'S3': [3, 5, 3]}+FIRST = {'S2': [101598, 119061, 112919], 'S3': [96553, 117010, 102621]}+COUNT = 32+TEST_MODULES = [f'visual.runtime.test.{name}' for name in (+ 'test_priority_fps_seed_control', 'test_priority_fps_trace', 'test_sampling',+ 'test_sampling_geometry', 'test_sampling_evaluation')]+++def hashes(paths):+ return {str(p.relative_to(REPO)): digests(p)[1] for p in sorted(set(paths))}+++def verify_preserved(baseline):+ actual = hashes([REPO/p for p in baseline['hashes']])+ require_equal(actual, baseline['hashes'], 'pre-existing workspace/artifact hashes')+ return {'status': 'PASS', 'protected_file_count': len(actual), 'all_sha256_unchanged': True}+++def forbid_sampling():+ """Scoped tripwires, including both the imported FPS alias and its source."""+ stack = ExitStack()+ for target in ('visual.runtime.sampling.fps_indices', __name__+'.fps_indices',+ 'visual.runtime.sampling.sample_points',+ 'visual.runtime.sampling.extract_sampling_evidence',+ 'visual.runtime.sampling.extract_candidates'):+ stack.enter_context(patch(target, side_effect=AssertionError('forbidden in saved analysis: '+target)))+ return stack+++def load_saved(archive, config, metrics, frame, geometry, phase2):+ """Read/validate saved arrays; never regenerate features, candidates or FPS."""+ candidates, selections, checks = {}, {}, {}+ for method, (estimator, _, n_candidates, _, _) in METHODS.items():+ candidate = np.asarray(archive[f'evidence/{estimator}/1/20/orientation_flat'])+ if candidate.ndim != 1 or candidate.dtype.kind not in 'iu':+ raise ValueError('candidate flat indices must be one-dimensional integers')+ require_equal(len(candidate), n_candidates, method+' candidate count')+ if not np.all(candidate[:-1] < candidate[1:]):+ raise ValueError('candidate raster order changed')+ if not geometry.observed_mask(BOX).ravel()[candidate].all():+ raise ValueError('candidate outside observed Box')+ np.testing.assert_array_equal(candidate, phase2['methods'][method]['candidate_flat_indices'])+ candidates[method] = dict(flat=candidate.copy(),+ points=geometry.xyz.reshape(-1, 3)[candidate].copy())+ selections[method] = {}+ previous = []+ for seed in (0, 1, 2):+ key = f'{method}_n256_r0.25_t20_s{seed}'+ expected = dict(method=method, num_points=256, structural_ratio=.25,+ orientation_threshold_deg=20, seed=seed)+ require_equal(config['conditions'][key], expected, key+' condition')+ alignment = validate_saved_selection(archive, key, frame, geometry)+ flat, ids = archive[key+'/flat_index'], archive[key+'/object_id']+ priority = archive[key+'/priority_selected']+ require_equal(len(flat), 256, key+' total nodes')+ for oid, name, budget in ((PEG, 'peg', 129), (BOX, 'box', 127)):+ choose = ids == oid+ require_equal(int(choose.sum()), budget, key+' '+name+' budget')+ np.testing.assert_array_equal(priority[choose], np.arange(budget) < COUNT)+ counts = metrics[key]['objects'][name]['counts']+ for field, value in dict(budget=budget, selected=budget, priority=COUNT,+ orientation_priority=COUNT, depth_priority=0,+ surface_fps=budget-COUNT).items():+ require_equal(counts[field], value, key+' '+name+' '+field)+ names = sorted(k for k in archive.files if k.startswith(key+'/metadata/'))+ require_equal(len(names), 23, key+' metadata fields')+ features = {k.split('/metadata/')[1]: archive[k] for k in names}+ if any(len(v) != len(flat) for v in features.values()):+ raise ValueError('feature row alignment mismatch')+ box = ids == BOX+ np.testing.assert_array_equal(features['orientation_candidate'][box], np.isin(flat[box], candidate))+ np.testing.assert_array_equal(features['structural_candidate'][box], np.isin(flat[box], candidate))+ if not features['orientation_candidate'][box & priority].all() or features['depth_only_candidate'][box & priority].any():+ raise ValueError('Priority orientation/depth role mismatch')+ if not (features['object_mask'].all() and features['valid_points'].all()):+ raise ValueError('saved metadata support mismatch')+ # Source-keyed equality of every saved feature wherever seeds overlap.+ overlap_counts = []+ for old_flat, old_features in previous:+ shared, a, b = np.intersect1d(flat, old_flat, return_indices=True)+ for name, value in features.items():+ np.testing.assert_array_equal(value[a], old_features[name][b], err_msg=key+'/'+name)+ overlap_counts.append(len(shared))+ previous.append((flat.copy(), features))+ selected = flat[box & priority]+ require_equal(len(selected), COUNT, key+' Priority count')+ require_equal(int(selected[0]), FIRST[method][seed], key+' first flat')+ positions = np.searchsorted(candidate, selected)+ if (positions >= len(candidate)).any():+ raise ValueError('saved Priority outside candidates')+ np.testing.assert_array_equal(candidate[positions], selected)+ np.testing.assert_array_equal(candidates[method]['points'][positions], archive[key+'/points'][box & priority])+ final = metrics[key]['objects']['box']['structural']['tolerance']['2px_3mm']+ require_equal(final['gt_visible'], 103, key+' final denominator')+ require_equal(final['sampled'], FINAL[method][seed], key+' stored Final coverage')+ require_equal(final['gt_coverage'], FINAL[method][seed]/103, key+' stored Final fraction')+ selections[method][seed] = dict(flat=selected.copy(), local=positions,+ xyz=archive[key+'/points'][box & priority].copy(), final=dict(final))+ checks[key] = dict(**alignment, saved_feature_fields=23,+ source_keyed_feature_overlap_counts=overlap_counts,+ feature_and_role_alignment=True, candidate_local_global_exact=True,+ priority_is_saved_prefix=True, saved_final_coverage_unchanged=True)+ return candidates, selections, checks+++def point_summary(flat, frame, negatives, reference_ids, matching_flat, xyz):+ flat = np.asarray(flat, np.int64)+ masks = dict(negatives)+ masks['known_negative_union'] = np.logical_or.reduce(list(negatives.values()))+ occupancy = {name: dict(count=int(mask.ravel()[flat].sum()), denominator=len(flat),+ fraction=float(mask.ravel()[flat].mean())) for name, mask in masks.items()}+ ids = list(map(int, reference_ids))+ if ids != sorted(set(ids)):+ raise ValueError('reference IDs must be sorted and deduplicated')+ return dict(node_count=len(flat), selected_flat_indices=flat.tolist(),+ selected_xyz_m=np.asarray(xyz).tolist(),+ initial_flat_index=int(flat[0]), initial_xyz_m=np.asarray(xyz)[0].tolist(),+ rim_matching_node_count=len(matching_flat), rim_matching_flat_indices=list(map(int, matching_flat)),+ priority_reference_ids=ids, priority_reference_count=len(ids),+ priority_coverage=dict(numerator=len(ids), denominator=103, value=len(ids)/103),+ priority_depth_m=depth_summary(frame.depth.ravel()[flat]), negative_roi=occupancy)+++def summarize_saved(selections, phase1, phase2, matcher, frame, negatives):+ """Seed 0 IDs/hits come ONLY from Phase2; only seed 1/2 call the matcher."""+ results = {}+ for method in METHODS:+ results[method] = {}+ for seed, row in selections[method].items():+ flat, xyz = row['flat'], row['xyz']+ if seed == 0:+ original = phase2['methods'][method]+ np.testing.assert_array_equal(flat, original['stored_priority_flat_indices'])+ np.testing.assert_array_equal(xyz, [t['xyz_m'] for t in original['trace']])+ np.testing.assert_array_equal(frame.depth.ravel()[flat], [t['depth_m'] for t in original['trace']])+ ref_ids = original['priority_reference_ids']+ require_equal(ref_ids, phase1['frames'][0]['conditions'][method]['reference_ids']['P'], method+' seed0 Phase1/2 IDs')+ require_equal(sorted({i for t in original['trace'] for i in t['matched_rim_reference_ids']}), ref_ids,+ method+' seed0 trace reference union')+ require_equal(len(ref_ids), original['priority_reference_count'], method+' seed0 coverage')+ hits = [t['flat_index'] for t in original['trace'] if t['rim_reference_matched']]+ origin = 'Phase2 reused; seed0 matcher not called'+ else:+ ref_ids, hits = matcher.reference_hits(flat, px=2., m=.003)+ origin = 'saved Priority evaluated by existing CoverageMatcher'+ result = point_summary(flat, frame, negatives, ref_ids, hits, xyz)+ if seed == 0:+ for name in result['negative_roi']:+ require_equal(result['negative_roi'][name]['count'],+ sum(t['selected_negative_roi'][name] for t in original['trace']), method+' seed0 ROI '+name)+ if result['priority_reference_count'] > row['final']['sampled']:+ raise ValueError('Priority coverage exceeds stored Final coverage')+ result.update(seed=seed, stage='B_saved_priority', priority_result_origin=origin,+ final_sampling=dict(stage='A_saved_final', source='Task03 f0000_metrics.json',+ numerator=row['final']['sampled'], denominator=103, value=row['final']['gt_coverage']))+ results[method][str(seed)] = result+ return results+++def select_control(candidates, *, expected_shared=252, expected_initial=114957):+ """GT-free selection boundary. Preserve candidate raster order and XYZ."""+ require_equal(set(candidates), {'S2', 'S3'}, 'control methods')+ for method, row in candidates.items():+ flat, xyz = row['flat'], row['points']+ if flat.ndim != 1 or flat.dtype.kind not in 'iu' or not np.all(flat[:-1] < flat[1:]):+ raise ValueError('control candidates must keep ascending raster order')+ if xyz.shape != (len(flat), 3) or not np.isfinite(xyz).all() or len(flat) < COUNT:+ raise ValueError('invalid control candidate XYZ/count')+ shared = sorted(set(candidates['S2']['flat']) & set(candidates['S3']['flat']))+ require_equal(len(shared), expected_shared, 'candidate intersection')+ initial = int(shared[len(shared)//2])+ require_equal(initial, expected_initial, 'deterministic shared initial')+ local = {m: int(np.searchsorted(c['flat'], initial)) for m, c in candidates.items()}+ xyz = {m: c['points'][local[m]] for m, c in candidates.items()}+ np.testing.assert_array_equal(xyz['S2'], xyz['S3'])+ orders = {}+ # No RNG factory or integer draw may occur in the real initial path.+ with patch('visual.runtime.sampling.np.random.default_rng',+ side_effect=AssertionError('initial control must not consume RNG')):+ for method, candidate in candidates.items():+ order = fps_indices(candidate['points'], COUNT, seed=fps_seed(0, BOX), initial=[local[method]])+ if len(order) != COUNT or len(np.unique(order)) != COUNT or ((order < 0) | (order >= len(candidate['flat']))).any():+ raise ValueError('control requires 32 unique candidate rows')+ require_equal(int(order[0]), local[method], method+' initial included')+ selected = candidate['flat'][order]+ require_equal(len(np.unique(selected)), COUNT, method+' unique source nodes')+ np.testing.assert_array_equal(np.searchsorted(candidate['flat'], selected), order)+ orders[method] = dict(flat=selected.copy(), xyz=candidate['points'][order].copy(),+ local=order.copy())+ return orders, dict(rule='sorted(set(C_S2) & set(C_S3))[len(shared)//2]',+ shared_count=len(shared), shared_flat_indices=list(map(int, shared)),+ initial_flat_index=initial, initial_xyz_m=xyz['S2'].tolist(), candidate_local_index=local,+ exact_initial_xyz_equal=True, initial_rng_draws=0, real_fps_calls={'S2': 1, 'S3': 1},+ total_nodes_including_initial=COUNT, gt_selection_input=False)+++def score_control(orders, matcher, frame, negatives):+ results = {}+ for method, row in orders.items():+ ids, hits = matcher.reference_hits(row['flat'], px=2., m=.003)+ results[method] = dict(stage='C_shared_initial_priority',+ selected_candidate_local_indices=row['local'].tolist(),+ **point_summary(row['flat'], frame, negatives, ids, hits, row['xyz']))+ return results+++def create_plots(output, frame, saved, control, refs):+ colors = {'S2': '#1976b9', 'S3': '#df6d16'}+ fig, ax = plt.subplots(figsize=(9, 7), constrained_layout=True)+ ax.imshow(frame.rgb)+ initial_vu = []+ offsets = {'S2': [(8, 18), (8, -18), (-65, -15)],+ 'S3': [(-65, -18), (-65, 12), (8, -14)]}+ for method, rows in saved.items():+ for seed, row in rows.items():+ v, u = divmod(row['initial_flat_index'], frame.depth.shape[1])+ initial_vu.append((v, u))+ ax.scatter(u, v, s=90, color=colors[method], marker=['o', 's', '^'][int(seed)], edgecolors='white')+ ax.annotate(f'{method} seed {seed}', (u, v), xytext=offsets[method][int(seed)],+ textcoords='offset points', arrowprops=dict(arrowstyle='-', color=colors[method], lw=.6),+ color=colors[method], fontsize=9, bbox=dict(facecolor='white', alpha=.85, pad=1))+ initial_vu = np.asarray(initial_vu)+ ax.set(title='Saved seed 0/1/2: first Box Priority point',+ xlim=(initial_vu[:, 1].min()-25, initial_vu[:, 1].max()+25),+ ylim=(initial_vu[:, 0].max()+20, initial_vu[:, 0].min()-20), xlabel='u (px)', ylabel='v (px)')+ fig.savefig(output/'seed_initial_points.png', dpi=160); plt.close(fig)+ fig, axes = plt.subplots(1, 2, figsize=(12, 4), sharey=True, constrained_layout=True)+ for ax, method in zip(axes, METHODS):+ x = np.arange(3); rows = list(saved[method].values())+ for dx, field, label, color in [(-.18, 'priority_reference_count', 'B: saved Priority (32)', colors[method]),+ (.18, 'final_sampling', 'A: stored Final (127 Box)', '#999999')]:+ values = [r[field] if field != 'final_sampling' else r[field]['numerator'] for r in rows]+ bars = ax.bar(x+dx, values, .34, label=label, color=color)+ ax.bar_label(bars, labels=[f'{n}/103' for n in values], fontsize=9)+ ax.set(title=method, xticks=x, xticklabels=['seed 0', 'seed 1', 'seed 2'], ylim=(0, 20), ylabel='Unique GT rim reference IDs (of 103)')+ ax.legend(fontsize=8); ax.grid(axis='y', alpha=.2)+ fig.savefig(output/'seed_priority_final_coverage.png', dpi=160); plt.close(fig)+ fig, axes = plt.subplots(1, 2, figsize=(14, 6), constrained_layout=True)+ all_vu = np.column_stack(np.unravel_index(+ [flat for row in control.values() for flat in row['selected_flat_indices']], frame.depth.shape))+ xlim = (min(all_vu[:, 1].min(), refs[:, 0].min())-14,+ max(all_vu[:, 1].max(), refs[:, 0].max())+14)+ ylim = (max(all_vu[:, 0].max(), refs[:, 1].max())+14,+ min(all_vu[:, 0].min(), refs[:, 1].min())-14)+ for ax, method in zip(axes, METHODS):+ row = control[method]; vu = np.column_stack(np.unravel_index(row['selected_flat_indices'], frame.depth.shape))+ ax.imshow(frame.rgb)+ ax.scatter(refs[:, 0], refs[:, 1], marker='+', s=18, color='#e226bd', label='GT rim: evaluation only')+ ax.scatter(vu[:, 1], vu[:, 0], s=50, edgecolors='white', linewidths=.6, color=colors[method], label='32 Priority selections')+ ax.scatter(vu[0, 1], vu[0, 0], s=180, color='#ffe243', edgecolors='black', marker='*', label='shared initial')+ ax.set(title=f"{method}: C Priority {row['priority_reference_count']}/103", xlim=xlim, ylim=ylim, xlabel='u (px)', ylabel='v (px)')+ ax.legend(fontsize=8, loc='upper right')+ fig.savefig(output/'shared_initial_overlay.png', dpi=160); plt.close(fig)+ fig, axes = plt.subplots(1, 2, figsize=(12, 4), constrained_layout=True)+ values = [control[m]['priority_reference_count'] for m in METHODS]+ bars = axes[0].bar(list(METHODS), values, color=list(colors.values()))+ axes[0].bar_label(bars, labels=[f'{n}/103 ({100*n/103:.2f}%)' for n in values])+ axes[0].set(title='C: same initial point, 32 Priority nodes', ylabel='Unique GT rim references', ylim=(0, max(values)+5))+ axes[1].scatter(refs[:, 0], refs[:, 1], color='#cccccc', s=24, label='103 GT refs: evaluation only')+ for method in METHODS:+ selected = refs[control[method]['priority_reference_ids']]+ axes[1].scatter(selected[:, 0], selected[:, 1], color=colors[method], marker='o' if method == 'S2' else 'x', s=50, label=method+' covered refs')+ axes[1].invert_yaxis(); axes[1].set_aspect('equal'); axes[1].legend(fontsize=8)+ axes[1].set(title='Unique reference coverage after control FPS', xlabel='u (px)', ylabel='v (px)')+ fig.savefig(output/'shared_initial_coverage.png', dpi=160); plt.close(fig)+++def create_html(output, result, source):+ def link(path, label):+ return f'<a href="{html.escape(os.path.relpath(path, output))}">{html.escape(label)}</a>'+ links = ' | '.join(link(output/name, name) for name in (+ 'priority_fps_seed_control.json', 'source_hashes.json', 'verification.json', 'tests.log',+ 'implementation.patch', 'git_start.json', 'git_end.json', 'report_snapshot.md'))+ originals = ' | '.join(link(path, label) for path, label in (+ (source/'f0000_samples.npz', 'Task03 samples NPZ'), (source/'f0000_metrics.json', 'Task03 frame metrics'),+ (source/'comparison.json', 'Task03 config'),+ (REPO/'experiments'/PHASE1/'diagnostic.json', 'Phase1 JSON'),+ (REPO/'experiments'/PHASE2/'priority_fps_trace.json', 'Phase2 JSON'), (REPORT, 'Markdown report')))+ rows = ''.join(f"<tr><td>{m}</td><td>{s}</td><td>{r['initial_flat_index']}</td><td>{r['initial_xyz_m']}</td>"+ f"<td>{r['priority_reference_count']}/103</td><td>{r['final_sampling']['numerator']}/103</td></tr>"+ for m, seeds in result['saved'].items() for s, r in seeds.items())+ control_rows = ''.join(f"<tr><td>{m}</td><td>{r['node_count']}</td><td>{r['rim_matching_node_count']}</td>"+ f"<td>{r['priority_reference_count']}/103</td><td>{r['priority_reference_ids']}</td></tr>" for m, r in result['control'].items())+ body = f'''<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width">+<title>Task03-D Phase 3 — FPS initial control</title><style>body{{font:16px system-ui;max-width:1200px;margin:2rem auto;padding:0 1rem}}img{{max-width:100%;height:auto}}table{{border-collapse:collapse;width:100%}}td,th{{padding:.5rem;border:1px solid #bbb;text-align:left;overflow-wrap:anywhere}}.scroll{{overflow-x:auto}}</style>+<h1>Task03-D Phase 3 — FPS initialization vs candidate distribution</h1>+<p>Run {result['run_id']}. Frame 0 Box; FD2/PCA5; n=256, ratio=.25, threshold=20°, Box budget=127, Priority quota=32. Same-pair 2px AND 3mm matching; 103 GT rim line references.</p>+<p>GT rim marks and negative ROIs are evaluation only. Neither GT nor ROI enters initial-point choice or FPS. Only one shared initial point was tested; no new sampling policy was adopted.</p>+<p>{links}</p><p>Original read-only results: {originals}</p>+<h2>Saved seeds: A Final and B Priority are separate stages</h2><p>A is stored final sampling (127 Box nodes in 256 total); B is the saved 32-node Priority subset. Seed 0 B reuses Phase2; seed 1/2 B use the existing matcher, without FPS replay.</p>+<div class="scroll"><table><tr><th>Method</th><th>Seed</th><th>First flat</th><th>First XYZ (m)</th><th>B Priority</th><th>A Final</th></tr>{rows}</table></div>+<h2>First selected points</h2><a href="seed_initial_points.png"><img src="seed_initial_points.png" alt="First saved Priority point of each seed"></a>+<h2>Saved coverage by stage</h2><a href="seed_priority_final_coverage.png"><img src="seed_priority_final_coverage.png" alt="Separate bars for B Priority and A Final coverage"></a>+<h2>C: common initial point control</h2><p>Shared intersection: {result['initial_control']['shared_count']}; initial flat {result['initial_control']['initial_flat_index']}; XYZ {result['initial_control']['initial_xyz_m']}. Each method executes one existing FPS call, including the initial point in 32 unique nodes. C is Priority only; A and C are different sampling stages.</p>+<table><tr><th>Method</th><th>Nodes</th><th>Rim matching nodes</th><th>C Priority</th><th>Unique reference IDs</th></tr>{control_rows}</table>+<a href="shared_initial_overlay.png"><img src="shared_initial_overlay.png" alt="S2 and S3 2D Priority locations with the same initial point"></a>+<a href="shared_initial_coverage.png"><img src="shared_initial_coverage.png" alt="Control Priority coverage and unique rim reference positions"></a>+<p>{html.escape(result['interpretation'])}</p><p>CPU NumPy offline analysis only. Simulator, renderer, CUDA, other frames/episodes and initialization sweeps were not executed.</p></html>'''+ (output/'priority_fps_seed_control.html').write_text(body, encoding='utf-8')+++def create_markdown(output, result, test_summary):+ rel = lambda path: os.path.relpath(path, REPORT.parent)+ saved, control = result['saved'], result['control']+ lines = [+ '# Task 03-D Phase 3 — FPS Initialization vs Candidate Distribution', '',+ '**상태: 완료 / 승인 범위 종료.**', '',+ result['interpretation_ko'], '',+ '## 실행 조건과 재사용 artifact', '',+ f"- 새 run: `{result['run_id']}`. 기존 ExperimentLogger / artifact manifest·sidecar 계약 재사용, `WANDB_MODE=disabled` 로컬 기록.",+ '- Frame 0, Box, S2(FD2) / S3(PCA5), num_points=256, structural_ratio=.25, threshold=20°, Box budget=127, Priority quota=32.',+ '- 동일 GT rim line reference 103개. 동일 point/reference pair에서 `2px AND 3mm`, reference ID 중복 제거. GT rim/negative ROI는 평가 전용이다.',+ f'- [Task03 samples]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_samples.npz")}), [frame metrics]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_metrics.json")}), [config]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"comparison.json")}) (`{SOURCE_RUN}`).',+ f'- [Phase1 JSON]({rel(REPO/"experiments"/PHASE1/"diagnostic.json")}) (`{PHASE1}`), [Phase2 JSON]({rel(REPO/"experiments"/PHASE2/"priority_fps_trace.json")}) (`{PHASE2}`). Seed 0 Priority ID/coverage 및 matched node는 Phase2를 그대로 사용하고 Phase1과 대조했다.',+ '- 저장 결과 분석은 FPS·candidate·normal·feature를 재실행하지 않았다. Source geometry와 기존 matcher/ROI만 재사용했다. Final coverage는 저장 metrics 값을 그대로 보존했다.', '',+ '## A. 저장된 Final / B. 저장된 Priority', '',+ '| 방법 | Seed | 첫 flat | 첫 XYZ (m) | B rim node /32 | B Priority refs /103 | A Final refs /103 | Negative union /32 |',+ '| --- | ---: | ---: | --- | ---: | ---: | ---: | ---: |']+ for method, seeds in saved.items():+ for seed, row in seeds.items():+ xyz = ', '.join(f'{v:.9g}' for v in row['initial_xyz_m'])+ lines.append(f"| {method} | {seed} | {row['initial_flat_index']} | ({xyz}) | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['final_sampling']['numerator']} | {row['negative_roi']['known_negative_union']['count']} |")+ lines += ['', 'A는 최종 256점 중 Box 127점의 저장 coverage, B는 그중 실제 Priority 32점의 coverage다. B의 새 진단값으로 A를 바꾸지 않았다.', '',+ '| 방법 / Seed | Priority depth min / median / p95 / max (m) | Unique GT reference IDs (B) |', '| --- | --- | --- |']+ for method, seeds in saved.items():+ for seed, row in seeds.items():+ d = row['priority_depth_m']+ lines.append(f"| {method} / {seed} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} | {row['priority_reference_ids']} |")+ initial = result['initial_control']+ lines += ['', '## C. 동일 초기점 offline control', '',+ f"후보 교집합은 {initial['shared_count']}개다. GT와 무관한 `shared = sorted(set(C_S2) & set(C_S3)); initial_flat = shared[len(shared)//2]` 규칙으로 **{initial['initial_flat_index']}**를 선택했다. XYZ는 `{initial['initial_xyz_m']}` m이며 S2/S3에서 exact equality다. Candidate-local index는 `{initial['candidate_local_index']}`다.", '',+ '- 각 후보 입력은 저장된 오름차순 raster 순서(S2 297개 / S3 599개)를 유지했다. 기존 `fps_indices(..., 32, seed=fps_seed(0, BOX), initial=[local])`를 방법당 정확히 1회 호출했다.',+ '- `seed`는 기존 SeedSequence 계약에 맞게 전달했으며 initial 경로에서 RNG 생성/최초 draw가 없음을 실행 중 차단 검증했다. 초기점 포함 32개의 고유 source index다.',+ '- 두 FPS가 끝난 후에만 control을 GT matcher 및 negative ROI로 평가했다. 전체 32-step trace는 생성하지 않았다.', '',+ '| 방법 | 실제 node | Rim matching node | C Priority refs /103 | Unique GT reference IDs | Negative union /32 | Depth min / median / p95 / max (m) |',+ '| --- | ---: | ---: | ---: | --- | ---: | --- |']+ for method, row in control.items():+ d = row['priority_depth_m']+ lines.append(f"| {method} | {row['node_count']} | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['priority_reference_ids']} | {row['negative_roi']['known_negative_union']['count']} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} |")+ lines += ['', '공통 초기점 control의 실제 선택 flat index는 선택 순서대로 다음과 같다.', '']+ for method, row in control.items():+ lines += [f"- {method}: `{row['selected_flat_indices']}`"]+ lines += ['', 'Reference 집합 비교(C):', '']+ for name, row in result['control_reference_comparison'].items():+ lines += [f"- {name}: {row['count']}개, `{row['reference_ids']}`"]+ node_comparison = result['control_node_comparison']+ lines += ['', f"선택 source index 교집합은 {node_comparison['intersection']['count']}개 "+ f"(`{node_comparison['intersection']['flat_indices']}`), S2-only / S3-only는 각각 "+ f"{node_comparison['S2_only']['count']} / {node_comparison['S3_only']['count']}개다. "+ '각 선택 XYZ 및 candidate-local index와 전체 차집합은 아래 JSON에 보존했다.', '',+ '## 해석과 연구적 판단', '', result['interpretation_ko'], '',+ '- 저장 seed의 S3 Priority 변동 폭은 2 references(1.94%p), S2는 6 references(5.83%p)다. S3의 덮인 ID 집합도 seed에 따라 달라진다. 이는 관측된 초기점 민감성의 범위이며 초기점의 독립적인 인과 효과를 정량화한 값은 아니다.',+ '- 같은 seed끼리의 B S2−S3 차이는 seed 0/1/2에서 10/2/4 references다. C의 차이 5는 seed 0보다 작고 seed 1/2보다 크다. 따라서 seed 0의 큰 차이 전부가 지속되는 것은 아니지만, 이 공통 초기점에서도 S3의 낮은 coverage는 남는다.',+ '- 관측된 seed별 B Priority 범위 및 같은 초기점 C를 함께 읽어야 한다. A와 C는 sampling 단계가 다르므로 동일 조건 성능 비교로 사용하지 않는다.',+ '- 한 공통 초기점 결과를 전체 seed·episode에 일반화하지 않는다. 후보 수·위치·오염·원거리 depth의 독립적인 인과 기여율은 분해하지 않았다. Phase2의 기존 경로 분석을 재사용하며 새 trace를 만들지 않았다.',+ '- 다음 연구 판단은 초기점 민감성과 후보 집합 효과를 함께 검토하는 것이다. 새 sampling 정책, 후보 제거, depth cutoff, GT quota, FPS 변형의 채택 근거로 사용하지 않는다. 추가 초기점/episode 검증은 별도 승인 대상이다.', '',+ '## 구현·검증·source hash', '',+ '- 추가 구현: [run_priority_fps_seed_control.py](../../visual/runtime/test/run_priority_fps_seed_control.py), [test_priority_fps_seed_control.py](../../visual/runtime/test/test_priority_fps_seed_control.py). 기존 production·Phase1/2·run_sampling 파일은 보존했다.',+ '- Phase1 source geometry/matcher helper와 Phase2 `verify_fps_source` 검증 경로를 재사용했다. 새 sampler나 logger/publisher 구현은 추가하지 않았다.',+ f'- **PASS**: 신규 및 관련 기존 테스트. `{test_summary}`. [test log]({rel(output/"tests.log")}). 테스트의 FPS/전체 sampler 반복은 합성 입력에만 적용했다.',+ '- **PASS**: evaluated source와 현재 FPS·candidate·allocation 정의 일치, seed0 Phase1/2 reference ID 및 저장 순서 일치, seed1/2 source/feature/role alignment, 23 metadata row 및 seed 간 공통 source feature equality.',+ '- **PASS**: 저장 분석 FPS 호출 차단, 후보 교집합 252 / initial 114957, initial XYZ exact equality, 초기 RNG draw 차단, 32 unique indices·초기점 포함·실제 후보 membership·local/global 대응·raster 순서 유지.',+ '- **PASS**: 합성 GT annotation 변경 시 선택 불변, 기존 same-pair joint matching 및 reference 중복 제거, 저장 negative ROI union 점유 일치, 원본 artifact·입력·기존 파일 hash 불변, HTML/Markdown 상대 링크와 PNG 생성 확인.',+ '- **FAIL**: 없음. 불일치 시 assertion·tolerance·GT·seed 규칙을 변경하지 않고 중단하도록 구현했다.',+ '- **SKIP / 미검증**: simulator·renderer·CUDA/GPU backend, 다른 frame/episode, 추가 공통 초기점 sweep, PCL·Graph·BC·정책/학습 실험, 외부 upload·dependency 설치·commit. 현재 호스트에서는 CPU NumPy offline 진단만 실행했다.',+ f'- Git 시작/종료 및 보존한 기존 변경: [start]({rel(output/"git_start.json")}), [end]({rel(output/"git_end.json")}), [diff]({rel(output/"implementation.patch")}). 시작 Git dirty 상태이므로 commit만으로 재현할 수 없으며 source snapshot과 hash를 함께 보존했다.', '',+ '| Source / input | SHA-256 |', '| --- | --- |']+ for path, digest in result['source_hashes'].items():+ lines.append(f'| `{path}` | `{digest}` |')+ lines += ['', '위 표는 실제 진단 실행 시점의 source hash다. 전체 입력/evaluated source hash와 원본 보존 기록은 아래 JSON에 있다. '+ '그림·보고서만 저장 결과로 갱신한 경우 실제 실행 source는 `execution_source/`, 최종 source는 `diagnostic_source/` 및 '+ '`source_hashes.json`의 `report_generation_sources`로 구분한다. FPS 결과는 재실행하지 않는다.', '', '## 산출물', '']+ for filename in ('priority_fps_seed_control.html', 'priority_fps_seed_control.json', 'seed_initial_points.png',+ 'seed_priority_final_coverage.png', 'shared_initial_overlay.png', 'shared_initial_coverage.png',+ 'source_hashes.json', 'verification.json', 'tests.log', 'implementation.patch'):+ lines.append(f'- [{filename}]({rel(output/filename)})')+ lines += ['', '**Phase 3 결과 제출 후 중단한다. 후속 변경은 별도 승인 후 진행한다.**', '']+ REPORT.write_text('\n'.join(lines), encoding='utf-8')+ shutil.copyfile(REPORT, output/'report_snapshot.md')+++def diagnose(source, output_root, baseline_path):+ if os.environ.get('WANDB_MODE') != 'disabled':+ raise ValueError('set WANDB_MODE=disabled for local-only execution')+ if REPORT.exists():+ raise FileExistsError('refuse to overwrite Phase3 report')+ baseline = json.loads(Path(baseline_path).read_text())+ verify_preserved(baseline)+ source = Path(source).resolve()+ comparison = json.loads((source/'comparison.json').read_text())+ require_equal(comparison['run_id'], SOURCE_RUN, 'Task03 run')+ config = comparison['config']+ source_checks = source_contract(source, config)+ fps_checks = verify_fps_source(source, config['source_sha256']['visual/runtime/sampling.py'])+ phase1_path = REPO/'experiments'/PHASE1/'diagnostic.json'+ phase2_path = REPO/'experiments'/PHASE2/'priority_fps_trace.json'+ phase1, phase2 = (json.loads(p.read_text()) for p in (phase1_path, phase2_path))+ for obj, run, phase in ((phase1, PHASE1, 1), (phase2, PHASE2, 2)):+ require_equal(obj['run_id'], run, f'Phase{phase} run')+ require_equal(obj['source_run_id'], SOURCE_RUN, f'Phase{phase} Task03 source')+ require_equal(phase1['inputs_unchanged'], True, 'Phase1 inputs unchanged')+ for field in ('saved_reference_order_and_geometry_exact', 'target_coverage_exact',+ 'saved_negative_roi_counts_exact'):+ require_equal(phase1['frames'][0][field], True, 'Phase1 Frame0 '+field)+ require_equal(phase2['pass_all'], True, 'Phase2 pass_all')+ for relative, expected in phase2['config']['source_sha256'].items():+ require_equal(digests(REPO/relative)[1], expected, 'Phase2 diagnostic source '+relative)+ episode, masks = Path(config['input']), Path(config['masks'])+ inputs = [source/'comparison.json', source/'f0000_samples.npz', source/'f0000_metrics.json',+ episode, masks, episode.with_name('segmentation_id_map.json'), masks.with_name('tracking.json'),+ phase1_path, phase2_path]+ for name, expected in phase2['config']['input_sha256'].items():+ require_equal(digests(Path(name))[1], expected, 'Phase2 input '+name)+ before = hashes(inputs)+ current_sources = [Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'),+ Path(__file__).with_name('run_priority_fps_trace.py'), Path(__file__).with_name('run_rim_bottleneck.py'),+ Path(__file__).with_name('sampling_evaluation.py'), REPO/'visual/runtime/sampling.py',+ REPO/'visual/runtime/geometry.py', REPO/'visual/runtime/rgbd.py']+ source_hashes = hashes(current_sources)+ run_config = dict(task='03-D', phase=3, source_run_id=SOURCE_RUN, phase1_run_id=PHASE1,+ phase2_run_id=PHASE2, frame=0, methods=list(METHODS), num_points=256,+ structural_ratio=.25, orientation_threshold_deg=20, box_budget=127, priority_count=32,+ matching_px_m=[2., .003], reference_count=103, input_sha256=before, source_sha256=source_hashes,+ real_fps_calls_per_method=1, additional_initial_sweeps=0, simulator_executed=False,+ gpu_executed=False, device='cpu', full_sampling_executed=False,+ candidate_normal_feature_recalculation=False, python=platform.python_version(), numpy=np.__version__)+ with ExperimentLogger(team='visual', config=run_config, seed=0,+ model='task03d_priority_fps_seed_control', job_type='evaluate', root=output_root) as logger:+ output = logger.directory+ write_json(output/'git_start.json', baseline)+ shutil.copyfile(Path(baseline_path).with_name('git_start.diff'), output/'git_start.diff')+ # Tests precede real control, so any failing contract stops the experiment.+ with (output/'tests.log').open('w') as log:+ test = subprocess.run([sys.executable, '-m', 'unittest', *TEST_MODULES, '-v'],+ cwd=REPO, stdout=log, stderr=subprocess.STDOUT, check=False)+ logger.link_output(output/'tests.log', kind='reports')+ if test.returncode:+ write_json(output/'verification.json', dict(status='FAIL', reason='required tests failed', real_fps_calls=0))+ logger.link_output(output/'verification.json', kind='reports')+ raise RuntimeError('required tests failed; see tests.log; no real FPS executed')+ test_lines = (output/'tests.log').read_text().splitlines()+ test_summary = next(line for line in test_lines if line.startswith('Ran '))+'; '+test_lines[-1]+ frame, geometry, gt = _frame_and_context(comparison, episode, masks)+ metrics = json.loads((source/'f0000_metrics.json').read_text())+ with np.load(source/'f0000_samples.npz', allow_pickle=False) as archive, forbid_sampling():+ candidates, selections, alignment = load_saved(archive, config, metrics, frame, geometry, phase2)+ context = evaluation_context(frame, geometry_evidence(frame), gt, config['camera'], config['robot_ids'])+ refs = tuple(archive[f'evaluation/box/reference_{suffix}'] for suffix in ('uv', 'xyz'))+ require_equal(len(refs[0]), 103, 'GT reference count')+ for a, b in zip(refs, context['references']['box']):+ np.testing.assert_array_equal(a, b)+ matcher = CoverageMatcher(geometry, BOX, refs)+ saved = summarize_saved(selections, phase1, phase2, matcher, frame, context['negatives']['box'])+ for method, seeds in saved.items():+ for seed, row in seeds.items():+ key = f'{method}_n256_r0.25_t20_s{seed}'+ for name, roi in row['negative_roi'].items():+ require_equal(roi['count'], metrics[key]['objects']['box']['negative'][name]['priority'], key+' ROI '+name)+ # No GT/ROI/matcher parameter crosses this selection boundary.+ with patch(__name__+'.fps_indices', wraps=fps_indices) as calls:+ orders, initial = select_control(candidates)+ require_equal(calls.call_count, 2, 'total real FPS call count')+ # Only now may selected control points enter the matcher/negative ROIs.+ with forbid_sampling():+ control = score_control(orders, matcher, frame, context['negatives']['box'])+ require_equal(hashes(inputs), before, 'input hashes after evaluation')+ preservation = verify_preserved(baseline)+ difference = control['S2']['priority_reference_count']-control['S3']['priority_reference_count']+ ranges = {m: [min(r['priority_reference_count'] for r in seeds.values()),+ max(r['priority_reference_count'] for r in seeds.values())] for m, seeds in saved.items()}+ interpretation = (f"Saved Priority ranges: S2 {ranges['S2']}, S3 {ranges['S3']} references of 103. "+ f"At shared initial 114957, S2 covers {control['S2']['priority_reference_count']}/103 and S3 "+ f"{control['S3']['priority_reference_count']}/103 (S2 minus S3: {difference}). "+ 'This single initialization constrains interpretation to the fixed candidate sets and FPS conditions; '+ 'candidate count, position, contamination and far depth have not been causally separated.')+ interpretation_ko = (f"저장된 seed 0/1/2의 B Priority coverage는 S2 {ranges['S2'][0]}–{ranges['S2'][1]}/103, "+ f"S3 {ranges['S3'][0]}–{ranges['S3'][1]}/103이다. 공통 초기점 114957의 C Priority는 "+ f"S2 **{control['S2']['priority_reference_count']}/103**, S3 **{control['S3']['priority_reference_count']}/103** "+ f"(S2−S3 {difference} refs)이다. "+ + ('이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. '+ if difference > 0 else '저장 seed에서 관측한 차이가 이 공통 초기점에서는 축소되거나 역전되어 초기점 민감성의 근거가 된다. ')+ + '단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.')+ result = dict(run_id=logger.run_id, source_run_id=SOURCE_RUN, config=run_config,+ source_contract=source_checks, fps_source_check=fps_checks, source_hashes=source_hashes,+ saved=saved, saved_alignment=alignment, initial_control=initial, control=control,+ control_reference_comparison=compare_ids(*(control[m]['priority_reference_ids'] for m in METHODS)),+ control_node_comparison={name: dict(count=row['count'], flat_indices=row['reference_ids'])+ for name, row in compare_ids(*(control[m]['selected_flat_indices'] for m in METHODS)).items()},+ interpretation=interpretation, interpretation_ko=interpretation_ko,+ input_hashes_unchanged=True, pass_all=True)+ write_json(output/'priority_fps_seed_control.json', result)+ write_json(output/'source_hashes.json', dict(inputs_before=before, inputs_after=hashes(inputs),+ diagnostic_sources=source_hashes, evaluated_fps=fps_checks, original_preservation=preservation))+ create_plots(output, frame, saved, control, refs[0])+ create_markdown(output, result, test_summary)+ create_html(output, result, source)+ for path in current_sources:+ dest = output/'diagnostic_source'/path.relative_to(REPO)+ dest.parent.mkdir(parents=True, exist_ok=True)+ shutil.copyfile(path, dest)+ logger.link_output(dest, kind='reports')+ diff = subprocess.check_output(['git', 'diff', '--binary'], cwd=REPO)+ for path in (Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'), REPORT):+ delta = subprocess.run(['git', 'diff', '--no-index', '--', '/dev/null', str(path.relative_to(REPO))],+ cwd=REPO, stdout=subprocess.PIPE, check=False)+ if delta.returncode != 1:+ raise ValueError('cannot preserve added-file diff')+ diff += delta.stdout+ (output/'implementation.patch').write_bytes(diff)+ write_json(output/'git_end.json', dict(git_status=subprocess.check_output(['git', 'status', '--short'], cwd=REPO).decode(),+ git_head=subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=REPO).decode().strip(),+ original_preservation=verify_preserved(baseline)))+ verification = dict(status='PASS', required_tests=dict(status='PASS', summary=test_summary, modules=TEST_MODULES),+ source_and_input_contract='PASS', seed0_phase2_ids_reused='PASS', saved_source_feature_role_alignment='PASS',+ saved_analysis_fps_calls=0, shared_candidate_count=252, shared_initial=114957,+ initial_xyz_exact='PASS', initial_rng_draws=0, real_fps_calls=initial['real_fps_calls'],+ unique_count_includes_initial=COUNT, raster_local_global_membership='PASS',+ gt_annotation_independence='PASS (synthetic tests; no GT argument in selection)',+ same_pair_joint_matching_and_reference_dedup='PASS', negative_roi_union='PASS',+ inputs_unchanged='PASS', original_preservation=preservation,+ skipped=['simulator', 'renderer', 'GPU/CUDA', 'other frame/episode', 'initialization sweep',+ 'new sampling policy', 'external upload', 'dependency installation', 'commit'])+ write_json(output/'verification.json', verification)+ # Check all local href/src targets without browser/network dependencies.+ from html.parser import HTMLParser+ class Links(HTMLParser):+ def handle_starttag(self, tag, attrs):+ for attr, value in attrs:+ if attr in ('href', 'src') and value and not (output/value).is_file():+ raise ValueError('broken local HTML link: '+value)+ Links().feed((output/'priority_fps_seed_control.html').read_text())+ markdown_links = re.findall(r'\]\(([^)]+)\)', REPORT.read_text())+ for target in markdown_links:+ if not (REPORT.parent/target).is_file():+ raise ValueError('broken local Markdown link: '+target)+ for png in output.glob('*.png'):+ pixels = plt.imread(png)+ if pixels.ndim != 3 or min(pixels.shape[:2]) < 400:+ raise ValueError('invalid report PNG: '+str(png))+ verification['html_and_markdown_local_links'] = dict(status='PASS', markdown_link_count=len(markdown_links))+ verification['png_readback'] = 'PASS (4 PNGs, dimensions and pixel decode)'+ write_json(output/'verification.json', verification)+ for path in sorted(output.iterdir()):+ if path.is_file() and path.name not in ('metadata.json', 'manifest.json', 'config.yaml', 'metrics.json') and not path.name.endswith('.tracking.json'):+ logger.link_output(path, kind='metrics' if path.name in ('priority_fps_seed_control.json','source_hashes.json') else 'reports')+ logger.log({m: {'saved_priority_seed'+s: r['priority_reference_count'] for s, r in seeds.items()}+ for m, seeds in saved.items()}, step=0, prefix='eval/task03d/saved')+ logger.log({m: dict(priority_references=r['priority_reference_count'], rim_matching_nodes=r['rim_matching_node_count'])+ for m, r in control.items()}, step=0, prefix='eval/task03d/control')+ logger.record(source_run_id=SOURCE_RUN, phase1_run_id=PHASE1, phase2_run_id=PHASE2,+ real_fps_calls=initial['real_fps_calls'], inputs_unchanged=True,+ simulator_executed=False, gpu_executed=False)+ return output+++def main():+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument('--source', type=Path, default=REPO/'visual/results/sampling'/SOURCE_RUN)+ parser.add_argument('--out', type=Path, default=REPO/'experiments')+ parser.add_argument('--baseline', type=Path, required=True, help='pre-change workspace/artifact SHA256 and git status snapshot')+ args = parser.parse_args()+ print(diagnose(args.source, args.out, args.baseline))+++if __name__ == '__main__':+ main()diff --git a/visual/runtime/test/test_priority_fps_seed_control.py b/visual/runtime/test/test_priority_fps_seed_control.pynew file mode 100644index 0000000..f653b9b--- /dev/null+++ b/visual/runtime/test/test_priority_fps_seed_control.py@@ -0,0 +1,244 @@+"""Phase3 contracts. All FPS calls here use synthetic points, never Task03 data."""+import copy+from types import SimpleNamespace+import unittest+from unittest.mock import patch++import numpy as np++from visual.runtime.rgbd import PEG, BOX+from visual.runtime.sampling import fps_indices+from visual.runtime.test import run_priority_fps_seed_control as control+from visual.runtime.test.sampling_evaluation import CoverageMatcher+++class Archive(dict):+ @property+ def files(self):+ return list(self)+++def synthetic_candidates():+ # Common source pixels always point at exactly the same source XYZ.+ def method(flat):+ xyz = np.column_stack((np.sin(flat*.3), np.cos(flat*.2), flat*.01)).astype(np.float32)+ return dict(flat=flat, points=xyz)+ return dict(S2=method(np.arange(100, 148)), S3=method(np.arange(108, 156)))+++def saved_fixture():+ """Synthetic 256-row archives with the real shape/quota/field contracts."""+ shape = (512, 512)+ flat = np.arange(np.prod(shape))+ xyz = np.column_stack((flat*.001, flat*.002, np.ones(len(flat)))).astype(np.float32).reshape(*shape, 3)+ geometry = SimpleNamespace(xyz=xyz,+ observed_mask=lambda oid: (flat < 90000 if oid == PEG else flat >= 90000).reshape(shape))+ frame = SimpleNamespace(source_frame=0, depth=np.ones(shape, np.float32))+ archive = Archive(source_frame=np.array(0), shape=np.array(shape))+ config, metrics, phase2 = dict(conditions={}), {}, dict(methods={})+ field_names = ['object_mask', 'valid_points', 'normals', 'normal_valid', 'depth_jump_m',+ 'depth_pair_valid', 'depth_discontinuity', 'mask_boundary', 'depth_validity_boundary',+ 'image_boundary', 'normal_variation_rad', 'normal_variation_valid', 'normal_neighbor_count',+ 'orientation_evidence', 'depth_evidence', 'occluding_evidence', 'occluded_evidence',+ 'invalid_evidence', 'mask_evidence', 'orientation_score_deg', 'orientation_candidate',+ 'depth_only_candidate', 'structural_candidate']+ for method, (estimator, _, count, _, _) in control.METHODS.items():+ candidates = np.sort(np.r_[np.arange(90000, 90000+count-3), control.FIRST[method]])+ archive[f'evidence/{estimator}/1/20/orientation_flat'] = candidates+ phase2['methods'][method] = dict(candidate_flat_indices=candidates.tolist())+ for seed in (0, 1, 2):+ key = f'{method}_n256_r0.25_t20_s{seed}'+ config['conditions'][key] = dict(method=method, num_points=256, structural_ratio=.25,+ orientation_threshold_deg=20, seed=seed)+ first = control.FIRST[method][seed]+ selected = np.r_[np.arange(129), first, candidates[candidates != first][:126]]+ box = np.arange(256) >= 129+ archive[key+'/flat_index'] = selected+ archive[key+'/points'] = xyz.reshape(-1, 3)[selected]+ archive[key+'/pixels_vu'] = np.column_stack(np.unravel_index(selected, shape))+ archive[key+'/object_id'] = box.astype(np.int64)+ archive[key+'/priority_selected'] = np.r_[np.arange(129) < 32, np.arange(127) < 32]+ archive[key+'/depth_priority_selected'] = np.zeros(256, bool)+ for name in field_names:+ value = np.zeros((256, 3), np.float32) if name == 'normals' else np.zeros(256, bool)+ if name in ('object_mask', 'valid_points'):+ value[:] = True+ if name in ('orientation_candidate', 'structural_candidate'):+ value[box] = True+ archive[key+'/metadata/'+name] = value+ objects = {}+ for name, budget in [('peg', 129), ('box', 127)]:+ objects[name] = dict(counts=dict(budget=budget, selected=budget, priority=32,+ orientation_priority=32, depth_priority=0, surface_fps=budget-32))+ n = control.FINAL[method][seed]+ objects['box']['structural'] = dict(tolerance={'2px_3mm': dict(gt_visible=103, sampled=n, gt_coverage=n/103)})+ metrics[key] = dict(objects=objects)+ return archive, config, metrics, frame, geometry, phase2+++class SharedInitialTests(unittest.TestCase):+ def select(self, candidates=None):+ return control.select_control(synthetic_candidates() if candidates is None else candidates,+ expected_shared=40, expected_initial=128)++ def test_initial_included_total_32_exact_local_global_no_rng(self):+ candidates = synthetic_candidates()+ before = copy.deepcopy(candidates)+ with patch.object(control, 'fps_indices', wraps=fps_indices) as calls:+ orders, info = self.select(candidates)+ self.assertEqual(calls.call_count, 2)+ self.assertEqual(info['candidate_local_index'], {'S2': 28, 'S3': 20})+ self.assertEqual(info['initial_rng_draws'], 0)+ for method, row in orders.items():+ self.assertEqual(len(row['flat']), 32)+ self.assertEqual(len(set(row['flat'])), 32)+ self.assertEqual(row['flat'][0], 128)+ np.testing.assert_array_equal(candidates[method]['flat'][row['local']], row['flat'])+ np.testing.assert_array_equal(candidates[method]['points'][row['local']], row['xyz'])+ for field in ('flat', 'points'):+ np.testing.assert_array_equal(candidates[method][field], before[method][field])+ np.testing.assert_array_equal(orders['S2']['xyz'][0], orders['S3']['xyz'][0])++ def test_initial_path_never_constructs_rng_even_when_seed_changes(self):+ points = synthetic_candidates()['S2']['points']+ with patch('visual.runtime.sampling.np.random.default_rng', side_effect=AssertionError('RNG draw')):+ a = fps_indices(points, 32, seed=0, initial=[28])+ b = fps_indices(points, 32, seed=98765, initial=[28])+ np.testing.assert_array_equal(a, b)+ self.assertEqual(a[0], 28)++ def test_intersection_and_initial_mismatch_stop_before_fps(self):+ for kwargs in (dict(expected_shared=39, expected_initial=128), dict(expected_shared=40, expected_initial=127)):+ with patch.object(control, 'fps_indices', side_effect=AssertionError('must stop before FPS')):+ with self.assertRaises(ValueError):+ control.select_control(synthetic_candidates(), **kwargs)++ def test_order_xyz_and_short_count_mismatch_stop_before_fps(self):+ for mutation in ('order', 'xyz', 'count'):+ c = synthetic_candidates()+ if mutation == 'order':+ c['S2']['flat'] = c['S2']['flat'][::-1]+ elif mutation == 'xyz':+ c['S3']['points'][20, 0] += .001+ else:+ c['S2'] = {k: v[:31] for k, v in c['S2'].items()}+ with patch.object(control, 'fps_indices', side_effect=RuntimeError('must stop before FPS')):+ with self.assertRaises((ValueError, AssertionError)):+ self.select(c)++ def test_invalid_fps_order_is_rejected(self):+ for order in (np.zeros(32, np.int64), np.arange(31), np.r_[28, np.arange(30), 999]):+ with patch.object(control, 'fps_indices', return_value=order):+ with self.assertRaises(ValueError):+ self.select()+ with patch.object(control, 'fps_indices', return_value=np.arange(32)):+ with self.assertRaisesRegex(ValueError, 'initial included'):+ self.select()++ def test_gt_annotation_change_cannot_change_control_selection(self):+ candidates = synthetic_candidates()+ orders_a, _ = self.select(candidates)+ xyz = np.zeros((1, 200, 3), np.float32)+ geometry = SimpleNamespace(valid_depth=np.ones((1, 200), bool), xyz=xyz,+ observed_mask=lambda oid: np.ones((1, 200), bool))+ frame = SimpleNamespace(depth=np.ones((1, 200), np.float32))+ annotations = [((np.array([[128., 0.]]), np.zeros((1, 3))), np.zeros((1, 200), bool)),+ ((np.array([[999., 999.]]), np.ones((1, 3))*100), np.ones((1, 200), bool))]+ scores = []+ for refs, negative in annotations:+ matcher = CoverageMatcher(geometry, BOX, refs)+ scores.append(control.score_control(orders_a, matcher, frame, {'negative': negative}))+ orders_b, _ = self.select(candidates) # synthetic repeat only+ for method in control.METHODS:+ np.testing.assert_array_equal(orders_a[method]['flat'], orders_b[method]['flat'])+ self.assertNotEqual(scores[0][method]['negative_roi'], scores[1][method]['negative_roi'])+ with self.assertRaises(TypeError):+ control.select_control(candidates, gt={})+++class SavedAnalysisTests(unittest.TestCase):+ def test_source_feature_role_alignment_without_fps(self):+ fixture = saved_fixture()+ with control.forbid_sampling():+ candidates, selected, checks = control.load_saved(*fixture)+ self.assertEqual(len(checks), 6)+ for method in control.METHODS:+ self.assertEqual(len(candidates[method]['flat']), control.METHODS[method][2])+ for seed in (0, 1, 2):+ self.assertEqual(selected[method][seed]['flat'][0], control.FIRST[method][seed])+ self.assertTrue(all(c['feature_and_role_alignment'] for c in checks.values()))++ def test_corrupt_source_feature_role_or_order_fails(self):+ key = 'S2_n256_r0.25_t20_s1'+ for field in ('points', 'metadata/normals', 'metadata/orientation_candidate', 'priority_selected', 'pixels_vu'):+ fixture = saved_fixture()+ array = fixture[0][key+'/'+field]+ fixture[0][key+'/'+field] = array.copy()+ array = fixture[0][key+'/'+field]+ if field == 'metadata/normals':+ array[0, 0] = 1 # same source pixel, inconsistent saved feature+ elif field == 'priority_selected':+ array[129] = False+ elif field == 'metadata/orientation_candidate':+ array[129] = False+ else:+ array[0, 0] += 1+ with control.forbid_sampling(), self.assertRaises((ValueError, AssertionError)):+ control.load_saved(*fixture)++ def test_seed0_reused_and_only_seed1_2_matched_without_fps(self):+ flat = np.arange(32, dtype=np.int64)+ xyz = np.zeros((32, 3), np.float32)+ frame = SimpleNamespace(depth=np.ones((1, 32), np.float32))+ negatives = dict(negative=np.zeros((1, 32), bool))+ rows = {m: {s: dict(flat=flat, xyz=xyz, final=dict(sampled=10, gt_coverage=10/103))+ for s in (0, 1, 2)} for m in control.METHODS}+ trace = [dict(xyz_m=p.tolist(), flat_index=int(f), depth_m=1., rim_reference_matched=i == 1,+ matched_rim_reference_ids=[2, 3] if i == 1 else [],+ selected_negative_roi=dict(negative=False, known_negative_union=False))+ for i, (p, f) in enumerate(zip(xyz, flat))]+ phase2 = dict(methods={m: dict(stored_priority_flat_indices=flat.tolist(), trace=trace,+ priority_reference_ids=[2, 3], priority_reference_count=2) for m in control.METHODS})+ phase1 = dict(frames=[dict(conditions={m: dict(reference_ids=dict(P=[2, 3])) for m in control.METHODS})])+ calls = []+ def match(selected, **kwargs):+ calls.append(selected.copy())+ self.assertEqual(kwargs, dict(px=2., m=.003))+ return np.array([2, 3]), selected[1:2]+ with control.forbid_sampling():+ result = control.summarize_saved(rows, phase1, phase2, SimpleNamespace(reference_hits=match), frame, negatives)+ self.assertEqual(len(calls), 4)+ for method in control.METHODS:+ self.assertEqual(result[method]['0']['priority_reference_ids'], [2, 3])+ self.assertEqual(result[method]['0']['rim_matching_node_count'], 1)+ self.assertEqual(result[method]['0']['final_sampling']['numerator'], 10)+ phase2['methods']['S2']['priority_reference_ids'] = [2, 4]+ with control.forbid_sampling(), self.assertRaisesRegex(ValueError, 'Phase1/2 IDs'):+ control.summarize_saved(rows, phase1, phase2, SimpleNamespace(reference_hits=match), frame, negatives)++ def test_joint_same_pair_and_reference_dedup(self):+ shape = (1, 10)+ xyz = np.zeros((*shape, 3), np.float32)+ xyz[0, 3] = [.1, 0, 0]+ geometry = SimpleNamespace(valid_depth=np.ones(shape, bool), xyz=xyz,+ observed_mask=lambda oid: np.ones(shape, bool))+ # Selected nodes: 0 is near ref 0 only in 2D, 3 only in XYZ.+ refs = (np.array([[0., 0.], [7., 0.]]), np.array([[.1, 0, 0], [0, 0, 0]]))+ matcher = CoverageMatcher(geometry, BOX, refs)+ ids, hits = matcher.reference_hits(np.array([0, 3], np.int64))+ self.assertEqual(ids.tolist(), [])+ self.assertEqual(hits.tolist(), [])+ ids, hits = matcher.reference_hits(np.array([6, 7, 8], np.int64))+ self.assertEqual(ids.tolist(), [1])+ self.assertEqual(len(hits), 3)+ frame = SimpleNamespace(depth=np.ones(shape, np.float32))+ a = np.zeros(shape, bool); b = a.copy(); a[0, [6, 7]] = True; b[0, [7, 8]] = True+ summary = control.point_summary(np.array([6, 7, 8]), frame, dict(a=a, b=b), ids, hits, xyz[0, [6, 7, 8]])+ self.assertEqual(summary['negative_roi']['known_negative_union']['count'], 3)+ self.assertEqual(summary['priority_reference_count'], 1)+ with self.assertRaisesRegex(ValueError, 'deduplicated'):+ control.point_summary(np.array([6, 7, 8]), frame, dict(a=a), [1, 1], hits, xyz[0, [6, 7, 8]])+++if __name__ == '__main__':+ unittest.main()diff --git a/docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md b/docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.mdnew file mode 100644index 0000000..b92713d--- /dev/null+++ b/docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md@@ -0,0 +1,112 @@+# Task 03-D Phase 3 — FPS Initialization vs Candidate Distribution++**상태: 완료 / 승인 범위 종료.**++저장된 seed 0/1/2의 B Priority coverage는 S2 7–13/103, S3 3–5/103이다. 공통 초기점 114957의 C Priority는 S2 **8/103**, S3 **3/103** (S2−S3 5 refs)이다. 이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. 단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.++## 실행 조건과 재사용 artifact++- 새 run: `f36f1e9e2bb64866b8d6c792db158635`. 기존 ExperimentLogger / artifact manifest·sidecar 계약 재사용, `WANDB_MODE=disabled` 로컬 기록.+- Frame 0, Box, S2(FD2) / S3(PCA5), num_points=256, structural_ratio=.25, threshold=20°, Box budget=127, Priority quota=32.+- 동일 GT rim line reference 103개. 동일 point/reference pair에서 `2px AND 3mm`, reference ID 중복 제거. GT rim/negative ROI는 평가 전용이다.+- [Task03 samples](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_samples.npz), [frame metrics](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/f0000_metrics.json), [config](../../visual/results/sampling/2551448b0fae4c6bbce3caf48774275f/comparison.json) (`2551448b0fae4c6bbce3caf48774275f`).+- [Phase1 JSON](../../experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json) (`d3f14ee494894daabb8ba2fab8e1b00c`), [Phase2 JSON](../../experiments/aa5d71078e0841fd886b5026d6030ebc/priority_fps_trace.json) (`aa5d71078e0841fd886b5026d6030ebc`). Seed 0 Priority ID/coverage 및 matched node는 Phase2를 그대로 사용하고 Phase1과 대조했다.+- 저장 결과 분석은 FPS·candidate·normal·feature를 재실행하지 않았다. Source geometry와 기존 matcher/ROI만 재사용했다. Final coverage는 저장 metrics 값을 그대로 보존했다.++## A. 저장된 Final / B. 저장된 Priority++| 방법 | Seed | 첫 flat | 첫 XYZ (m) | B rim node /32 | B Priority refs /103 | A Final refs /103 | Negative union /32 |+| --- | ---: | ---: | --- | ---: | ---: | ---: | ---: |+| S2 | 0 | 101598 | (-0.0403046869, -0.0691796839, 0.307999998) | 4 | 13 (12.62%) | 16 | 3 |+| S2 | 1 | 119061 | (0.0423281267, -0.0462656245, 0.504000008) | 3 | 7 (6.80%) | 10 | 4 |+| S2 | 2 | 112919 | (0.0456230491, -0.0689199194, 0.497000009) | 2 | 7 (6.80%) | 10 | 4 |+| S3 | 0 | 96553 | (0.0496054664, -0.080683589, 0.305999994) | 1 | 3 (2.91%) | 3 | 9 |+| S3 | 1 | 117010 | (0.0381562486, -0.0567187481, 0.527999997) | 2 | 5 (4.85%) | 5 | 9 |+| S3 | 2 | 102621 | (-0.0419121087, -0.0674238279, 0.31099999) | 1 | 3 (2.91%) | 3 | 10 |++A는 최종 256점 중 Box 127점의 저장 coverage, B는 그중 실제 Priority 32점의 coverage다. B의 새 진단값으로 A를 바꾸지 않았다.++| 방법 / Seed | Priority depth min / median / p95 / max (m) | Unique GT reference IDs (B) |+| --- | --- | --- |+| S2 / 0 | 0.303000003 / 0.506000042 / 0.665299952 / 0.689999998 | [46, 48, 50, 64, 66, 68, 69, 83, 84, 85, 96, 97, 98] |+| S2 / 1 | 0.303000003 / 0.511000037 / 0.664399981 / 0.689999998 | [60, 62, 64, 79, 80, 81, 86] |+| S2 / 2 | 0.303000003 / 0.511000037 / 0.664399981 / 0.689999998 | [64, 66, 68, 69, 81, 82, 83] |+| S3 / 0 | 0.305999994 / 0.580500007 / 1.40565002 / 1.426 | [3, 4, 5] |+| S3 / 1 | 0.294999987 / 0.565500021 / 1.40565002 / 1.426 | [1, 2, 3, 87, 88] |+| S3 / 2 | 0.308999985 / 0.598999977 / 1.40565002 / 1.426 | [49, 51, 53] |++## C. 동일 초기점 offline control++후보 교집합은 252개다. GT와 무관한 `shared = sorted(set(C_S2) & set(C_S3)); initial_flat = shared[len(shared)//2]` 규칙으로 **114957**를 선택했다. XYZ는 `[0.030216798186302185, -0.07050585746765137, 0.5730000138282776]` m이며 S2/S3에서 exact equality다. Candidate-local index는 `{'S2': 152, 'S3': 449}`다.++- 각 후보 입력은 저장된 오름차순 raster 순서(S2 297개 / S3 599개)를 유지했다. 기존 `fps_indices(..., 32, seed=fps_seed(0, BOX), initial=[local])`를 방법당 정확히 1회 호출했다.+- `seed`는 기존 SeedSequence 계약에 맞게 전달했으며 initial 경로에서 RNG 생성/최초 draw가 없음을 실행 중 차단 검증했다. 초기점 포함 32개의 고유 source index다.+- 두 FPS가 끝난 후에만 control을 GT matcher 및 negative ROI로 평가했다. 전체 32-step trace는 생성하지 않았다.++| 방법 | 실제 node | Rim matching node | C Priority refs /103 | Unique GT reference IDs | Negative union /32 | Depth min / median / p95 / max (m) |+| --- | ---: | ---: | ---: | --- | ---: | --- |+| S2 | 32 | 3 | 8 (7.77%) | [38, 40, 42, 78, 79, 80, 91, 92] | 5 | 0.303000003 / 0.505500019 / 0.665299952 / 0.689999998 |+| S3 | 32 | 1 | 3 (2.91%) | [5, 6, 7] | 9 | 0.294999987 / 0.578500032 / 1.40565002 / 1.426 |++공통 초기점 control의 실제 선택 flat index는 선택 순서대로 다음과 같다.++- S2: `[114957, 95454, 109831, 104212, 98091, 120059, 112394, 118550, 116497, 111367, 112908, 111383, 120073, 118013, 117521, 113933, 110854, 115982, 101595, 111880, 119042, 114965, 112907, 107798, 120080, 105748, 115471, 99555, 118035, 118008, 118523, 95015]`+- S3: `[114957, 106747, 87254, 109819, 87767, 84782, 109829, 101170, 108294, 108794, 105738, 107270, 119062, 107771, 108795, 102193, 109318, 105746, 113403, 103135, 116989, 111355, 105741, 84783, 106758, 119032, 112907, 94500, 102117, 107259, 105736, 116497]`++Reference 집합 비교(C):++- intersection: 0개, `[]`+- S2_only: 8개, `[38, 40, 42, 78, 79, 80, 91, 92]`+- S3_only: 3개, `[5, 6, 7]`++선택 source index 교집합은 3개 (`[112907, 114957, 116497]`), S2-only / S3-only는 각각 29 / 29개다. 각 선택 XYZ 및 candidate-local index와 전체 차집합은 아래 JSON에 보존했다.++## 해석과 연구적 판단++저장된 seed 0/1/2의 B Priority coverage는 S2 7–13/103, S3 3–5/103이다. 공통 초기점 114957의 C Priority는 S2 **8/103**, S3 **3/103** (S2−S3 5 refs)이다. 이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 ���이가 남는다. 단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.++- 저장 seed의 S3 Priority 변동 폭은 2 references(1.94%p), S2는 6 references(5.83%p)다. S3의 덮인 ID 집합도 seed에 따라 달라진다. 이는 관측된 초기점 민감성의 범위이며 초기점의 독립적인 인과 효과를 정량화한 값은 아니다.+- 같은 seed끼리의 B S2−S3 차이는 seed 0/1/2에서 10/2/4 references다. C의 차이 5는 seed 0보다 작고 seed 1/2보다 크다. 따라서 seed 0의 큰 차이 전부가 지속되는 것은 아니지만, 이 공통 초기점에서도 S3의 낮은 coverage는 남는다.+- 관측된 seed별 B Priority 범위 및 같은 초기점 C를 함께 읽어야 한다. A와 C는 sampling 단계가 다르므로 동일 조건 성능 비교로 사용하지 않는다.+- 한 공통 초기점 결과를 전체 seed·episode에 일반화하지 않는다. 후보 수·위치·오염·원거리 depth의 독립적인 인과 기여율은 분해하지 않았다. Phase2의 기존 경로 분석을 재사용하며 새 trace를 만들지 않았다.+- 다음 연구 판단은 초기점 민감성과 후보 집합 효과를 함께 검토하는 것이다. 새 sampling 정책, 후보 제거, depth cutoff, GT quota, FPS 변형의 채택 근거로 사용하지 않는다. 추가 초기점/episode 검증은 별도 승인 대상이다.++## 구현·검증·source hash++- 추가 구현: [run_priority_fps_seed_control.py](../../visual/runtime/test/run_priority_fps_seed_control.py), [test_priority_fps_seed_control.py](../../visual/runtime/test/test_priority_fps_seed_control.py). 기존 production·Phase1/2·run_sampling 파일은 보존했다.+- Phase1 source geometry/matcher helper와 Phase2 `verify_fps_source` 검증 경로를 재사용했다. 새 sampler나 logger/publisher 구현은 추가하지 않았다.+- **PASS**: 신규 및 관련 기존 테스트. `Ran 45 tests in 0.644s; OK`. [test log](../../experiments/f36f1e9e2bb64866b8d6c792db158635/tests.log). 테스트의 FPS/전체 sampler 반복은 합성 입력에만 적용했다.+- **PASS**: evaluated source와 현재 FPS·candidate·allocation 정의 일치, seed0 Phase1/2 reference ID 및 저장 순서 일치, seed1/2 source/feature/role alignment, 23 metadata row 및 seed 간 공통 source feature equality.+- **PASS**: 저장 분석 FPS 호출 차단, 후보 교집합 252 / initial 114957, initial XYZ exact equality, 초기 RNG draw 차단, 32 unique indices·초기점 포함·실제 후보 membership·local/global 대응·raster 순서 유지.+- **PASS**: 합성 GT annotation 변경 시 선택 불변, 기존 same-pair joint matching 및 reference 중복 제거, 저장 negative ROI union 점유 일치, 원본 artifact·입력·기존 파일 hash 불변, HTML/Markdown 상대 링크와 PNG 생성 확인.+- **FAIL**: 없음. 불일치 시 assertion·tolerance·GT·seed 규칙을 변경하지 않고 중단하도록 구현했다.+- **SKIP / 미검증**: simulator·renderer·CUDA/GPU backend, 다른 frame/episode, 추가 공통 초기점 sweep, PCL·Graph·BC·정책/학습 실험, 외부 upload·dependency 설치·commit. 현재 호스트에서는 CPU NumPy offline 진단만 실행했다.+- Git 시작/종료 및 보존한 기존 변경: [start](../../experiments/f36f1e9e2bb64866b8d6c792db158635/git_start.json), [end](../../experiments/f36f1e9e2bb64866b8d6c792db158635/git_end.json), [diff](../../experiments/f36f1e9e2bb64866b8d6c792db158635/implementation.patch). 시작 Git dirty 상태이므로 commit만으로 재현할 수 없으며 source snapshot과 hash를 함께 보존했다.++| Source / input | SHA-256 |+| --- | --- |+| `visual/runtime/geometry.py` | `36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9` |+| `visual/runtime/rgbd.py` | `be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164` |+| `visual/runtime/sampling.py` | `45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed` |+| `visual/runtime/test/run_priority_fps_seed_control.py` | `75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827` |+| `visual/runtime/test/run_priority_fps_trace.py` | `f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b` |+| `visual/runtime/test/run_rim_bottleneck.py` | `8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3` |+| `visual/runtime/test/sampling_evaluation.py` | `daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b` |+| `visual/runtime/test/test_priority_fps_seed_control.py` | `69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645` |++위 표는 실제 진단 실행 시점의 source hash다. 전체 입력/evaluated source hash와 원본 보존 기록은 아래 JSON에 있다. 그림·보고서만 저장 결과로 갱신한 경우 실제 실행 source는 `execution_source/`, 최종 source는 `diagnostic_source/` 및 `source_hashes.json`의 `report_generation_sources`로 구분한다. FPS 결과는 재실행하지 않는다.++## 산출물++- [priority_fps_seed_control.html](../../experiments/f36f1e9e2bb64866b8d6c792db158635/priority_fps_seed_control.html)+- [priority_fps_seed_control.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/priority_fps_seed_control.json)+- [seed_initial_points.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/seed_initial_points.png)+- [seed_priority_final_coverage.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/seed_priority_final_coverage.png)+- [shared_initial_overlay.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/shared_initial_overlay.png)+- [shared_initial_coverage.png](../../experiments/f36f1e9e2bb64866b8d6c792db158635/shared_initial_coverage.png)+- [source_hashes.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/source_hashes.json)+- [verification.json](../../experiments/f36f1e9e2bb64866b8d6c792db158635/verification.json)+- [tests.log](../../experiments/f36f1e9e2bb64866b8d6c792db158635/tests.log)+- [implementation.patch](../../experiments/f36f1e9e2bb64866b8d6c792db158635/implementation.patch)++**Phase 3 결과 제출 후 중단한다. 후속 변경은 별도 승인 후 진행한다.**123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248"""Evaluation-only GT matching and surface/false-selection metrics for Task03."""from dataclasses import replaceimport numpy as npfrom scipy.spatial import cKDTreefrom scipy.sparse import csr_matrixfrom scipy.ndimage import labelfrom visual.runtime.test.normal_diagnostics import stats, dilate, endpoints, erodefrom visual.runtime.test.run_normal_comparison import real_truthfrom visual.runtime.test.run_structural_edges import raster_reference, rim_reference, negative_regionsfrom visual.runtime.rgbd import PEG, BOX
TOLERANCES = ((1., .002), (2., .003), (3., .005))
class CoverageMatcher: """Same-pair joint 2D/3D matching. No reference-dependent sampling inputs.
Distances are unfiltered by a GT corridor. Missing selected points yield zero hits; distances then stay undefined and missing_reference_distances is explicit. Sampling retention denominator is only tracker-recoverable refs. """ def __init__(self, geometry, oid, reference, tolerances=TOLERANCES): self.flat = np.flatnonzero(geometry.observed_mask(oid)) self.uv = np.column_stack(np.unravel_index(self.flat, geometry.valid_depth.shape))[:, ::-1] self.xyz = geometry.xyz.reshape(-1, 3)[self.flat] self.ref_uv, self.ref_xyz = reference self.nref = len(self.ref_uv) self.tolerances = tolerances self.adjacencies = {} if len(self.flat) and self.nref: self.to_gt_px = cKDTree(self.ref_uv).query(self.uv)[0] self.to_gt_mm = cKDTree(self.ref_xyz).query(self.xyz)[0]*1000 else: self.to_gt_px = np.full(len(self.flat), np.nan) self.to_gt_mm = self.to_gt_px.copy() for px, m in tolerances: if len(self.flat) and self.nref: matrix = cKDTree(self.uv).sparse_distance_matrix(cKDTree(self.ref_uv), px, output_type='coo_matrix') good = np.linalg.norm(self.xyz[matrix.row]-self.ref_xyz[matrix.col], axis=1) <= m adj = csr_matrix((np.ones(good.sum(), bool), (matrix.row[good], matrix.col[good])), shape=(len(self.flat), self.nref)) else: adj = csr_matrix((len(self.flat), self.nref), dtype=bool) self.adjacencies[self.key(px,m)] = adj
@staticmethod def key(px,m): return f'{px:g}px_{m*1000:g}mm'
def reference_hits(self, selected_flat, px=2., m=.003): """Reference IDs and matched source nodes from the existing joint adjacency.
IDs are row positions in the saved reference arrays, not rounded pixels. A node can cover multiple IDs; multiple nodes covering one ID count once. """ selected_flat = np.asarray(selected_flat) if selected_flat.ndim != 1 or selected_flat.dtype.kind not in 'iu': raise ValueError('source indices must be a one-dimensional integer array') if len(np.unique(selected_flat)) != len(selected_flat): raise ValueError('duplicate source nodes') rows = np.searchsorted(self.flat, selected_flat) if len(rows) and ((rows >= len(self.flat)).any() or not np.array_equal(self.flat[rows], selected_flat)): raise ValueError('evaluation points outside observed support') adjacency = self.adjacencies[self.key(px, m)][rows] return (np.flatnonzero(adjacency.getnnz(axis=0)), selected_flat[adjacency.getnnz(axis=1) > 0])
def score(self, selected_flat): rows = np.searchsorted(self.flat, selected_flat) if len(rows) and ((rows >= len(self.flat)).any() or not np.array_equal(self.flat[rows], selected_flat)): raise ValueError('evaluation points outside observed support') out = dict(selected=len(rows), gt_visible=self.nref, tolerance={}) arrays = dict(sample_to_gt_px=self.to_gt_px[rows], sample_to_gt_mm=self.to_gt_mm[rows]) if len(rows) and self.nref: arrays['gt_to_sample_px'] = cKDTree(self.uv[rows]).query(self.ref_uv)[0] arrays['gt_to_sample_mm'] = cKDTree(self.xyz[rows]).query(self.ref_xyz)[0]*1000 else: arrays['gt_to_sample_px'] = np.empty(0); arrays['gt_to_sample_mm'] = np.empty(0) out['missing_reference_distances'] = self.nref if not len(rows) else 0 for key, adjacency in self.adjacencies.items(): observable = adjacency.getnnz(axis=0) > 0 covered = adjacency[rows].getnnz(axis=0) > 0 matched = adjacency[rows].getnnz(axis=1) > 0 row = dict(gt_visible=self.nref, tracker_observed=int(observable.sum()), sampled=int(covered.sum()), selected=len(rows), selected_near_gt=int(matched.sum())) # Every visible reference remains in the denominator, including tracker losses. row.update(gt_coverage=row['sampled']/self.nref if self.nref else None, tracker_coverage=row['tracker_observed']/self.nref if self.nref else None, sampling_retention=row['sampled']/row['tracker_observed'] if row['tracker_observed'] else None) # Spatial distribution of preservation, fixed image-axis halves of visible references. if self.nref: mid = np.median(self.ref_uv, axis=0) quadrants = (self.ref_uv[:,0] >= mid[0]).astype(int)+2*(self.ref_uv[:,1] >= mid[1]).astype(int) row['reference_quadrants'] = [dict(gt_visible=int((quadrants==q).sum()), tracker_observed=int((observable & (quadrants==q)).sum()), sampled=int((covered & (quadrants==q)).sum())) for q in range(4)] else: row['reference_quadrants'] = [] out['tolerance'][key] = row out['distances'] = {k:stats(v) for k,v in arrays.items()} return out, arrays
def count_ratio(numerator, denominator): """Preserve raw counts, including undefined zero-denominator fractions.""" return dict(numerator=int(numerator), denominator=int(denominator), value=numerator/denominator if denominator else None)
def staged_reference_coverage(matcher, candidates, priority, surface, final): """Saved-set diagnosis only; no candidate extraction or selection is run.
C/P are None for the General FPS control, rather than empty candidate sets. Set differences overlap and must not be summed as causal loss fractions. """ if (candidates is None) != (priority is None): raise ValueError('candidate and priority applicability must agree') nodes = dict(X=matcher.flat, C=candidates, P=priority, S=surface, F=final) hits, stages = {}, {} for name, flat in nodes.items(): if flat is None: hits[name] = None stages[name] = None continue ids, matched = matcher.reference_hits(flat) hits[name] = set(ids.tolist()) stages[name] = dict(node_count=len(flat), matched_node_count=len(matched), unique_reference_count=len(ids)) p = np.asarray(priority if priority is not None else [], dtype=np.int64) if np.intersect1d(p, surface).size or set(final) != set(p) | set(surface): raise ValueError('final nodes must be the disjoint priority/surface union') if candidates is not None and not set(p) <= set(candidates): raise ValueError('priority nodes outside candidate support') v, o = set(range(matcher.nref)), hits['X'] c, p, s, f = hits['C'], hits['P'], hits['S'], hits['F'] if not f <= o or (c is not None and not c <= o): raise AssertionError('covered references outside observable references') if f != (p or set()) | s: raise AssertionError('final reference union differs from priority/surface') differences = {'V_minus_O': v-o, 'O_minus_F': o-f} if c is not None: differences.update(O_minus_C=o-c, C_minus_P=c-p, C_minus_F=c-f, P_intersect_S=p&s, S_minus_P=s-p, S_minus_C=s-c, C_minus_P_intersect_S=(c-p)&s) else: differences.update({key: None for key in ('O_minus_C', 'C_minus_P', 'C_minus_F', 'P_intersect_S', 'S_minus_P', 'S_minus_C', 'C_minus_P_intersect_S')}) coverage = dict(observation=count_ratio(len(o), len(v))) for name, key in [('C', 'candidate'), ('P', 'priority'), ('S', 'surface'), ('F', 'final_retention')]: coverage[key] = count_ratio(len(hits[name]), len(o)) if hits[name] is not None else None return dict(stages=stages, coverage=coverage, gt_final_coverage=count_ratio(len(f), len(v)), reference_ids={k: sorted(ids) if ids is not None else None for k, ids in dict(V=v, O=o, **hits).items()}, differences={k: dict(count=len(ids), reference_ids=sorted(ids)) if ids is not None else None for k, ids in differences.items()})
def evaluation_context(frame, evidence, gt, camera, robot_ids): """Reuse unchanged Task02 visible seam/rim definition; GT read after extraction.""" truths, regions, maps = real_truth(frame, evidence.frame, gt, camera) refs, matchers, negatives, surfaces = {}, {}, {}, {} for name, oid in [('peg',PEG), ('box',BOX)]: t = truths[name]; r = regions[name] robot = np.isin(gt[f'{camera}/seg'][frame.source_frame],robot_ids) & np.isfinite(t['depth']) & evidence.frame.geometry.valid_depth & (frame.depth < t['depth']-.0015) r['robot_occlusion_2px'] = dilate(endpoints(r['gt_visible'],robot),2) & r['gt_visible'] if name == 'box': r['plane_interior'] = np.logical_or.reduce([erode(r['gt_visible'] & (t['face']==f),3) for f in range(6)]) & ~dilate(r['hole_rim'],4) reference = raster_reference(maps[name]['seam'],t,frame.intrinsic) if name=='peg' else rim_reference(frame,gt,t,r['hole_rim']) refs[name] = reference matchers[name] = CoverageMatcher(evidence.frame.geometry,oid,reference) # Include other physical box seams when excluding negatives, exactly as Task02-C. other = raster_reference(maps[name]['seam'], t, frame.intrinsic) all_ref = tuple(np.concatenate([reference[i], other[i]]) for i in (0,1)) negatives[name] = negative_regions(r, maps[name], all_ref, frame.depth.shape) support = evidence.frame.geometry.observed_mask(oid) flat = np.flatnonzero(support) components, count = label(support) comp = components.ravel()[flat] sizes = np.bincount(comp, minlength=count+1) surfaces[name] = dict(flat=flat, xyz=evidence.frame.geometry.xyz.reshape(-1,3)[flat], plane=r['plane_interior'].ravel()[flat], face=t['face'].ravel()[flat], small_component=(sizes[comp] <= 64), component_count=count) return dict(truths=truths, regions=regions, maps=maps, references=refs, matchers=matchers, negatives=negatives, surfaces=surfaces)
def score_selection(result, context): row, arrays = dict(objects={}), {} for name, oid in [('peg',PEG),('box',BOX)]: choose = result.object_id==oid flat = result.flat_index[choose] structural, dist = context['matchers'][name].score(flat) arrays.update({name+'/'+k:v for k,v in dist.items()}) surface = context['surfaces'][name] nearest = cKDTree(result.points[choose]).query(surface['xyz'])[0]*1000 if choose.any() else np.empty(0) surface_dist = {'all':nearest} if len(nearest): surface_dist.update(plane=nearest[surface['plane']],small_components=nearest[surface['small_component']]) surface_dist.update({f'face_{f}':nearest[surface['face']==f] for f in range(6)}) surface_metrics = {k:dict(distance_mm=stats(v), within_3mm=int((v<=3).sum()), points=len(v)) for k,v in surface_dist.items()} surface_metrics['component_count'] = surface['component_count'] arrays.update({name+'/surface_'+k:v for k,v in surface_dist.items()}) priority = result.priority_selected[choose] negative = {} for k, mask in context['negatives'][name].items(): hit = mask.ravel()[flat] negative[k] = dict(observed=int(mask.ravel()[surface['flat']].sum()), selected=int(hit.sum()), priority=int((hit&priority).sum()), depth_priority=int((hit&result.depth_priority_selected[choose]).sum())) # Union is evaluated once; region counts deliberately overlap. false_union = np.logical_or.reduce(list(context['negatives'][name].values())) hit = false_union.ravel()[flat] negative['known_negative_union'] = dict(observed=int(false_union.ravel()[surface['flat']].sum()), selected=int(hit.sum()), priority=int((hit&priority).sum()), depth_priority=int((hit&result.depth_priority_selected[choose]).sum())) row['objects'][name] = dict(structural=structural,surface=surface_metrics,negative=negative,counts=result.counts[oid]) row['timings_ms'] = result.timings_ms return row, arrays
def summarize(rows, arrays): """Micro counts plus per-frame coverage distributions; no independent-frame CI.""" result = dict(frames=len(rows),objects={}) for name in ('peg','box'): objects = [r['objects'][name] for r in rows] counts = {k:sum(o['counts'][k] for o in objects) for k in objects[0]['counts']} structural = {} for tol in objects[0]['structural']['tolerance']: original = [o['structural']['tolerance'][tol] for o in objects] summed = {k:sum(o[k] for o in original) for k in ('gt_visible','tracker_observed','sampled','selected','selected_near_gt')} n,obs,sel = summed['gt_visible'],summed['tracker_observed'],summed['sampled'] summed.update(gt_coverage=sel/n if n else None,tracker_coverage=obs/n if n else None, sampling_retention=sel/obs if obs else None, frame_gt_coverage=stats([v['gt_coverage'] for v in original if v['gt_coverage'] is not None]), frame_sampling_retention=stats([v['sampling_retention'] for v in original if v['sampling_retention'] is not None])) structural[tol] = summed negatives = {k:{c:sum(o['negative'][k][c] for o in objects) for c in objects[0]['negative'][k]} for k in objects[0]['negative']} for v in negatives.values(): v['fraction_of_priority'] = v['priority']/counts['priority'] if counts['priority'] else None v['fraction_of_selected_budget'] = v['priority']/counts['selected'] if counts['selected'] else None distance = {k:stats(np.concatenate(v)) for k,v in arrays.items() if k.startswith(name+'/')} surfaces = {} for key in objects[0]['surface']: if key=='component_count': continue valid = [o['surface'][key] for o in objects if key in o['surface']] n=sum(v['points'] for v in valid); hit=sum(v['within_3mm'] for v in valid) surfaces[key] = dict(points=n,within_3mm=hit,coverage_3mm=hit/n if n else None, distance_mm=distance.get(name+'/surface_'+key)) result['objects'][name] = dict(counts=counts,structural=structural,surface=surfaces,negative=negatives, distances=distance,missing_reference_distances=sum(o['structural']['missing_reference_distances'] for o in objects)) result['timings_ms'] = {k:stats([r['timings_ms'][k] for r in rows]) for k in rows[0]['timings_ms']} return result123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611"""Task03-D Phase 3: saved Priority evaluation and one shared-initial FPS pair.
WANDB_MODE=disabled .venv/bin/python -m visual.runtime.test.run_priority_fps_seed_control \ --baseline /path/to/baseline.json
Only the two control selections call FPS on real data. No full sampler, feature,normal or candidate extraction runs. GT annotations enter control scoring onlywhen both selections are complete. Tests repeat FPS only on synthetic inputs."""from __future__ import annotations
import argparsefrom contextlib import ExitStackimport htmlimport jsonimport osfrom pathlib import Pathimport platformimport reimport shutilimport subprocessimport sysfrom unittest.mock import patch
import matplotlibmatplotlib.use('Agg')import matplotlib.pyplot as pltimport numpy as np
from utils.experiment_artifacts import digestsfrom utils.experiment_logger import ExperimentLoggerfrom visual.runtime.rgbd import BOX, PEGfrom visual.runtime.sampling import fps_indicesfrom visual.runtime.test.run_priority_fps_trace import ( REPO, METHODS, _frame_and_context, fps_seed, verify_fps_source,)from visual.runtime.test.run_rim_bottleneck import ( SOURCE_RUN, compare_ids, depth_summary, geometry_evidence, require_equal, source_contract, validate_saved_selection, write_json,)from visual.runtime.test.sampling_evaluation import CoverageMatcher, evaluation_context
PHASE1 = 'd3f14ee494894daabb8ba2fab8e1b00c'PHASE2 = 'aa5d71078e0841fd886b5026d6030ebc'REPORT = REPO/'docs/visual-graph-integration/03d_priority_fps_seed_control_phase3.md'FINAL = {'S2': [16, 10, 10], 'S3': [3, 5, 3]}FIRST = {'S2': [101598, 119061, 112919], 'S3': [96553, 117010, 102621]}COUNT = 32TEST_MODULES = [f'visual.runtime.test.{name}' for name in ( 'test_priority_fps_seed_control', 'test_priority_fps_trace', 'test_sampling', 'test_sampling_geometry', 'test_sampling_evaluation')]
def hashes(paths): return {str(p.relative_to(REPO)): digests(p)[1] for p in sorted(set(paths))}
def verify_preserved(baseline): actual = hashes([REPO/p for p in baseline['hashes']]) require_equal(actual, baseline['hashes'], 'pre-existing workspace/artifact hashes') return {'status': 'PASS', 'protected_file_count': len(actual), 'all_sha256_unchanged': True}
def forbid_sampling(): """Scoped tripwires, including both the imported FPS alias and its source.""" stack = ExitStack() for target in ('visual.runtime.sampling.fps_indices', __name__+'.fps_indices', 'visual.runtime.sampling.sample_points', 'visual.runtime.sampling.extract_sampling_evidence', 'visual.runtime.sampling.extract_candidates'): stack.enter_context(patch(target, side_effect=AssertionError('forbidden in saved analysis: '+target))) return stack
def load_saved(archive, config, metrics, frame, geometry, phase2): """Read/validate saved arrays; never regenerate features, candidates or FPS.""" candidates, selections, checks = {}, {}, {} for method, (estimator, _, n_candidates, _, _) in METHODS.items(): candidate = np.asarray(archive[f'evidence/{estimator}/1/20/orientation_flat']) if candidate.ndim != 1 or candidate.dtype.kind not in 'iu': raise ValueError('candidate flat indices must be one-dimensional integers') require_equal(len(candidate), n_candidates, method+' candidate count') if not np.all(candidate[:-1] < candidate[1:]): raise ValueError('candidate raster order changed') if not geometry.observed_mask(BOX).ravel()[candidate].all(): raise ValueError('candidate outside observed Box') np.testing.assert_array_equal(candidate, phase2['methods'][method]['candidate_flat_indices']) candidates[method] = dict(flat=candidate.copy(), points=geometry.xyz.reshape(-1, 3)[candidate].copy()) selections[method] = {} previous = [] for seed in (0, 1, 2): key = f'{method}_n256_r0.25_t20_s{seed}' expected = dict(method=method, num_points=256, structural_ratio=.25, orientation_threshold_deg=20, seed=seed) require_equal(config['conditions'][key], expected, key+' condition') alignment = validate_saved_selection(archive, key, frame, geometry) flat, ids = archive[key+'/flat_index'], archive[key+'/object_id'] priority = archive[key+'/priority_selected'] require_equal(len(flat), 256, key+' total nodes') for oid, name, budget in ((PEG, 'peg', 129), (BOX, 'box', 127)): choose = ids == oid require_equal(int(choose.sum()), budget, key+' '+name+' budget') np.testing.assert_array_equal(priority[choose], np.arange(budget) < COUNT) counts = metrics[key]['objects'][name]['counts'] for field, value in dict(budget=budget, selected=budget, priority=COUNT, orientation_priority=COUNT, depth_priority=0, surface_fps=budget-COUNT).items(): require_equal(counts[field], value, key+' '+name+' '+field) names = sorted(k for k in archive.files if k.startswith(key+'/metadata/')) require_equal(len(names), 23, key+' metadata fields') features = {k.split('/metadata/')[1]: archive[k] for k in names} if any(len(v) != len(flat) for v in features.values()): raise ValueError('feature row alignment mismatch') box = ids == BOX np.testing.assert_array_equal(features['orientation_candidate'][box], np.isin(flat[box], candidate)) np.testing.assert_array_equal(features['structural_candidate'][box], np.isin(flat[box], candidate)) if not features['orientation_candidate'][box & priority].all() or features['depth_only_candidate'][box & priority].any(): raise ValueError('Priority orientation/depth role mismatch') if not (features['object_mask'].all() and features['valid_points'].all()): raise ValueError('saved metadata support mismatch') # Source-keyed equality of every saved feature wherever seeds overlap. overlap_counts = [] for old_flat, old_features in previous: shared, a, b = np.intersect1d(flat, old_flat, return_indices=True) for name, value in features.items(): np.testing.assert_array_equal(value[a], old_features[name][b], err_msg=key+'/'+name) overlap_counts.append(len(shared)) previous.append((flat.copy(), features)) selected = flat[box & priority] require_equal(len(selected), COUNT, key+' Priority count') require_equal(int(selected[0]), FIRST[method][seed], key+' first flat') positions = np.searchsorted(candidate, selected) if (positions >= len(candidate)).any(): raise ValueError('saved Priority outside candidates') np.testing.assert_array_equal(candidate[positions], selected) np.testing.assert_array_equal(candidates[method]['points'][positions], archive[key+'/points'][box & priority]) final = metrics[key]['objects']['box']['structural']['tolerance']['2px_3mm'] require_equal(final['gt_visible'], 103, key+' final denominator') require_equal(final['sampled'], FINAL[method][seed], key+' stored Final coverage') require_equal(final['gt_coverage'], FINAL[method][seed]/103, key+' stored Final fraction') selections[method][seed] = dict(flat=selected.copy(), local=positions, xyz=archive[key+'/points'][box & priority].copy(), final=dict(final)) checks[key] = dict(**alignment, saved_feature_fields=23, source_keyed_feature_overlap_counts=overlap_counts, feature_and_role_alignment=True, candidate_local_global_exact=True, priority_is_saved_prefix=True, saved_final_coverage_unchanged=True) return candidates, selections, checks
def point_summary(flat, frame, negatives, reference_ids, matching_flat, xyz): flat = np.asarray(flat, np.int64) masks = dict(negatives) masks['known_negative_union'] = np.logical_or.reduce(list(negatives.values())) occupancy = {name: dict(count=int(mask.ravel()[flat].sum()), denominator=len(flat), fraction=float(mask.ravel()[flat].mean())) for name, mask in masks.items()} ids = list(map(int, reference_ids)) if ids != sorted(set(ids)): raise ValueError('reference IDs must be sorted and deduplicated') return dict(node_count=len(flat), selected_flat_indices=flat.tolist(), selected_xyz_m=np.asarray(xyz).tolist(), initial_flat_index=int(flat[0]), initial_xyz_m=np.asarray(xyz)[0].tolist(), rim_matching_node_count=len(matching_flat), rim_matching_flat_indices=list(map(int, matching_flat)), priority_reference_ids=ids, priority_reference_count=len(ids), priority_coverage=dict(numerator=len(ids), denominator=103, value=len(ids)/103), priority_depth_m=depth_summary(frame.depth.ravel()[flat]), negative_roi=occupancy)
def summarize_saved(selections, phase1, phase2, matcher, frame, negatives): """Seed 0 IDs/hits come ONLY from Phase2; only seed 1/2 call the matcher.""" results = {} for method in METHODS: results[method] = {} for seed, row in selections[method].items(): flat, xyz = row['flat'], row['xyz'] if seed == 0: original = phase2['methods'][method] np.testing.assert_array_equal(flat, original['stored_priority_flat_indices']) np.testing.assert_array_equal(xyz, [t['xyz_m'] for t in original['trace']]) np.testing.assert_array_equal(frame.depth.ravel()[flat], [t['depth_m'] for t in original['trace']]) ref_ids = original['priority_reference_ids'] require_equal(ref_ids, phase1['frames'][0]['conditions'][method]['reference_ids']['P'], method+' seed0 Phase1/2 IDs') require_equal(sorted({i for t in original['trace'] for i in t['matched_rim_reference_ids']}), ref_ids, method+' seed0 trace reference union') require_equal(len(ref_ids), original['priority_reference_count'], method+' seed0 coverage') hits = [t['flat_index'] for t in original['trace'] if t['rim_reference_matched']] origin = 'Phase2 reused; seed0 matcher not called' else: ref_ids, hits = matcher.reference_hits(flat, px=2., m=.003) origin = 'saved Priority evaluated by existing CoverageMatcher' result = point_summary(flat, frame, negatives, ref_ids, hits, xyz) if seed == 0: for name in result['negative_roi']: require_equal(result['negative_roi'][name]['count'], sum(t['selected_negative_roi'][name] for t in original['trace']), method+' seed0 ROI '+name) if result['priority_reference_count'] > row['final']['sampled']: raise ValueError('Priority coverage exceeds stored Final coverage') result.update(seed=seed, stage='B_saved_priority', priority_result_origin=origin, final_sampling=dict(stage='A_saved_final', source='Task03 f0000_metrics.json', numerator=row['final']['sampled'], denominator=103, value=row['final']['gt_coverage'])) results[method][str(seed)] = result return results
def select_control(candidates, *, expected_shared=252, expected_initial=114957): """GT-free selection boundary. Preserve candidate raster order and XYZ.""" require_equal(set(candidates), {'S2', 'S3'}, 'control methods') for method, row in candidates.items(): flat, xyz = row['flat'], row['points'] if flat.ndim != 1 or flat.dtype.kind not in 'iu' or not np.all(flat[:-1] < flat[1:]): raise ValueError('control candidates must keep ascending raster order') if xyz.shape != (len(flat), 3) or not np.isfinite(xyz).all() or len(flat) < COUNT: raise ValueError('invalid control candidate XYZ/count') shared = sorted(set(candidates['S2']['flat']) & set(candidates['S3']['flat'])) require_equal(len(shared), expected_shared, 'candidate intersection') initial = int(shared[len(shared)//2]) require_equal(initial, expected_initial, 'deterministic shared initial') local = {m: int(np.searchsorted(c['flat'], initial)) for m, c in candidates.items()} xyz = {m: c['points'][local[m]] for m, c in candidates.items()} np.testing.assert_array_equal(xyz['S2'], xyz['S3']) orders = {} # No RNG factory or integer draw may occur in the real initial path. with patch('visual.runtime.sampling.np.random.default_rng', side_effect=AssertionError('initial control must not consume RNG')): for method, candidate in candidates.items(): order = fps_indices(candidate['points'], COUNT, seed=fps_seed(0, BOX), initial=[local[method]]) if len(order) != COUNT or len(np.unique(order)) != COUNT or ((order < 0) | (order >= len(candidate['flat']))).any(): raise ValueError('control requires 32 unique candidate rows') require_equal(int(order[0]), local[method], method+' initial included') selected = candidate['flat'][order] require_equal(len(np.unique(selected)), COUNT, method+' unique source nodes') np.testing.assert_array_equal(np.searchsorted(candidate['flat'], selected), order) orders[method] = dict(flat=selected.copy(), xyz=candidate['points'][order].copy(), local=order.copy()) return orders, dict(rule='sorted(set(C_S2) & set(C_S3))[len(shared)//2]', shared_count=len(shared), shared_flat_indices=list(map(int, shared)), initial_flat_index=initial, initial_xyz_m=xyz['S2'].tolist(), candidate_local_index=local, exact_initial_xyz_equal=True, initial_rng_draws=0, real_fps_calls={'S2': 1, 'S3': 1}, total_nodes_including_initial=COUNT, gt_selection_input=False)
def score_control(orders, matcher, frame, negatives): results = {} for method, row in orders.items(): ids, hits = matcher.reference_hits(row['flat'], px=2., m=.003) results[method] = dict(stage='C_shared_initial_priority', selected_candidate_local_indices=row['local'].tolist(), **point_summary(row['flat'], frame, negatives, ids, hits, row['xyz'])) return results
def create_plots(output, frame, saved, control, refs): colors = {'S2': '#1976b9', 'S3': '#df6d16'} fig, ax = plt.subplots(figsize=(9, 7), constrained_layout=True) ax.imshow(frame.rgb) initial_vu = [] offsets = {'S2': [(8, 18), (8, -18), (-65, -15)], 'S3': [(-65, -18), (-65, 12), (8, -14)]} for method, rows in saved.items(): for seed, row in rows.items(): v, u = divmod(row['initial_flat_index'], frame.depth.shape[1]) initial_vu.append((v, u)) ax.scatter(u, v, s=90, color=colors[method], marker=['o', 's', '^'][int(seed)], edgecolors='white') ax.annotate(f'{method} seed {seed}', (u, v), xytext=offsets[method][int(seed)], textcoords='offset points', arrowprops=dict(arrowstyle='-', color=colors[method], lw=.6), color=colors[method], fontsize=9, bbox=dict(facecolor='white', alpha=.85, pad=1)) initial_vu = np.asarray(initial_vu) ax.set(title='Saved seed 0/1/2: first Box Priority point', xlim=(initial_vu[:, 1].min()-25, initial_vu[:, 1].max()+25), ylim=(initial_vu[:, 0].max()+20, initial_vu[:, 0].min()-20), xlabel='u (px)', ylabel='v (px)') fig.savefig(output/'seed_initial_points.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(12, 4), sharey=True, constrained_layout=True) for ax, method in zip(axes, METHODS): x = np.arange(3); rows = list(saved[method].values()) for dx, field, label, color in [(-.18, 'priority_reference_count', 'B: saved Priority (32)', colors[method]), (.18, 'final_sampling', 'A: stored Final (127 Box)', '#999999')]: values = [r[field] if field != 'final_sampling' else r[field]['numerator'] for r in rows] bars = ax.bar(x+dx, values, .34, label=label, color=color) ax.bar_label(bars, labels=[f'{n}/103' for n in values], fontsize=9) ax.set(title=method, xticks=x, xticklabels=['seed 0', 'seed 1', 'seed 2'], ylim=(0, 20), ylabel='Unique GT rim reference IDs (of 103)') ax.legend(fontsize=8); ax.grid(axis='y', alpha=.2) fig.savefig(output/'seed_priority_final_coverage.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(14, 6), constrained_layout=True) all_vu = np.column_stack(np.unravel_index( [flat for row in control.values() for flat in row['selected_flat_indices']], frame.depth.shape)) xlim = (min(all_vu[:, 1].min(), refs[:, 0].min())-14, max(all_vu[:, 1].max(), refs[:, 0].max())+14) ylim = (max(all_vu[:, 0].max(), refs[:, 1].max())+14, min(all_vu[:, 0].min(), refs[:, 1].min())-14) for ax, method in zip(axes, METHODS): row = control[method]; vu = np.column_stack(np.unravel_index(row['selected_flat_indices'], frame.depth.shape)) ax.imshow(frame.rgb) ax.scatter(refs[:, 0], refs[:, 1], marker='+', s=18, color='#e226bd', label='GT rim: evaluation only') ax.scatter(vu[:, 1], vu[:, 0], s=50, edgecolors='white', linewidths=.6, color=colors[method], label='32 Priority selections') ax.scatter(vu[0, 1], vu[0, 0], s=180, color='#ffe243', edgecolors='black', marker='*', label='shared initial') ax.set(title=f"{method}: C Priority {row['priority_reference_count']}/103", xlim=xlim, ylim=ylim, xlabel='u (px)', ylabel='v (px)') ax.legend(fontsize=8, loc='upper right') fig.savefig(output/'shared_initial_overlay.png', dpi=160); plt.close(fig) fig, axes = plt.subplots(1, 2, figsize=(12, 4), constrained_layout=True) values = [control[m]['priority_reference_count'] for m in METHODS] bars = axes[0].bar(list(METHODS), values, color=list(colors.values())) axes[0].bar_label(bars, labels=[f'{n}/103 ({100*n/103:.2f}%)' for n in values]) axes[0].set(title='C: same initial point, 32 Priority nodes', ylabel='Unique GT rim references', ylim=(0, max(values)+5)) axes[1].scatter(refs[:, 0], refs[:, 1], color='#cccccc', s=24, label='103 GT refs: evaluation only') for method in METHODS: selected = refs[control[method]['priority_reference_ids']] axes[1].scatter(selected[:, 0], selected[:, 1], color=colors[method], marker='o' if method == 'S2' else 'x', s=50, label=method+' covered refs') axes[1].invert_yaxis(); axes[1].set_aspect('equal'); axes[1].legend(fontsize=8) axes[1].set(title='Unique reference coverage after control FPS', xlabel='u (px)', ylabel='v (px)') fig.savefig(output/'shared_initial_coverage.png', dpi=160); plt.close(fig)
def create_html(output, result, source): def link(path, label): return f'<a href="{html.escape(os.path.relpath(path, output))}">{html.escape(label)}</a>' links = ' | '.join(link(output/name, name) for name in ( 'priority_fps_seed_control.json', 'source_hashes.json', 'verification.json', 'tests.log', 'implementation.patch', 'git_start.json', 'git_end.json', 'report_snapshot.md')) originals = ' | '.join(link(path, label) for path, label in ( (source/'f0000_samples.npz', 'Task03 samples NPZ'), (source/'f0000_metrics.json', 'Task03 frame metrics'), (source/'comparison.json', 'Task03 config'), (REPO/'experiments'/PHASE1/'diagnostic.json', 'Phase1 JSON'), (REPO/'experiments'/PHASE2/'priority_fps_trace.json', 'Phase2 JSON'), (REPORT, 'Markdown report'))) rows = ''.join(f"<tr><td>{m}</td><td>{s}</td><td>{r['initial_flat_index']}</td><td>{r['initial_xyz_m']}</td>" f"<td>{r['priority_reference_count']}/103</td><td>{r['final_sampling']['numerator']}/103</td></tr>" for m, seeds in result['saved'].items() for s, r in seeds.items()) control_rows = ''.join(f"<tr><td>{m}</td><td>{r['node_count']}</td><td>{r['rim_matching_node_count']}</td>" f"<td>{r['priority_reference_count']}/103</td><td>{r['priority_reference_ids']}</td></tr>" for m, r in result['control'].items()) body = f'''<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Task03-D Phase 3 — FPS initial control</title><style>body{{font:16px system-ui;max-width:1200px;margin:2rem auto;padding:0 1rem}}img{{max-width:100%;height:auto}}table{{border-collapse:collapse;width:100%}}td,th{{padding:.5rem;border:1px solid #bbb;text-align:left;overflow-wrap:anywhere}}.scroll{{overflow-x:auto}}</style><h1>Task03-D Phase 3 — FPS initialization vs candidate distribution</h1><p>Run {result['run_id']}. Frame 0 Box; FD2/PCA5; n=256, ratio=.25, threshold=20°, Box budget=127, Priority quota=32. Same-pair 2px AND 3mm matching; 103 GT rim line references.</p><p>GT rim marks and negative ROIs are evaluation only. Neither GT nor ROI enters initial-point choice or FPS. Only one shared initial point was tested; no new sampling policy was adopted.</p><p>{links}</p><p>Original read-only results: {originals}</p><h2>Saved seeds: A Final and B Priority are separate stages</h2><p>A is stored final sampling (127 Box nodes in 256 total); B is the saved 32-node Priority subset. Seed 0 B reuses Phase2; seed 1/2 B use the existing matcher, without FPS replay.</p><div class="scroll"><table><tr><th>Method</th><th>Seed</th><th>First flat</th><th>First XYZ (m)</th><th>B Priority</th><th>A Final</th></tr>{rows}</table></div><h2>First selected points</h2><a href="seed_initial_points.png"><img src="seed_initial_points.png" alt="First saved Priority point of each seed"></a><h2>Saved coverage by stage</h2><a href="seed_priority_final_coverage.png"><img src="seed_priority_final_coverage.png" alt="Separate bars for B Priority and A Final coverage"></a><h2>C: common initial point control</h2><p>Shared intersection: {result['initial_control']['shared_count']}; initial flat {result['initial_control']['initial_flat_index']}; XYZ {result['initial_control']['initial_xyz_m']}. Each method executes one existing FPS call, including the initial point in 32 unique nodes. C is Priority only; A and C are different sampling stages.</p><table><tr><th>Method</th><th>Nodes</th><th>Rim matching nodes</th><th>C Priority</th><th>Unique reference IDs</th></tr>{control_rows}</table><a href="shared_initial_overlay.png"><img src="shared_initial_overlay.png" alt="S2 and S3 2D Priority locations with the same initial point"></a><a href="shared_initial_coverage.png"><img src="shared_initial_coverage.png" alt="Control Priority coverage and unique rim reference positions"></a><p>{html.escape(result['interpretation'])}</p><p>CPU NumPy offline analysis only. Simulator, renderer, CUDA, other frames/episodes and initialization sweeps were not executed.</p></html>''' (output/'priority_fps_seed_control.html').write_text(body, encoding='utf-8')
def create_markdown(output, result, test_summary): rel = lambda path: os.path.relpath(path, REPORT.parent) saved, control = result['saved'], result['control'] lines = [ '# Task 03-D Phase 3 — FPS Initialization vs Candidate Distribution', '', '**상태: 완료 / 승인 범위 종료.**', '', result['interpretation_ko'], '', '## 실행 조건과 재사용 artifact', '', f"- 새 run: `{result['run_id']}`. 기존 ExperimentLogger / artifact manifest·sidecar 계약 재사용, `WANDB_MODE=disabled` 로컬 기록.", '- Frame 0, Box, S2(FD2) / S3(PCA5), num_points=256, structural_ratio=.25, threshold=20°, Box budget=127, Priority quota=32.', '- 동일 GT rim line reference 103개. 동일 point/reference pair에서 `2px AND 3mm`, reference ID 중복 제거. GT rim/negative ROI는 평가 전용이다.', f'- [Task03 samples]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_samples.npz")}), [frame metrics]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"f0000_metrics.json")}), [config]({rel(REPO/"visual/results/sampling"/SOURCE_RUN/"comparison.json")}) (`{SOURCE_RUN}`).', f'- [Phase1 JSON]({rel(REPO/"experiments"/PHASE1/"diagnostic.json")}) (`{PHASE1}`), [Phase2 JSON]({rel(REPO/"experiments"/PHASE2/"priority_fps_trace.json")}) (`{PHASE2}`). Seed 0 Priority ID/coverage 및 matched node는 Phase2를 그대로 사용하고 Phase1과 대조했다.', '- 저장 결과 분석은 FPS·candidate·normal·feature를 재실행하지 않았다. Source geometry와 기존 matcher/ROI만 재사용했다. Final coverage는 저장 metrics 값을 그대로 보존했다.', '', '## A. 저장된 Final / B. 저장된 Priority', '', '| 방법 | Seed | 첫 flat | 첫 XYZ (m) | B rim node /32 | B Priority refs /103 | A Final refs /103 | Negative union /32 |', '| --- | ---: | ---: | --- | ---: | ---: | ---: | ---: |'] for method, seeds in saved.items(): for seed, row in seeds.items(): xyz = ', '.join(f'{v:.9g}' for v in row['initial_xyz_m']) lines.append(f"| {method} | {seed} | {row['initial_flat_index']} | ({xyz}) | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['final_sampling']['numerator']} | {row['negative_roi']['known_negative_union']['count']} |") lines += ['', 'A는 최종 256점 중 Box 127점의 저장 coverage, B는 그중 실제 Priority 32점의 coverage다. B의 새 진단값으로 A를 바꾸지 않았다.', '', '| 방법 / Seed | Priority depth min / median / p95 / max (m) | Unique GT reference IDs (B) |', '| --- | --- | --- |'] for method, seeds in saved.items(): for seed, row in seeds.items(): d = row['priority_depth_m'] lines.append(f"| {method} / {seed} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} | {row['priority_reference_ids']} |") initial = result['initial_control'] lines += ['', '## C. 동일 초기점 offline control', '', f"후보 교집합은 {initial['shared_count']}개다. GT와 무관한 `shared = sorted(set(C_S2) & set(C_S3)); initial_flat = shared[len(shared)//2]` 규칙으로 **{initial['initial_flat_index']}**를 선택했다. XYZ는 `{initial['initial_xyz_m']}` m이며 S2/S3에서 exact equality다. Candidate-local index는 `{initial['candidate_local_index']}`다.", '', '- 각 후보 입력은 저장된 오름차순 raster 순서(S2 297개 / S3 599개)를 유지했다. 기존 `fps_indices(..., 32, seed=fps_seed(0, BOX), initial=[local])`를 방법당 정확히 1회 호출했다.', '- `seed`는 기존 SeedSequence 계약에 맞게 전달했으며 initial 경로에서 RNG 생성/최초 draw가 없음을 실행 중 차단 검증했다. 초기점 포함 32개의 고유 source index다.', '- 두 FPS가 끝난 후에만 control을 GT matcher 및 negative ROI로 평가했다. 전체 32-step trace는 생성하지 않았다.', '', '| 방법 | 실제 node | Rim matching node | C Priority refs /103 | Unique GT reference IDs | Negative union /32 | Depth min / median / p95 / max (m) |', '| --- | ---: | ---: | ---: | --- | ---: | --- |'] for method, row in control.items(): d = row['priority_depth_m'] lines.append(f"| {method} | {row['node_count']} | {row['rim_matching_node_count']} | {row['priority_reference_count']} ({100*row['priority_coverage']['value']:.2f}%) | {row['priority_reference_ids']} | {row['negative_roi']['known_negative_union']['count']} | {' / '.join(f'{d[k]:.9g}' for k in ('min','median','p95','max'))} |") lines += ['', '공통 초기점 control의 실제 선택 flat index는 선택 순서대로 다음과 같다.', ''] for method, row in control.items(): lines += [f"- {method}: `{row['selected_flat_indices']}`"] lines += ['', 'Reference 집합 비교(C):', ''] for name, row in result['control_reference_comparison'].items(): lines += [f"- {name}: {row['count']}개, `{row['reference_ids']}`"] node_comparison = result['control_node_comparison'] lines += ['', f"선택 source index 교집합은 {node_comparison['intersection']['count']}개 " f"(`{node_comparison['intersection']['flat_indices']}`), S2-only / S3-only는 각각 " f"{node_comparison['S2_only']['count']} / {node_comparison['S3_only']['count']}개다. " '각 선택 XYZ 및 candidate-local index와 전체 차집합은 아래 JSON에 보존했다.', '', '## 해석과 연구적 판단', '', result['interpretation_ko'], '', '- 저장 seed의 S3 Priority 변동 폭은 2 references(1.94%p), S2는 6 references(5.83%p)다. S3의 덮인 ID 집합도 seed에 따라 달라진다. 이는 관측된 초기점 민감성의 범위이며 초기점의 독립적인 인과 효과를 정량화한 값은 아니다.', '- 같은 seed끼리의 B S2−S3 차이는 seed 0/1/2에서 10/2/4 references다. C의 차이 5는 seed 0보다 작고 seed 1/2보다 크다. 따라서 seed 0의 큰 차이 전부가 지속되는 것은 아니지만, 이 공통 초기점에서도 S3의 낮은 coverage는 남는다.', '- 관측된 seed별 B Priority 범위 및 같은 초기점 C를 함께 읽어야 한다. A와 C는 sampling 단계가 다르므로 동일 조건 성능 비교로 사용하지 않는다.', '- 한 공통 초기점 결과를 전체 seed·episode에 일반화하지 않는다. 후보 수·위치·오염·원거리 depth의 독립적인 인과 기여율은 분해하지 않았다. Phase2의 기존 경로 분석을 재사용하며 새 trace를 만들지 않았다.', '- 다음 연구 판단은 초기점 민감성과 ��보 집합 효과를 함께 검토하는 것이다. 새 sampling 정책, 후보 제거, depth cutoff, GT quota, FPS 변형의 채택 근거로 사용하지 않는다. 추가 초기점/episode 검증은 별도 승인 대상이다.', '', '## 구현·검증·source hash', '', '- 추가 구현: [run_priority_fps_seed_control.py](../../visual/runtime/test/run_priority_fps_seed_control.py), [test_priority_fps_seed_control.py](../../visual/runtime/test/test_priority_fps_seed_control.py). 기존 production·Phase1/2·run_sampling 파일은 보존했다.', '- Phase1 source geometry/matcher helper와 Phase2 `verify_fps_source` 검증 경로를 재사용했다. 새 sampler나 logger/publisher 구현은 추가하지 않았다.', f'- **PASS**: 신규 및 관련 기존 테스트. `{test_summary}`. [test log]({rel(output/"tests.log")}). 테스트의 FPS/전체 sampler 반복은 합성 입력에만 적용했다.', '- **PASS**: evaluated source와 현재 FPS·candidate·allocation 정의 일치, seed0 Phase1/2 reference ID 및 저장 순서 일치, seed1/2 source/feature/role alignment, 23 metadata row 및 seed 간 공통 source feature equality.', '- **PASS**: 저장 분석 FPS 호출 차단, 후보 교집합 252 / initial 114957, initial XYZ exact equality, 초기 RNG draw 차단, 32 unique indices·초기점 포함·실제 후보 membership·local/global 대응·raster 순서 유지.', '- **PASS**: 합성 GT annotation 변경 시 선택 불변, 기존 same-pair joint matching 및 reference 중복 제거, 저장 negative ROI union 점유 일치, 원본 artifact·입력·기존 파일 hash 불변, HTML/Markdown 상대 링크와 PNG 생성 확인.', '- **FAIL**: 없음. 불일치 시 assertion·tolerance·GT·seed 규칙을 변경하지 않고 중단하도록 구현했다.', '- **SKIP / 미검증**: simulator·renderer·CUDA/GPU backend, 다른 frame/episode, 추가 공통 초기점 sweep, PCL·Graph·BC·정책/학습 실험, 외부 upload·dependency 설치·commit. 현재 호스트에서는 CPU NumPy offline 진단만 실행했다.', f'- Git 시작/종료 및 보존한 기존 변경: [start]({rel(output/"git_start.json")}), [end]({rel(output/"git_end.json")}), [diff]({rel(output/"implementation.patch")}). 시작 Git dirty 상태이므로 commit만으로 재현할 수 없으며 source snapshot과 hash를 함께 보존했다.', '', '| Source / input | SHA-256 |', '| --- | --- |'] for path, digest in result['source_hashes'].items(): lines.append(f'| `{path}` | `{digest}` |') lines += ['', '위 표는 실제 진단 실행 시점의 source hash다. 전체 입력/evaluated source hash와 원본 보존 기록은 아래 JSON에 있다. ' '그림·보고서만 저장 결과로 갱신한 경우 실제 실행 source는 `execution_source/`, 최종 source는 `diagnostic_source/` 및 ' '`source_hashes.json`의 `report_generation_sources`로 구분한다. FPS 결과는 재실행하지 않는다.', '', '## 산출물', ''] for filename in ('priority_fps_seed_control.html', 'priority_fps_seed_control.json', 'seed_initial_points.png', 'seed_priority_final_coverage.png', 'shared_initial_overlay.png', 'shared_initial_coverage.png', 'source_hashes.json', 'verification.json', 'tests.log', 'implementation.patch'): lines.append(f'- [{filename}]({rel(output/filename)})') lines += ['', '**Phase 3 결과 제출 후 중단한다. 후속 변경은 별도 승인 후 진행한다.**', ''] REPORT.write_text('\n'.join(lines), encoding='utf-8') shutil.copyfile(REPORT, output/'report_snapshot.md')
def diagnose(source, output_root, baseline_path): if os.environ.get('WANDB_MODE') != 'disabled': raise ValueError('set WANDB_MODE=disabled for local-only execution') if REPORT.exists(): raise FileExistsError('refuse to overwrite Phase3 report') baseline = json.loads(Path(baseline_path).read_text()) verify_preserved(baseline) source = Path(source).resolve() comparison = json.loads((source/'comparison.json').read_text()) require_equal(comparison['run_id'], SOURCE_RUN, 'Task03 run') config = comparison['config'] source_checks = source_contract(source, config) fps_checks = verify_fps_source(source, config['source_sha256']['visual/runtime/sampling.py']) phase1_path = REPO/'experiments'/PHASE1/'diagnostic.json' phase2_path = REPO/'experiments'/PHASE2/'priority_fps_trace.json' phase1, phase2 = (json.loads(p.read_text()) for p in (phase1_path, phase2_path)) for obj, run, phase in ((phase1, PHASE1, 1), (phase2, PHASE2, 2)): require_equal(obj['run_id'], run, f'Phase{phase} run') require_equal(obj['source_run_id'], SOURCE_RUN, f'Phase{phase} Task03 source') require_equal(phase1['inputs_unchanged'], True, 'Phase1 inputs unchanged') for field in ('saved_reference_order_and_geometry_exact', 'target_coverage_exact', 'saved_negative_roi_counts_exact'): require_equal(phase1['frames'][0][field], True, 'Phase1 Frame0 '+field) require_equal(phase2['pass_all'], True, 'Phase2 pass_all') for relative, expected in phase2['config']['source_sha256'].items(): require_equal(digests(REPO/relative)[1], expected, 'Phase2 diagnostic source '+relative) episode, masks = Path(config['input']), Path(config['masks']) inputs = [source/'comparison.json', source/'f0000_samples.npz', source/'f0000_metrics.json', episode, masks, episode.with_name('segmentation_id_map.json'), masks.with_name('tracking.json'), phase1_path, phase2_path] for name, expected in phase2['config']['input_sha256'].items(): require_equal(digests(Path(name))[1], expected, 'Phase2 input '+name) before = hashes(inputs) current_sources = [Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'), Path(__file__).with_name('run_priority_fps_trace.py'), Path(__file__).with_name('run_rim_bottleneck.py'), Path(__file__).with_name('sampling_evaluation.py'), REPO/'visual/runtime/sampling.py', REPO/'visual/runtime/geometry.py', REPO/'visual/runtime/rgbd.py'] source_hashes = hashes(current_sources) run_config = dict(task='03-D', phase=3, source_run_id=SOURCE_RUN, phase1_run_id=PHASE1, phase2_run_id=PHASE2, frame=0, methods=list(METHODS), num_points=256, structural_ratio=.25, orientation_threshold_deg=20, box_budget=127, priority_count=32, matching_px_m=[2., .003], reference_count=103, input_sha256=before, source_sha256=source_hashes, real_fps_calls_per_method=1, additional_initial_sweeps=0, simulator_executed=False, gpu_executed=False, device='cpu', full_sampling_executed=False, candidate_normal_feature_recalculation=False, python=platform.python_version(), numpy=np.__version__) with ExperimentLogger(team='visual', config=run_config, seed=0, model='task03d_priority_fps_seed_control', job_type='evaluate', root=output_root) as logger: output = logger.directory write_json(output/'git_start.json', baseline) shutil.copyfile(Path(baseline_path).with_name('git_start.diff'), output/'git_start.diff') # Tests precede real control, so any failing contract stops the experiment. with (output/'tests.log').open('w') as log: test = subprocess.run([sys.executable, '-m', 'unittest', *TEST_MODULES, '-v'], cwd=REPO, stdout=log, stderr=subprocess.STDOUT, check=False) logger.link_output(output/'tests.log', kind='reports') if test.returncode: write_json(output/'verification.json', dict(status='FAIL', reason='required tests failed', real_fps_calls=0)) logger.link_output(output/'verification.json', kind='reports') raise RuntimeError('required tests failed; see tests.log; no real FPS executed') test_lines = (output/'tests.log').read_text().splitlines() test_summary = next(line for line in test_lines if line.startswith('Ran '))+'; '+test_lines[-1] frame, geometry, gt = _frame_and_context(comparison, episode, masks) metrics = json.loads((source/'f0000_metrics.json').read_text()) with np.load(source/'f0000_samples.npz', allow_pickle=False) as archive, forbid_sampling(): candidates, selections, alignment = load_saved(archive, config, metrics, frame, geometry, phase2) context = evaluation_context(frame, geometry_evidence(frame), gt, config['camera'], config['robot_ids']) refs = tuple(archive[f'evaluation/box/reference_{suffix}'] for suffix in ('uv', 'xyz')) require_equal(len(refs[0]), 103, 'GT reference count') for a, b in zip(refs, context['references']['box']): np.testing.assert_array_equal(a, b) matcher = CoverageMatcher(geometry, BOX, refs) saved = summarize_saved(selections, phase1, phase2, matcher, frame, context['negatives']['box']) for method, seeds in saved.items(): for seed, row in seeds.items(): key = f'{method}_n256_r0.25_t20_s{seed}' for name, roi in row['negative_roi'].items(): require_equal(roi['count'], metrics[key]['objects']['box']['negative'][name]['priority'], key+' ROI '+name) # No GT/ROI/matcher parameter crosses this selection boundary. with patch(__name__+'.fps_indices', wraps=fps_indices) as calls: orders, initial = select_control(candidates) require_equal(calls.call_count, 2, 'total real FPS call count') # Only now may selected control points enter the matcher/negative ROIs. with forbid_sampling(): control = score_control(orders, matcher, frame, context['negatives']['box']) require_equal(hashes(inputs), before, 'input hashes after evaluation') preservation = verify_preserved(baseline) difference = control['S2']['priority_reference_count']-control['S3']['priority_reference_count'] ranges = {m: [min(r['priority_reference_count'] for r in seeds.values()), max(r['priority_reference_count'] for r in seeds.values())] for m, seeds in saved.items()} interpretation = (f"Saved Priority ranges: S2 {ranges['S2']}, S3 {ranges['S3']} references of 103. " f"At shared initial 114957, S2 covers {control['S2']['priority_reference_count']}/103 and S3 " f"{control['S3']['priority_reference_count']}/103 (S2 minus S3: {difference}). " 'This single initialization constrains interpretation to the fixed candidate sets and FPS conditions; ' 'candidate count, position, contamination and far depth have not been causally separated.') interpretation_ko = (f"저장된 seed 0/1/2의 B Priority coverage는 S2 {ranges['S2'][0]}–{ranges['S2'][1]}/103, " f"S3 {ranges['S3'][0]}–{ranges['S3'][1]}/103이다. 공통 초기점 114957의 C Priority는 " f"S2 **{control['S2']['priority_reference_count']}/103**, S3 **{control['S3']['priority_reference_count']}/103** " f"(S2−S3 {difference} refs)이다. " + ('이 초기점과 기존 FPS 조건에서도 후보 집합 차이에 따른 결과 차이가 남는다. ' if difference > 0 else '저장 seed에서 관측한 차이가 이 공통 초기점에서는 축소되거나 역전되어 초기점 민감성의 근거가 된다. ') + '단일 공통 초기점으로 초기점 효과의 일반적 크기나 각 후보 특성의 독립적 인과 기여율을 추정하지 않는다.') result = dict(run_id=logger.run_id, source_run_id=SOURCE_RUN, config=run_config, source_contract=source_checks, fps_source_check=fps_checks, source_hashes=source_hashes, saved=saved, saved_alignment=alignment, initial_control=initial, control=control, control_reference_comparison=compare_ids(*(control[m]['priority_reference_ids'] for m in METHODS)), control_node_comparison={name: dict(count=row['count'], flat_indices=row['reference_ids']) for name, row in compare_ids(*(control[m]['selected_flat_indices'] for m in METHODS)).items()}, interpretation=interpretation, interpretation_ko=interpretation_ko, input_hashes_unchanged=True, pass_all=True) write_json(output/'priority_fps_seed_control.json', result) write_json(output/'source_hashes.json', dict(inputs_before=before, inputs_after=hashes(inputs), diagnostic_sources=source_hashes, evaluated_fps=fps_checks, original_preservation=preservation)) create_plots(output, frame, saved, control, refs[0]) create_markdown(output, result, test_summary) create_html(output, result, source) for path in current_sources: dest = output/'diagnostic_source'/path.relative_to(REPO) dest.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(path, dest) logger.link_output(dest, kind='reports') diff = subprocess.check_output(['git', 'diff', '--binary'], cwd=REPO) for path in (Path(__file__), Path(__file__).with_name('test_priority_fps_seed_control.py'), REPORT): delta = subprocess.run(['git', 'diff', '--no-index', '--', '/dev/null', str(path.relative_to(REPO))], cwd=REPO, stdout=subprocess.PIPE, check=False) if delta.returncode != 1: raise ValueError('cannot preserve added-file diff') diff += delta.stdout (output/'implementation.patch').write_bytes(diff) write_json(output/'git_end.json', dict(git_status=subprocess.check_output(['git', 'status', '--short'], cwd=REPO).decode(), git_head=subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=REPO).decode().strip(), original_preservation=verify_preserved(baseline))) verification = dict(status='PASS', required_tests=dict(status='PASS', summary=test_summary, modules=TEST_MODULES), source_and_input_contract='PASS', seed0_phase2_ids_reused='PASS', saved_source_feature_role_alignment='PASS', saved_analysis_fps_calls=0, shared_candidate_count=252, shared_initial=114957, initial_xyz_exact='PASS', initial_rng_draws=0, real_fps_calls=initial['real_fps_calls'], unique_count_includes_initial=COUNT, raster_local_global_membership='PASS', gt_annotation_independence='PASS (synthetic tests; no GT argument in selection)', same_pair_joint_matching_and_reference_dedup='PASS', negative_roi_union='PASS', inputs_unchanged='PASS', original_preservation=preservation, skipped=['simulator', 'renderer', 'GPU/CUDA', 'other frame/episode', 'initialization sweep', 'new sampling policy', 'external upload', 'dependency installation', 'commit']) write_json(output/'verification.json', verification) # Check all local href/src targets without browser/network dependencies. from html.parser import HTMLParser class Links(HTMLParser): def handle_starttag(self, tag, attrs): for attr, value in attrs: if attr in ('href', 'src') and value and not (output/value).is_file(): raise ValueError('broken local HTML link: '+value) Links().feed((output/'priority_fps_seed_control.html').read_text()) markdown_links = re.findall(r'\]\(([^)]+)\)', REPORT.read_text()) for target in markdown_links: if not (REPORT.parent/target).is_file(): raise ValueError('broken local Markdown link: '+target) for png in output.glob('*.png'): pixels = plt.imread(png) if pixels.ndim != 3 or min(pixels.shape[:2]) < 400: raise ValueError('invalid report PNG: '+str(png)) verification['html_and_markdown_local_links'] = dict(status='PASS', markdown_link_count=len(markdown_links)) verification['png_readback'] = 'PASS (4 PNGs, dimensions and pixel decode)' write_json(output/'verification.json', verification) for path in sorted(output.iterdir()): if path.is_file() and path.name not in ('metadata.json', 'manifest.json', 'config.yaml', 'metrics.json') and not path.name.endswith('.tracking.json'): logger.link_output(path, kind='metrics' if path.name in ('priority_fps_seed_control.json','source_hashes.json') else 'reports') logger.log({m: {'saved_priority_seed'+s: r['priority_reference_count'] for s, r in seeds.items()} for m, seeds in saved.items()}, step=0, prefix='eval/task03d/saved') logger.log({m: dict(priority_references=r['priority_reference_count'], rim_matching_nodes=r['rim_matching_node_count']) for m, r in control.items()}, step=0, prefix='eval/task03d/control') logger.record(source_run_id=SOURCE_RUN, phase1_run_id=PHASE1, phase2_run_id=PHASE2, real_fps_calls=initial['real_fps_calls'], inputs_unchanged=True, simulator_executed=False, gpu_executed=False) return output
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--source', type=Path, default=REPO/'visual/results/sampling'/SOURCE_RUN) parser.add_argument('--out', type=Path, default=REPO/'experiments') parser.add_argument('--baseline', type=Path, required=True, help='pre-change workspace/artifact SHA256 and git status snapshot') args = parser.parse_args() print(diagnose(args.source, args.out, args.baseline))
if __name__ == '__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304"""Replay saved Frame 0 Box S2/S3 Priority FPS, then explain the verified order.
WANDB_MODE=disabled .venv/bin/python -m visual.runtime.test.run_priority_fps_trace"""from __future__ import annotations
import argparseimport astimport jsonimport osfrom pathlib import Pathimport platformimport shutil
import matplotlibmatplotlib.use('Agg')import matplotlib.pyplot as pltimport numpy as np
from utils.experiment_artifacts import digestsfrom utils.experiment_logger import ExperimentLoggerfrom visual.runtime.geometry import build_organized_geometryfrom visual.runtime.rgbd import BOX, iter_saved_rgbdfrom visual.runtime.sampling import fps_indicesfrom visual.runtime.test.run_rim_bottleneck import ( SOURCE_RUN, geometry_evidence, require_equal, source_contract, validate_saved_selection, write_json,)from visual.runtime.test.sampling_evaluation import CoverageMatcher, evaluation_context
REPO = Path(__file__).resolve().parents[3]METHODS = {'S2': ('fd2', 'S2_n256_r0.25_t20_s0', 297, 57, 13), 'S3': ('pca5', 'S3_n256_r0.25_t20_s0', 599, 91, 3)}FRAME = 0PRIORITY_COUNT = 32
def fps_seed(seed=0, object_id=BOX): return int(np.random.SeedSequence([seed, object_id]).generate_state(1)[0])
def verify_fps_source(source, expected_sha): relative = 'visual/runtime/sampling.py' saved = source/'evaluated_source'/relative current = REPO/relative require_equal(digests(saved)[1], expected_sha, 'evaluated sampling.py SHA256') def definitions(path): tree = ast.parse(path.read_text()) return {n.name: ast.dump(n) for n in tree.body if isinstance(n, ast.FunctionDef) and n.name in ('fps_indices', 'sample_points', 'extract_candidates', 'allocate_budget')} require_equal(definitions(current), definitions(saved), 'FPS/candidate/allocation definitions') return {'saved_sha256': expected_sha, 'current_sha256': digests(current)[1], 'fps_candidate_allocation_ast_exact': True}
def trace_order(points, selected, flat, depth, candidate_references, negatives=None): """Explain an already verified FPS order; no selection or RNG occurs here.""" xyz = np.asarray(points, dtype=np.float64) selected = np.asarray(selected, dtype=np.int64) flat = np.asarray(flat, dtype=np.int64) refs = np.asarray(candidate_references, dtype=bool) if xyz.shape != (len(flat), 3) or refs.ndim != 2 or refs.shape[0] != len(flat): raise ValueError('trace input shape mismatch') if not len(selected) or len(np.unique(selected)) != len(selected) or ((selected < 0) | (selected >= len(flat))).any(): raise ValueError('invalid FPS order') distance = np.full(len(flat), np.inf, dtype=np.float64) x, y, z = (np.ascontiguousarray(xyz[:, i]) for i in range(3)) covered = np.zeros(refs.shape[1], dtype=bool) remaining = np.ones(len(flat), dtype=bool) rows = [] for step, local in enumerate(selected): local = int(local) a = remaining & refs.any(axis=1) b = remaining & refs[:, ~covered].any(axis=1) if step == 0: if not np.isinf(distance).all(): raise AssertionError('initial distances must all be +inf') maximum = None ties = [] else: maximum = float(distance[remaining].max()) ties = np.flatnonzero(remaining & (distance == maximum)).tolist() if local != ties[0]: raise AssertionError(f'step {step}: selected {local}, first argmax {ties[0]}') def group(mask): if not mask.any() or step == 0: return {'remaining_count': int(mask.sum()), 'max_min_squared_distance_m2': None, 'gap_to_winner_m2': None, 'ties_winner': None} best = float(distance[mask].max()) return {'remaining_count': int(mask.sum()), 'max_min_squared_distance_m2': best, 'gap_to_winner_m2': maximum-best, 'ties_winner': best == maximum} new_ids = np.flatnonzero(refs[local] & ~covered).tolist() roi = {name: bool(mask.ravel()[flat[local]]) for name, mask in (negatives or {}).items()} roi['known_negative_union'] = any(roi.values()) item = dict(step=step+1, initial_rng_choice=step == 0, candidate_local_index=local, flat_index=int(flat[local]), xyz_m=xyz[local].tolist(), depth_m=float(depth[local]), min_squared_distance_m2=None if step == 0 else float(distance[local]), argmax_value_m2=maximum, exact_tie_count=None if step == 0 else len(ties), tied_local_indices=None if step == 0 else ties, first_tied_local_index=None if step == 0 else ties[0], rule_satisfied=True, all_remaining=group(remaining), rim_A=group(a), uncovered_rim_B=group(b), matched_rim_reference_ids=np.flatnonzero(refs[local]).tolist(), rim_reference_matched=bool(refs[local].any()), new_reference_ids=new_ids, new_reference_count=len(new_ids), selected_negative_roi=roi) covered |= refs[local] item['cumulative_reference_count'] = int(covered.sum()) rows.append(item) new_dist = (x-x[local])**2+(y-y[local])**2+(z-z[local])**2 np.minimum(distance, new_dist, out=distance) distance[local] = -np.inf remaining[local] = False return rows
def _frame_and_context(comparison, episode, masks): config = comparison['config'] frame = next(f for f in iter_saved_rgbd(episode, masks, camera=config['camera']) if f.source_frame == FRAME) geometry = build_organized_geometry(frame) np.testing.assert_array_equal(geometry_evidence(frame).frame.geometry.xyz, geometry.xyz) with np.load(episode, allow_pickle=False) as ep: keys = [f'{config["camera"]}/seg', 'peg_id', 'box_id', 'peg_pose', 'box_pose', 'box_hole_pose', 'peg_half_sizes', 'box_hole_radii'] gt = {key: ep[key] for key in keys} return frame, geometry, gt
def create_plots(output, frame, methods, refs): fig, axes = plt.subplots(1, 2, figsize=(15, 6), constrained_layout=True) for ax, (name, row) in zip(axes, methods.items()): c = np.asarray(row['candidate_flat_indices']) v, u = np.unravel_index(c, frame.depth.shape) ax.imshow(frame.rgb) ax.scatter(u, v, s=8, c='#ff6a40', alpha=.55, label='orientation candidates') ax.scatter(refs[:, 0], refs[:, 1], s=12, c='#e927d8', marker='+', label='GT rim (evaluation only)') for item in row['trace']: vv, uu = np.unravel_index(item['flat_index'], frame.depth.shape) ax.scatter(uu, vv, s=38, c='#ffe34d', edgecolors='black', linewidths=.4) ax.text(uu+2, vv-2, str(item['step']), fontsize=6, color='white', bbox=dict(facecolor='black', alpha=.6, pad=.5)) ax.set(title=f'{name}: {len(c)} candidates, 32 priority points', xlim=(min(u.min(),refs[:,0].min())-12,max(u.max(),refs[:,0].max())+12), ylim=(max(v.max(),refs[:,1].max())+12,min(v.min(),refs[:,1].min())-12)) ax.set_aspect('equal'); ax.legend(fontsize=7, loc='upper right') fig.savefig(output/'priority_overlay.png', dpi=150); plt.close(fig) fig, axes = plt.subplots(2, 1, figsize=(12, 8), sharex=True, constrained_layout=True) for name, row in methods.items(): steps = [t['step'] for t in row['trace']][1:] for key, label, style in [('argmax_value_m2','winner','-'),('rim_A','rim A','--'),('uncovered_rim_B','uncovered rim B',':')]: vals = [t[key] if key == 'argmax_value_m2' else t[key]['max_min_squared_distance_m2'] for t in row['trace'][1:]] axes[0].plot(steps, vals, style, marker='.', ms=2, label=f'{name} {label}') axes[1].step([t['step'] for t in row['trace']], [t['cumulative_reference_count'] for t in row['trace']], where='post', label=name) axes[0].set_yscale('log') axes[0].set(ylabel='Preselection min squared distance (m², log scale)', title='FPS distance competition; step 1 is RNG and omitted') axes[1].set(xlabel='Priority selection step', ylabel='Unique GT rim references covered', ylim=(-1, 16)) for ax in axes: ax.grid(alpha=.25); ax.legend(ncol=3, fontsize=8) fig.savefig(output/'priority_distances_coverage.png', dpi=150); plt.close(fig)
def create_html(output, run_id): body = f'''<!doctype html><html lang="en"><meta charset="utf-8"><title>Priority FPS trace</title><style>body{{font:16px system-ui;max-width:1200px;margin:2rem auto;padding:0 1rem}}img{{width:100%;height:auto}}a{{margin-right:1rem}}</style><h1>Task03-D Phase 2 — Frame 0 Box Priority FPS</h1><p>Run {run_id}; S2 FD2 and S3 PCA5; 32 points each. GT rim marks and coverage are evaluation only; they did not enter FPS.</p><p><a href="priority_fps_trace.json">Full step trace JSON</a><a href="verification.json">Verification</a><a href="tests.log">Test log</a><a href="source_hashes.json">Source hashes</a><a href="implementation.patch">Implementation diff</a></p><h2>Candidate locations and numbered selection overlay</h2><img src="priority_overlay.png" alt="S2 and S3 candidates and numbered priority selections"><h2>Step distance competition and cumulative GT coverage</h2><img src="priority_distances_coverage.png" alt="FPS distance competition and coverage"><p><a href="priority_overlay.png">Overlay PNG</a><a href="priority_distances_coverage.png">Distance and coverage PNG</a></p></html>''' (output/'priority_fps_trace.html').write_text(body, encoding='utf-8')
def diagnose(source, output_root): if os.environ.get('WANDB_MODE') != 'disabled': raise ValueError('set WANDB_MODE=disabled for this local-only diagnostic') source = Path(source).resolve() comparison_path = source/'comparison.json' comparison = json.loads(comparison_path.read_text()) require_equal(comparison['run_id'], SOURCE_RUN, 'Task03 source run') config = comparison['config'] source_checks = source_contract(source, config) fps_source_check = verify_fps_source(source, config['source_sha256']['visual/runtime/sampling.py']) episode, masks = Path(config['input']), Path(config['masks']) segmap = episode.with_name('segmentation_id_map.json') tracked = masks.with_name('tracking.json') inputs = [comparison_path, episode, masks, segmap, tracked, source/'f0000_samples.npz', source/'f0000_metrics.json'] for path, key in [(episode, 'input_sha256'), (masks, 'masks_sha256'), (segmap, 'segmentation_map_sha256')]: require_equal(digests(path)[1], config[key], key) before = {str(p): digests(p)[1] for p in inputs} current_sources = [Path(__file__), Path(__file__).with_name('run_rim_bottleneck.py'), Path(__file__).with_name('sampling_evaluation.py'), REPO/'visual/runtime/sampling.py'] source_hashes = {str(p.relative_to(REPO)): digests(p)[1] for p in current_sources} diagnostic_config = dict(task='03-D', phase=2, source_run_id=SOURCE_RUN, source_directory=str(source), frame=FRAME, methods=list(METHODS), priority_count=PRIORITY_COUNT, fps_seed=fps_seed(), tolerance_px_m=[2., .003], input_sha256=before, source_sha256=source_hashes, device='cpu', gpu_executed=False, simulator_executed=False, sample_points_executed=False, candidate_extraction_executed=False, feature_extraction_executed=False, surface_fps_executed=False, python=platform.python_version(), numpy=np.__version__) frame, geometry, gt = _frame_and_context(comparison, episode, masks) phase1 = json.loads((REPO/'experiments/d3f14ee494894daabb8ba2fab8e1b00c/diagnostic.json').read_text()) phase1_box_ids = {m: phase1['frames'][0]['conditions'][m]['reference_ids']['P'] for m in METHODS} metrics = json.loads((source/'f0000_metrics.json').read_text()) results, replayed = {}, {} with np.load(source/'f0000_samples.npz', allow_pickle=False) as archive: for method, (estimator, key, expected_candidates, expected_candidate_refs, expected_coverage) in METHODS.items(): alignment = validate_saved_selection(archive, key, frame, geometry) box = archive[key+'/object_id'] == BOX priority = archive[key+'/priority_selected'][box] stored_flat = archive[key+'/flat_index'][box][priority] require_equal(len(stored_flat), PRIORITY_COUNT, method+' saved priority count') metadata_names = [name for name in archive.files if name.startswith(key+'/metadata/')] if not metadata_names or any(len(archive[name]) != len(archive[key+'/flat_index']) for name in metadata_names): raise ValueError(method+': saved feature row alignment mismatch') if not archive[key+'/metadata/orientation_candidate'][box][priority].all(): raise ValueError(method+': saved priority feature role mismatch') if archive[key+'/metadata/depth_only_candidate'][box][priority].any(): raise ValueError(method+': unexpected depth-only priority row') candidate_flat = np.asarray(archive[f'evidence/{estimator}/1/20/orientation_flat'], dtype=np.int64) require_equal(len(candidate_flat), expected_candidates, method+' candidates') if not np.all(candidate_flat[:-1] < candidate_flat[1:]) or not geometry.observed_mask(BOX).ravel()[candidate_flat].all(): raise ValueError(method+': candidate raster order or Box support mismatch') points = geometry.xyz.reshape(-1, 3)[candidate_flat].astype(np.float64) depth = frame.depth.ravel()[candidate_flat].astype(np.float64) positions = np.searchsorted(candidate_flat, stored_flat) np.testing.assert_array_equal(candidate_flat[positions], stored_flat) seed = fps_seed(config['conditions'][key]['seed'], BOX) order = fps_indices(points, PRIORITY_COUNT, seed=seed) # exactly one live replay per method np.testing.assert_array_equal(candidate_flat[order], stored_flat) np.testing.assert_array_equal(points[order], archive[key+'/points'][box][priority]) require_equal(int(order[0]), int(np.random.default_rng(seed).integers(len(points))), method+' initial RNG local row') counts = metrics[key]['objects']['box']['counts'] require_equal(counts['priority'], PRIORITY_COUNT, method+' quota') require_equal(counts['candidates'], expected_candidates, method+' candidate count') replayed[method] = dict(estimator=estimator, candidate_flat=candidate_flat, points=points, depth=depth, order=order, stored_flat=stored_flat, seed=seed, alignment=alignment, metadata_fields=len(metadata_names), counts=counts, expected_candidate_refs=expected_candidate_refs, expected_coverage=expected_coverage) # Both FPS replays and exact saved-order checks have finished. GT starts here. context = evaluation_context(frame, geometry_evidence(frame), gt, config['camera'], config['robot_ids']) for suffix, index in [('uv', 0), ('xyz', 1)]: np.testing.assert_array_equal(archive[f'evaluation/box/reference_{suffix}'], context['references']['box'][index]) refs = tuple(archive[f'evaluation/box/reference_{suffix}'] for suffix in ('uv', 'xyz')) matcher = CoverageMatcher(geometry, BOX, refs) for method, replay in replayed.items(): candidate_flat = replay['candidate_flat'] points, depth, order = replay['points'], replay['depth'], replay['order'] stored_flat = replay['stored_flat'] matched_ids, _ = matcher.reference_hits(candidate_flat) require_equal(len(matched_ids), replay['expected_candidate_refs'], method+' candidate rim coverage') matrix = matcher.adjacencies[matcher.key(2., .003)][np.searchsorted(matcher.flat, candidate_flat)].toarray().astype(bool) trace = trace_order(points, order, candidate_flat, depth, matrix, context['negatives']['box']) priority_hits, _ = matcher.reference_hits(stored_flat) require_equal(len(priority_hits), replay['expected_coverage'], method+' priority coverage') require_equal(priority_hits.tolist(), phase1_box_ids[method], method+' Phase1 priority IDs') require_equal(trace[-1]['cumulative_reference_count'], replay['expected_coverage'], method+' trace coverage') results[method] = dict(estimator=replay['estimator'], candidate_count=len(candidate_flat), candidate_flat_indices=candidate_flat.tolist(), candidate_rim_reference_count=len(matched_ids), candidate_rim_source_node_count=int(matrix.any(axis=1).sum()), stored_priority_flat_indices=stored_flat.tolist(), replay_priority_flat_indices=candidate_flat[order].tolist(), exact_saved_order_match=True, rng_seed=replay['seed'], initial_rng_local_index=int(order[0]), priority_reference_ids=priority_hits.tolist(), priority_reference_count=len(priority_hits), source_alignment=replay['alignment'], saved_feature_rows_aligned=True, saved_feature_fields=replay['metadata_fields'], saved_allocation=replay['counts'], trace=trace) require_equal({str(p): digests(p)[1] for p in inputs}, before, 'source input hashes after read') result = dict(source_run_id=SOURCE_RUN, frame=FRAME, config=diagnostic_config, source_contract=source_checks, fps_source_check=fps_source_check, input_hashes_unchanged=True, methods=results, pass_all=True, interpretation=[ 'Distances are reconstructed from the verified saved prefix, without a second FPS selection algorithm.', 'GT rim and negative ROI annotations are added after exact FPS replay.', 'Distance competition describes the observed selection; causal contributions remain untested.']) with ExperimentLogger(team='visual', config=diagnostic_config, seed=0, model='task03d_priority_fps_trace', job_type='evaluate', root=output_root) as logger: result['run_id'] = logger.run_id output = logger.directory write_json(output/'priority_fps_trace.json', result) write_json(output/'source_hashes.json', {'inputs': before, 'diagnostic_sources': source_hashes, 'evaluated_fps': fps_source_check}) create_plots(output, frame, results, refs[0]) create_html(output, logger.run_id) for path in current_sources + [Path(__file__).with_name('test_priority_fps_trace.py')]: dest = output/'diagnostic_source'/path.relative_to(REPO) dest.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(path, dest) logger.link_output(dest, kind='reports') for filename, kind in [('priority_fps_trace.json','metrics'), ('source_hashes.json','metrics'), ('priority_overlay.png','reports'), ('priority_distances_coverage.png','reports'), ('priority_fps_trace.html','reports')]: logger.link_output(output/filename, kind=kind) logger.log({m: {'candidate_rim_references': r['candidate_rim_reference_count'], 'priority_rim_references': r['priority_reference_count']} for m, r in results.items()}, step=FRAME, prefix='eval/task03d') logger.record(source_run_id=SOURCE_RUN, frame=FRAME, exact_replays=True, inputs_unchanged=True, gpu_executed=False, simulator_executed=False) return output
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--source', type=Path, default=REPO/'visual/results/sampling'/SOURCE_RUN) parser.add_argument('--out', type=Path, default=REPO/'experiments') args = parser.parse_args() print(diagnose(args.source, args.out))
if __name__ == '__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209{ "artifacts": [ { "kind": "metrics", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/3be63c0a2701dca49c3a360ea12261848646465890b6a305722652755dc46257/metrics.json", "sha256": "3be63c0a2701dca49c3a360ea12261848646465890b6a305722652755dc46257", "size": 748 }, { "kind": "metrics", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/c85fe2522b5782ba711eabff1c7f0c9e65b19a200d3e2bec8ea63d2f87d63ddd/priority_fps_seed_control.json", "sha256": "c85fe2522b5782ba711eabff1c7f0c9e65b19a200d3e2bec8ea63d2f87d63ddd", "size": 73182 }, { "kind": "metrics", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/6d734205017b3edef3ca0a5784d7924d863d2fc01ebb401bf9b57e1746bfe971/source_hashes.json", "sha256": "6d734205017b3edef3ca0a5784d7924d863d2fc01ebb401bf9b57e1746bfe971", "size": 5028 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/445926e3f65f60177f3fe874cfb0ecff38b9478aeaced65c96659d51d6294757/tests.log", "sha256": "445926e3f65f60177f3fe874cfb0ecff38b9478aeaced65c96659d51d6294757", "size": 8107 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26/run_priority_fps_seed_control.py", "sha256": "e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26", "size": 48124 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645/test_priority_fps_seed_control.py", "sha256": "69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645", "size": 13888 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b/run_priority_fps_trace.py", "sha256": "f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b", "size": 20007 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3/run_rim_bottleneck.py", "sha256": "8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3", "size": 20175 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b/sampling_evaluation.py", "sha256": "daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b", "size": 15611 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed/sampling.py", "sha256": "45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed", "size": 14001 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9/geometry.py", "sha256": "36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9", "size": 11385 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164/rgbd.py", "sha256": "be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164", "size": 8193 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/799e3c2b5af5472a01f15ae7517e3df5ac64d993ff44ca65a9d67578862f4ee1/git_end.json", "sha256": "799e3c2b5af5472a01f15ae7517e3df5ac64d993ff44ca65a9d67578862f4ee1", "size": 973 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/2a85e21142786e54bff67b4ce38cac8234f97f2581fe5fffcc8c13ae1e8331c5/git_start.diff", "sha256": "2a85e21142786e54bff67b4ce38cac8234f97f2581fe5fffcc8c13ae1e8331c5", "size": 15981 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f55bf1adddc81f3e56c2dfbad787980cd5ae5edc7dd4a019eb2a234f99dff1ee/git_start.json", "sha256": "f55bf1adddc81f3e56c2dfbad787980cd5ae5edc7dd4a019eb2a234f99dff1ee", "size": 175794 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d61d3b2801f95280a7ef2f088ad6d5ccc9a98c6873ac20eb6a3337ade2ccc057/implementation.patch", "sha256": "d61d3b2801f95280a7ef2f088ad6d5ccc9a98c6873ac20eb6a3337ade2ccc057", "size": 92081 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/032dec668a404267774c947883f31b0bd87d6ff904cc5e95a8f9563decf75db9/priority_fps_seed_control.html", "sha256": "032dec668a404267774c947883f31b0bd87d6ff904cc5e95a8f9563decf75db9", "size": 5258 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/707614a32fad479c78cb688b2fa021c83c338dfb08c760e5859d6b4650341ffd/report_snapshot.md", "sha256": "707614a32fad479c78cb688b2fa021c83c338dfb08c760e5859d6b4650341ffd", "size": 12299 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6/seed_initial_points.png", "sha256": "45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6", "size": 66487 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c/seed_priority_final_coverage.png", "sha256": "102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c", "size": 68459 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496/shared_initial_coverage.png", "sha256": "fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496", "size": 76742 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627/shared_initial_overlay.png", "sha256": "7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627", "size": 114732 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/57b59f80dc5e1d8936802b9ca2fb33c1e851ead6993917111985a8fae75ab542/verification.json", "sha256": "57b59f80dc5e1d8936802b9ca2fb33c1e851ead6993917111985a8fae75ab542", "size": 2119 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/1861c0542f7cade5845cd7726d62f95879ff215e0979947dd7fe630f06994af9/execution_tests.log", "sha256": "1861c0542f7cade5845cd7726d62f95879ff215e0979947dd7fe630f06994af9", "size": 8107 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3/refresh_report.py", "sha256": "d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3", "size": 4892 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827/run_priority_fps_seed_control.py", "sha256": "75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827", "size": 46013 }, { "kind": "reports", "path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b/report-56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b.zip", "sha256": "56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b", "size": 488117 } ], "config_path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/config/fbbcc99e90836229f20e40620bd7af775bea07b4625e31f68c90636c68247cc3/config.yaml", "environment": null, "episode_metadata_paths": [], "git_commit": "2e10a51736826aa980f2fe79a801eb6c9da8e288", "git_dirty": true, "metrics_path": "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/3be63c0a2701dca49c3a360ea12261848646465890b6a305722652755dc46257/metrics.json", "model_name": "task03d_priority_fps_seed_control", "random_seed": 0, "report_paths": [ "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/445926e3f65f60177f3fe874cfb0ecff38b9478aeaced65c96659d51d6294757/tests.log", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26/run_priority_fps_seed_control.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645/test_priority_fps_seed_control.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b/run_priority_fps_trace.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3/run_rim_bottleneck.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b/sampling_evaluation.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed/sampling.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9/geometry.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164/rgbd.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/799e3c2b5af5472a01f15ae7517e3df5ac64d993ff44ca65a9d67578862f4ee1/git_end.json", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/2a85e21142786e54bff67b4ce38cac8234f97f2581fe5fffcc8c13ae1e8331c5/git_start.diff", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f55bf1adddc81f3e56c2dfbad787980cd5ae5edc7dd4a019eb2a234f99dff1ee/git_start.json", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d61d3b2801f95280a7ef2f088ad6d5ccc9a98c6873ac20eb6a3337ade2ccc057/implementation.patch", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/032dec668a404267774c947883f31b0bd87d6ff904cc5e95a8f9563decf75db9/priority_fps_seed_control.html", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/707614a32fad479c78cb688b2fa021c83c338dfb08c760e5859d6b4650341ffd/report_snapshot.md", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6/seed_initial_points.png", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c/seed_priority_final_coverage.png", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496/shared_initial_coverage.png", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627/shared_initial_overlay.png", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/57b59f80dc5e1d8936802b9ca2fb33c1e851ead6993917111985a8fae75ab542/verification.json", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/1861c0542f7cade5845cd7726d62f95879ff215e0979947dd7fe630f06994af9/execution_tests.log", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3/refresh_report.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827/run_priority_fps_seed_control.py", "visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b/report-56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b.zip" ], "run_id": "f36f1e9e2bb64866b8d6c792db158635", "schema_version": 1, "selection": [ "metrics", "reports" ], "task": null, "team": "visual", "wandb_run_id": "f36f1e9e2bb64866b8d6c792db158635"}visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/config/fbbcc99e90836229f20e40620bd7af775bea07b4625e31f68c90636c68247cc3/config.yamlAdded+52
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/3be63c0a2701dca49c3a360ea12261848646465890b6a305722652755dc46257/metrics.jsonAdded+24
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/6d734205017b3edef3ca0a5784d7924d863d2fc01ebb401bf9b57e1746bfe971/source_hashes.jsonAdded+58
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/metrics/c85fe2522b5782ba711eabff1c7f0c9e65b19a200d3e2bec8ea63d2f87d63ddd/priority_fps_seed_control.jsonAdded+2957
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/032dec668a404267774c947883f31b0bd87d6ff904cc5e95a8f9563decf75db9/priority_fps_seed_control.htmlAdded+15
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c/seed_priority_final_coverage.pngAdded

Large File Pointer Details
- SHA256: 102afe6fd99977cf2ea4c1ed695b7ccd2c1879b09a78a48d0590298e7fb18d7c
- Pointer size: 130 Bytes
- Size of remote file: 68.5 kB
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/1861c0542f7cade5845cd7726d62f95879ff215e0979947dd7fe630f06994af9/execution_tests.logAdded+52
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/2a85e21142786e54bff67b4ce38cac8234f97f2581fe5fffcc8c13ae1e8331c5/git_start.diffAdded+259
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/36d20b7873d5ef9e1381e3bbe319da89e16fa5b44455488786dadd250bd814a9/geometry.pyAdded+255
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/445926e3f65f60177f3fe874cfb0ecff38b9478aeaced65c96659d51d6294757/tests.logAdded+52
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45860d0adfbefb2818b67fe5705cb8c36d7c344c1c52c44d4ca5abc6765e37ed/sampling.pyAdded+266
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6/seed_initial_points.pngAdded

Large File Pointer Details
- SHA256: 45fa27a1266eb11c6f846d06771c35a8a3cdbb7149ce2a8fa7d754ee68ef5ec6
- Pointer size: 130 Bytes
- Size of remote file: 66.5 kB
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b/report-56e021d3f0699171df126ba46462751bb8d578a1f1fe013b29ff7827bfb0266b.zipAdded+3
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/57b59f80dc5e1d8936802b9ca2fb33c1e851ead6993917111985a8fae75ab542/verification.jsonAdded+63
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/69c8b3a1c420bec843bd8a3d948db009cd78c9ea6c99cb1376e15b60c3f47645/test_priority_fps_seed_control.pyAdded+244
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/707614a32fad479c78cb688b2fa021c83c338dfb08c760e5859d6b4650341ffd/report_snapshot.mdAdded+112
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/75be5d3cdc7b4050f5a75ac1e5c8bd4ca665b0b98b0229ef3abda9a80cdb8827/run_priority_fps_seed_control.pyAdded+588
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627/shared_initial_overlay.pngAdded

Large File Pointer Details
- SHA256: 7842f00a7bde47a15fc5ea99c12c0e5d7e68e41cbdfd2e94cd98c5c98d818627
- Pointer size: 131 Bytes
- Size of remote file: 115 kB
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/799e3c2b5af5472a01f15ae7517e3df5ac64d993ff44ca65a9d67578862f4ee1/git_end.jsonAdded+9
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/8323bd3048438be9c90b663f1bc03ef6fdfd67d10eb123c1fd4930538428fda3/run_rim_bottleneck.pyAdded+342
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/be76fef13d5f58a7199f3952c1f59ce3bf9d1a2ddac09a6773dce39e9f891164/rgbd.pyAdded+202
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d492180a1094ac4aed0a3f59127fe2893d2517506a982dd038ec316b151d57e3/refresh_report.pyAdded+77
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/d61d3b2801f95280a7ef2f088ad6d5ccc9a98c6873ac20eb6a3337ade2ccc057/implementation.patchAdded+1244
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/daebf8834d2c0d4ca7f95e927c87ed3d6c7fc3777909a49504e265443585d60b/sampling_evaluation.pyAdded+248
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/e9ecf5d8d4fb140242063c341711cff787d14dada2cb362f50706def372b7a26/run_priority_fps_seed_control.pyAdded+611
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f41905efd42b375f74da5baaac770ade914df21f192bda3a6182792edae68f3b/run_priority_fps_trace.pyAdded+304
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/f55bf1adddc81f3e56c2dfbad787980cd5ae5edc7dd4a019eb2a234f99dff1ee/git_start.jsonAdded
visual/f36f1e9e2bb64866b8d6c792db158635/artifacts/reports/fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496/shared_initial_coverage.pngAdded

Large File Pointer Details
- SHA256: fe811765384d2767fb1a48dce9a1ddfa9d9a489ab25ff47b12806a9a3fc47496
- Pointer size: 130 Bytes
- Size of remote file: 76.7 kB
visual/f36f1e9e2bb64866b8d6c792db158635/manifests/644857c758c7c31d539cbb79e1ecfdcf24067e1df556582dba38843fc116213c/manifest.jsonAdded+209