@camstack/addon-pipeline 1.2.294 → 1.2.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_MODELS.md +241 -0
- package/dist/audio-analyzer/index.js +2 -2
- package/dist/audio-analyzer/index.mjs +2 -2
- package/dist/{default-detection-model-0dPKRKUD.mjs → default-detection-model-Co578D8C.mjs} +181 -99
- package/dist/{default-detection-model-D24AJOTn.js → default-detection-model-D1daTtqT.js} +181 -99
- package/dist/detection-pipeline/index.js +1301 -531
- package/dist/detection-pipeline/index.mjs +1301 -531
- package/dist/{dist-CJR259Xf.js → dist-8up-f2TX.js} +3688 -2698
- package/dist/{dist-RXbmRAwP.mjs → dist-CCd0Q3nr.mjs} +3676 -2698
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/{node-atmRSHPk.mjs → node-DgMSXSWP.mjs} +1 -1
- package/dist/{node-DWg9zbY1.js → node-lpQgHes9.js} +1 -1
- package/dist/pipeline-runner/index.js +975 -270
- package/dist/pipeline-runner/index.mjs +975 -270
- package/dist/{process-memory-BJUXvTjd.js → process-memory-CX_92V_r.js} +1 -1
- package/dist/{process-memory-BgFOHFnx.mjs → process-memory-DFC_O5zE.mjs} +1 -1
- package/dist/recorder/index.js +14 -6
- package/dist/recorder/index.mjs +14 -6
- package/dist/{segment-demux-js-C_fPJub3.js → segment-demux-js-DzBx6NN2.js} +1 -1
- package/dist/{segment-demux-js-G7wFpHzn.mjs → segment-demux-js-FZbBuk3F.mjs} +1 -1
- package/dist/session-decode/{decode-worker-child.js → decode-worker-main.js} +481 -72
- package/dist/session-decode/{decode-worker-child.mjs → decode-worker-main.mjs} +482 -71
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-6IyM-BIn.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C_i7oFBl.mjs} +2 -2
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DUGQKsKL.mjs +26 -0
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CkbplMHA.mjs +26 -0
- package/dist/stream-broker/demux-worker-child.js +1 -1
- package/dist/stream-broker/demux-worker-child.mjs +1 -1
- package/dist/stream-broker/{hostInit-BBYHWS3M.mjs → hostInit-BPtppL3W.mjs} +2 -2
- package/dist/stream-broker/index.js +4 -4
- package/dist/stream-broker/index.mjs +4 -4
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/{worker-protocol-B2MfQLlu.js → worker-protocol-C-G8qmye.js} +3 -1
- package/dist/{worker-protocol-C_W-P_g-.mjs → worker-protocol-D_NzPcnh.mjs} +3 -1
- package/package.json +3 -2
- package/python/inference_pool.py +422 -64
- package/python/postprocessors/__init__.py +2 -0
- package/python/postprocessors/ssd.py +73 -17
- package/python/postprocessors/test_ssd.py +205 -0
- package/python/postprocessors/test_yunet.py +292 -0
- package/python/postprocessors/testdata/ssdlite_mobiledet_outputs.json +1 -0
- package/python/postprocessors/yunet.py +275 -0
- package/python/test_inference_pool_compile_off_loop.py +414 -0
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-6IHzlLJ_.mjs +0 -26
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DoyA71_q.mjs +0 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"_provenance":"Raw output tensors of google-coral/test_data ssdlite_mobiledet_coco_qat_postprocess.tflite (sha256 32c486140391eb4dc43fca7113ad392be632dc5366687f2731f73d740678693f; the CPU build of the same QAT graph as ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite, whose four outputs have the identical names, shapes and dtypes), captured 2026-09-26 on ai-edge-litert 2.1.3 through inference_pool.py's edgetpu load/preprocess/predict path with a CPU interpreter, letterbox 320. Frames are COCO val2017 images; only the model's numeric outputs are stored here, never the pixels.","frames":{"coco_val2017_000000039769_two_cats":{"orig":[640,480],"scale":0.5,"pad":[0,40],"outputs":{"0":[[[0.15955263376235962,0.534464955329895,0.713003933429718,0.9716978073120117],[0.2043571174144745,0.02350570261478424,0.8648291826248169,0.5011452436447144],[0.10257476568222046,0.014032959938049316,0.9505413174629211,0.996590256690979],[0.22124464809894562,0.04488908499479294,0.3162550926208496,0.29261064529418945],[0.03658798336982727,0.012482762336730957,0.40508130192756653,0.987517237663269],[0.1555221676826477,0.6529091000556946,0.8028101325035095,1.006462574005127],[0.24686561524868011,0.5220372080802917,0.4193393588066101,0.5692116618156433],[0.2072891891002655,0.1583276093006134,0.3572945296764374,0.4583382308483124],[0.23659078776836395,0.5290685892105103,0.42224830389022827,0.5870484113693237],[0.5743775367736816,0.23019926249980927,0.6594175100326538,0.34779107570648193],[0.3052724301815033,0.24310186505317688,0.9099631309509277,0.9973288774490356],[0.11994627118110657,0.3792511224746704,0.5946398973464966,0.9894982576370239],[0.2084560990333557,0.2897113263607025,0.3498774766921997,0.4769533574581146],[0.048862308263778687,-0.024405688047409058,0.8030894994735718,0.6076090335845947],[0.47406071424484253,0.039728641510009766,0.8791598677635193,0.9857875108718872],[0.20506274700164795,0.006122678518295288,0.3345203399658203,0.26888036727905273],[0.21482816338539124,0.2670758366584778,0.4976709187030792,0.48709094524383545],[0.17930985987186432,0.5188078880310059,0.6031879782676697,0.87400221824646],[0.5569137930870056,0.8219212889671326,0.6033983826637268,0.91482013463974],[0.5594297051429749,0.06481415033340454,0.6947370171546936,0.3435206711292267],[0.2410658895969391,0.526638925075531,0.3487098515033722,0.5821121335029602],[0.24299399554729462,0.8754947781562805,0.3305767774581909,0.9966028332710266],[0.09360367059707642,-0.027666032314300537,0.4855625033378601,0.7005844712257385],[0.21883206069469452,0.37879708409309387,0.3296947479248047,0.46383705735206604],[0.2706087529659271,0.8736841082572937,0.34845462441444397,0.9984135031700134],[0.23773013055324554,0.5050985217094421,0.5164366364479065,0.5824022889137268],[0.8736730217933655,0.004488527774810791,1.0054889917373657,0.9902228713035583],[0.23501813411712646,0.1322900503873825,0.3002501130104065,0.2705683708190918],[0.2720530033111572,0.9462981820106506,0.35584938526153564,0.9963359236717224],[0.247519388794899,0.944722592830658,0.3231050968170166,0.9993845820426941],[0.38305434584617615,0.378726065158844,0.47873106598854065,0.49631792306900024],[0.5535222291946411,0.7801342010498047,0.7023705244064331,0.8831243515014648],[0.7894991040229797,0.03270852565765381,0.9892374873161316,0.9928076267242432],[0.20900268852710724,0.05372738838195801,0.29099857807159424,0.3962726294994354],[0.2068709284067154,0.006370965391397476,0.3372364044189453,0.0244777649641037],[0.23342448472976685,-0.01042163372039795,0.3790746331214905,0.2895890474319458],[0.22075217962265015,0.22743815183639526,0.8087112307548523,0.824122965335846],[0.5976130962371826,0.05392265319824219,0.9607176780700684,0.9731613397598267],[0.11443797498941422,0.7428056597709656,0.24389559030532837,0.9905272126197815],[0.22740966081619263,0.4848347008228302,0.4475909471511841,0.5901657938957214],[0.21618488430976868,0.5098341703414917,0.44631537795066833,0.6151652336120605],[0.8084112405776978,0.0015302002429962158,0.9273114204406738,0.9038747549057007],[-0.003454655408859253,0.01914122700691223,0.29720693826675415,0.9142001867294312],[0.23717385530471802,0.4077231287956238,0.6862777471542358,1.043309211730957],[0.40243661403656006,0.4213453233242035,0.46671468019485474,0.49919119477272034],[0.038508474826812744,0.13357895612716675,0.5688574910163879,0.814859926700592],[0.2079186886548996,0.4072537422180176,0.25239354372024536,0.45305848121643066],[0.18039143085479736,0.7189949750900269,0.346691370010376,1.0018376111984253],[0.17740964889526367,0.8574067950248718,0.3975909352302551,0.9967599511146545],[0.30818599462509155,0.000822313129901886,0.6126490831375122,0.1720949113368988],[0.06299805641174316,0.032074540853500366,0.2399788498878479,0.8108158111572266],[0.13213692605495453,0.5332436561584473,0.41890597343444824,0.9667563438415527],[0.3001849353313446,0.8360094428062439,0.5748157501220703,1.0098237991333008],[0.46447721123695374,0.7584561109542847,0.6980230808258057,0.8998774290084839],[0.22825893759727478,0.5397037863731384,0.7288434505462646,0.8317379355430603],[0.21569259464740753,0.8997492790222168,0.2564050257205963,0.9679288864135742],[0.25803816318511963,0.4330609440803528,0.3111131191253662,0.4992610216140747],[0.22732794284820557,0.3999912738800049,0.4643397331237793,0.5687592029571533],[0.23802617192268372,0.5667713284492493,0.42239078879356384,0.8623947501182556],[0.34699746966362,0.2612840533256531,0.488418847322464,0.5053830146789551],[0.5587438941001892,0.22770456969738007,0.6354513764381409,0.34881260991096497],[0.5473014116287231,0.6006264090538025,0.6144839525222778,0.6729443669319153],[0.5691072940826416,0.5631829500198364,0.6691073179244995,0.6897634267807007],[0.197118878364563,0.5749090313911438,0.5393403768539429,1.0084216594696045],[0.2407025694847107,0.4220343232154846,0.41971439123153687,0.648799479007721],[0.43011459708213806,0.42714160680770874,0.49631467461586,0.4729463458061218],[0.5331307053565979,0.7939615845680237,0.61097651720047,0.8855019211769104],[0.2184237539768219,0.7220790386199951,0.6754136085510254,1.0115272998809814],[0.23764437437057495,0.8479610085487366,0.8712865710258484,0.9984578490257263],[0.12035168707370758,0.8447889089584351,0.35048216581344604,0.9947942495346069],[0.21286840736865997,0.9534194469451904,0.26364877820014954,0.9906877279281616],[0.23123027384281158,0.04802142083644867,0.31140387058258057,0.12702254951000214],[0.5154188871383667,0.7573367357254028,0.6169029474258423,0.8059217929840088],[0.697390079498291,0.05803816393017769,0.8673416376113892,0.11111311614513397],[0.22868293523788452,0.3173567056655884,0.32868295907974243,0.45768725872039795],[0.24360230565071106,0.01714465767145157,0.5480654239654541,0.2307719588279724],[0.2897666394710541,0.5481002926826477,0.4560665786266327,0.839400589466095],[0.37094348669052124,0.7636645436286926,0.6415581107139587,0.9050858616828918],[0.46699267625808716,0.5482616424560547,0.6871740221977234,0.7246556282043457],[0.27251920104026794,0.03307163715362549,0.827480673789978,0.32943978905677795],[0.03661632537841797,0.2884189486503601,0.7459261417388916,1.0189385414123535],[0.05953405797481537,0.8303914070129395,0.2862992286682129,0.9966913461685181],[0.17441785335540771,0.2090485841035843,0.27974894642829895,0.5367846488952637],[0.18664157390594482,0.5720193386077881,0.35294151306152344,0.919648289680481],[0.19373293220996857,-0.003133825957775116,0.531268835067749,0.1656341254711151],[0.27887362241744995,0.9335945248603821,0.658628523349762,0.9955716729164124],[0.32571566104888916,0.0015931539237499237,0.6534517407417297,0.07340744137763977],[0.4985097050666809,0.058443158864974976,0.6723241209983826,0.32905781269073486],[0.5864514112472534,0.15539874136447906,0.6753339767456055,0.29165494441986084],[0.5612818598747253,0.6305587291717529,0.6754595637321472,0.719441294670105],[0.513027012348175,0.5583153367042542,0.7057222723960876,0.8958513140678406],[0.004697104915976524,-0.005696093663573265,0.040883369743824005,0.03212530165910721],[0.20103901624679565,0.33512550592422485,0.35104435682296753,0.5940406918525696],[0.20186400413513184,0.4540380537509918,0.37313663959503174,0.716795802116394],[0.22820225358009338,0.3030018210411072,0.40721407532691956,0.5136640667915344],[0.43144962191581726,0.2230268269777298,0.6185503005981445,0.4936414361000061],[0.48286062479019165,0.7618263959884644,0.6039686799049377,0.8043785095214844],[0.5385960936546326,0.6290205121040344,0.6187697052955627,0.7091941237449646],[0.4680514335632324,0.7121118903160095,0.7194494009017944,0.871222198009491],[0.6098172664642334,-0.0005137994885444641,0.7401827573776245,0.04462110251188278]]],"1":[[16.0,16.0,64.0,74.0,62.0,16.0,74.0,16.0,43.0,73.0,64.0,16.0,16.0,62.0,64.0,83.0,16.0,16.0,84.0,16.0,74.0,74.0,62.0,16.0,74.0,74.0,64.0,83.0,74.0,74.0,74.0,84.0,64.0,74.0,83.0,83.0,16.0,64.0,0.0,74.0,74.0,64.0,62.0,16.0,74.0,62.0,74.0,31.0,74.0,83.0,62.0,16.0,0.0,58.0,16.0,74.0,74.0,16.0,16.0,16.0,73.0,76.0,76.0,16.0,74.0,74.0,84.0,16.0,64.0,0.0,74.0,83.0,84.0,74.0,16.0,83.0,16.0,83.0,39.0,16.0,62.0,0.0,16.0,16.0,83.0,0.0,83.0,16.0,74.0,84.0,30.0,0.0,16.0,74.0,16.0,73.0,76.0,84.0,31.0,83.0]],"2":[[0.76953125,0.76953125,0.5234375,0.39453125,0.30078125,0.24609375,0.23828125,0.19140625,0.18359375,0.17578125,0.1640625,0.15234375,0.14453125,0.14453125,0.140625,0.1328125,0.1328125,0.125,0.11328125,0.11328125,0.109375,0.109375,0.109375,0.10546875,0.10546875,0.10546875,0.10546875,0.1015625,0.1015625,0.09765625,0.09765625,0.09765625,0.09765625,0.08984375,0.08984375,0.08984375,0.0859375,0.0859375,0.08203125,0.08203125,0.08203125,0.08203125,0.08203125,0.08203125,0.078125,0.078125,0.07421875,0.07421875,0.07421875,0.07421875,0.07421875,0.07421875,0.0703125,0.0703125,0.0703125,0.06640625,0.06640625,0.06640625,0.06640625,0.06640625,0.06640625,0.06640625,0.06640625,0.06640625,0.0625,0.0625,0.0625,0.0625,0.0625,0.05859375,0.05859375,0.05859375,0.05859375,0.05859375,0.0546875,0.0546875,0.0546875,0.0546875,0.0546875,0.0546875,0.0546875,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.05078125,0.046875,0.046875,0.046875,0.046875,0.046875,0.046875,0.046875,0.046875,0.046875]],"3":[100.0]}},"coco_val2017_000000252219_street":{"orig":[640,428],"scale":0.5,"pad":[0,53],"outputs":{"0":[[[0.4162486791610718,0.024550773203372955,0.7795857191085815,0.1983652412891388],[0.4350929260253906,0.5026833415031433,0.7440744638442993,0.6160659193992615],[0.4274504780769348,0.8110100030899048,0.760050356388092,0.9848244190216064],[0.5311018228530884,0.3237488269805908,0.7480632066726685,0.5054173469543457],[0.6483170986175537,0.6389470100402832,0.7928438186645508,0.7346237897872925],[0.5338170528411865,0.3173767626285553,0.6368073225021362,0.3987402021884918],[0.4912804067134857,0.9553788900375366,0.6911295056343079,1.0005137920379639],[0.30877313017845154,0.8685252070426941,0.41176334023475647,1.0109384059906006],[0.28655675053596497,0.8688049912452698,0.5342783331871033,1.0041122436523438],[0.5341765880584717,0.30358779430389404,0.6143501996994019,0.3802952766418457],[0.24573861062526703,0.535965085029602,0.3307785391807556,0.599303126335144],[0.4633682072162628,0.9736822247505188,0.6661832332611084,0.9969421029090881],[0.5260692834854126,0.38162389397621155,0.6489746570587158,0.48016151785850525],[0.7162842154502869,0.5424903035163879,0.7484474778175354,0.6030901074409485],[0.3242916762828827,0.9250457882881165,0.40213754773139954,0.9984369874000549],[0.5646662712097168,0.32681071758270264,0.6617629528045654,0.4069843292236328],[0.43745797872543335,0.8556292653083801,0.506649374961853,0.8928975462913513],[0.5453707575798035,0.9623616933822632,0.6898974776268005,0.9964772462844849],[0.3656116724014282,0.9378393292427063,0.6885550022125244,0.9913268685340881],[0.6316292881965637,0.35618144273757935,0.7316293120384216,0.47908681631088257],[0.299285888671875,0.9094834923744202,0.39638257026672363,1.0051602125167847],[0.5499159693717957,0.13722729682922363,0.5882986187934875,0.20540684461593628],[0.5260947346687317,0.3105463683605194,0.6739063858985901,0.4977883994579315],[0.5227016806602478,0.9099226593971252,0.6287714838981628,0.9592286944389343],[0.5940675735473633,0.3829779624938965,0.6574056148529053,0.46554887294769287],[0.4623275697231293,0.8369593620300293,0.4979846775531769,0.8631285429000854],[0.5491682291030884,0.47726282477378845,0.62587571144104,0.5139861106872559],[0.2056179791688919,0.4550957679748535,0.2488015741109848,0.5022701621055603],[0.21111512184143066,0.5228007435798645,0.24625077843666077,0.552243173122406],[0.5356869101524353,0.49689340591430664,0.6069472432136536,0.5310089588165283],[0.5498236417770386,0.4632295072078705,0.7031227350234985,0.511814534664154],[0.46009230613708496,0.7904802560806274,0.7690738439559937,0.9199378490447998],[0.5481249690055847,0.4862275719642639,0.7283921837806702,0.5313624739646912],[0.5189509391784668,0.02130730450153351,0.7701113224029541,0.44223350286483765],[0.6050348877906799,0.9128004312515259,0.6596968770027161,0.966663122177124],[0.4300398528575897,0.8400573134422302,0.4641554057598114,0.8629769682884216],[0.3168220520019531,0.9083377122879028,0.6748456954956055,0.9979112148284912],[0.5227682590484619,0.8477926850318909,0.6257585287094116,0.913992702960968],[0.7170714735984802,0.3222942352294922,0.7432406544685364,0.360115647315979],[0.49940651655197144,0.5581434369087219,0.5609056353569031,0.6006955504417419],[0.48628464341163635,0.40381699800491333,0.730383574962616,0.5295159816741943],[0.5414602756500244,0.5834677815437317,0.6011738777160645,0.6092543005943298],[0.7611274719238281,0.0054911356419324875,0.8006578683853149,0.03861616551876068],[0.5396264791488647,0.10698680579662323,0.760373592376709,0.5930132269859314],[0.17262639105319977,0.8333241939544678,0.4315415620803833,1.0020921230316162],[0.48002371191978455,0.8558622598648071,0.5729225873947144,0.9073963165283203],[0.5417873859405518,0.05324568599462509,0.6141053438186646,0.11295924335718155],[0.5150630474090576,0.8205909729003906,0.6275711059570312,0.8500334024429321],[0.5987178683280945,0.4551270604133606,0.7453894019126892,0.5037120580673218],[0.23898977041244507,0.5919873118400574,0.33752739429473877,0.6653785109519958],[0.2905657887458801,0.5573469996452332,0.3343902826309204,0.6073847413063049],[0.41652873158454895,0.8505421876907349,0.4688275158405304,0.8861992359161377],[0.4871012568473816,0.10838092118501663,0.5746840834617615,0.1622435450553894],[0.5822117328643799,0.850226879119873,0.6545296907424927,0.914504885673523],[0.6951959729194641,0.34702178835868835,0.737125813961029,0.4853001534938812],[0.5352706909179688,0.10564260184764862,0.6014707088470459,0.17087455093860626],[0.6321781277656555,0.9626111388206482,0.6927779316902161,0.9962278008460999],[0.7240806818008423,0.4945259094238281,0.7494900226593018,0.5657862424850464],[0.7278625965118408,0.6477597951889038,0.7912006378173828,0.699293851852417],[0.44048047065734863,0.9741995334625244,0.5787588357925415,0.9905321598052979],[0.5262652635574341,0.526103138923645,0.5561445951461792,0.550413966178894],[0.5032247304916382,0.8301358819007874,0.5570874214172363,0.8566934466362],[0.5438975691795349,0.31178784370422363,0.688424289226532,0.37798792123794556],[0.741370677947998,0.0036882534623146057,0.7968438863754272,0.1787216067314148],[0.26776328682899475,0.8388197422027588,0.4030705988407135,1.0153470039367676],[0.4859636723995209,0.8949870467185974,0.5802412629127502,0.956486165523529],[0.6024523973464966,0.49162277579307556,0.7387086153030396,0.5348063707351685],[0.5774096250534058,0.6351754665374756,0.797590970993042,0.762739896774292],[0.2301507294178009,0.5263333320617676,0.3286883533000946,0.5708081722259521],[0.2292805016040802,0.6279017925262451,0.3369244635105133,0.6867420673370361],[0.5606799125671387,0.027291707694530487,0.5996322631835938,0.05806448310613632],[0.5880016088485718,0.5785675644874573,0.6782033443450928,0.6112081408500671],[0.718255341053009,0.01484508067369461,0.7508959174156189,0.13957443833351135],[0.7315396666526794,0.8035227060317993,0.7597091794013977,0.837638258934021],[0.2944031357765198,0.809653639793396,0.453513503074646,0.9861807823181152],[0.6220482587814331,0.33179566264152527,0.7205859422683716,0.4476678669452667],[0.42942866683006287,0.7300208806991577,0.7904558181762695,1.0069555044174194],[0.44813793897628784,0.14109531044960022,0.46520859003067017,0.15604627132415771],[0.5543093681335449,0.5982905626296997,0.6266273260116577,0.6222459077835083],[0.4242232143878937,0.5523462295532227,0.7424439191818237,0.6393190622329712],[0.5669523477554321,0.5963963866233826,0.6992526054382324,0.6285596489906311],[0.21041908860206604,0.4460771381855011,0.34374770522117615,0.683089017868042],[0.5402801036834717,0.27855896949768066,0.7388873100280762,0.4006084203720093],[0.5964339971542358,0.8200300335884094,0.6535660028457642,0.8447017073631287],[0.2541125416755676,0.4373975098133087,0.3120924234390259,0.5199684500694275],[0.5770773887634277,0.04363440349698067,0.6699762344360352,0.12993639707565308],[0.7549723386764526,0.26059067249298096,0.7994471788406372,0.3144533038139343],[0.39701393246650696,0.9599695801734924,0.46035197377204895,0.9885571599006653],[0.5154039859771729,0.14906154572963715,0.5684789419174194,0.20535801351070404],[0.5914602875709534,0.08590969443321228,0.6511738896369934,0.16261713206768036],[0.6257311701774597,0.5529274940490723,0.7242688536643982,0.602965235710144],[0.7689149975776672,0.748873770236969,0.7928703427314758,0.7981798052787781],[0.212331622838974,0.4396534562110901,0.24356108903884888,0.46190768480300903],[0.5010358691215515,0.03401685133576393,0.5607494711875916,0.046919818967580795],[0.5261155366897583,0.33853837847709656,0.5592405796051025,0.390837162733078],[0.43047335743904114,0.00413740798830986,0.7486940622329712,0.07919672131538391],[0.5710752606391907,0.0036823004484176636,0.6921833157539368,0.06252261996269226],[0.6423197388648987,0.6038827300071716,0.8014300465583801,0.7752847075462341],[0.5016130208969116,0.3145033121109009,0.7622942924499512,0.5751845240592957],[0.497750461101532,0.720516562461853,0.561088502407074,0.7368491888046265]]],"1":[[0.0,0.0,0.0,61.0,32.0,26.0,0.0,27.0,27.0,26.0,0.0,0.0,26.0,40.0,27.0,26.0,0.0,30.0,0.0,61.0,27.0,30.0,26.0,30.0,26.0,0.0,26.0,0.0,0.0,30.0,61.0,0.0,61.0,14.0,30.0,0.0,0.0,30.0,36.0,30.0,0.0,30.0,40.0,14.0,27.0,26.0,30.0,30.0,61.0,71.0,0.0,0.0,26.0,30.0,61.0,30.0,32.0,40.0,40.0,0.0,30.0,30.0,26.0,40.0,27.0,30.0,61.0,32.0,0.0,61.0,0.0,61.0,40.0,36.0,27.0,61.0,0.0,76.0,30.0,0.0,61.0,71.0,0.0,30.0,83.0,30.0,36.0,27.0,42.0,30.0,40.0,40.0,0.0,0.0,26.0,0.0,14.0,32.0,14.0,0.0]],"2":[[0.76953125,0.76953125,0.76953125,0.55859375,0.46484375,0.453125,0.453125,0.39453125,0.375,0.36328125,0.3515625,0.34375,0.33203125,0.33203125,0.3203125,0.30078125,0.28125,0.28125,0.2734375,0.2734375,0.24609375,0.24609375,0.24609375,0.24609375,0.24609375,0.23828125,0.23828125,0.23046875,0.23046875,0.22265625,0.22265625,0.22265625,0.21484375,0.21484375,0.20703125,0.19921875,0.19921875,0.19921875,0.19921875,0.19140625,0.19140625,0.19140625,0.19140625,0.19140625,0.18359375,0.18359375,0.18359375,0.18359375,0.18359375,0.17578125,0.17578125,0.17578125,0.17578125,0.17578125,0.16796875,0.1640625,0.1640625,0.1640625,0.1640625,0.15625,0.15625,0.15625,0.15625,0.15625,0.15234375,0.15234375,0.15234375,0.15234375,0.14453125,0.14453125,0.14453125,0.14453125,0.14453125,0.14453125,0.140625,0.140625,0.140625,0.1328125,0.1328125,0.1328125,0.1328125,0.12890625,0.12890625,0.12890625,0.125,0.125,0.125,0.1171875,0.1171875,0.1171875,0.1171875,0.1171875,0.11328125,0.11328125,0.11328125,0.11328125,0.11328125,0.11328125,0.11328125,0.109375]],"3":[100.0]}}}}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"""YuNet face detection postprocessor (OpenCV Zoo `face_detection_yunet`, 2023mar).
|
|
2
|
+
|
|
3
|
+
Used by the `yunet-2023mar` catalog entry on the `face-detection` step through a
|
|
4
|
+
per-MODEL `postprocessor: 'yunet'` override (the step default stays `scrfd`).
|
|
5
|
+
|
|
6
|
+
Model contract, as published by `scripts/build-yunet-model.py`:
|
|
7
|
+
|
|
8
|
+
input "image" [1, 3, 640, 640] RGB float in [0,1] — the pool's plain
|
|
9
|
+
`/255` tensor. Upstream YuNet wants BGR
|
|
10
|
+
0..255; `Mul(255)` + `Gather([2,1,0])`
|
|
11
|
+
are BAKED into the graph ahead of the
|
|
12
|
+
first Conv, identically in all three
|
|
13
|
+
formats, so no pool normalisation runs
|
|
14
|
+
(the entry declares none).
|
|
15
|
+
outputs cls_{8,16,32} [1, N, 1] classification probability
|
|
16
|
+
obj_{8,16,32} [1, N, 1] objectness probability
|
|
17
|
+
bbox_{8,16,32} [1, N, 4] (dx, dy, log w, log h), stride units
|
|
18
|
+
kps_{8,16,32} [1, N, 10] 5 × (dx, dy), stride units
|
|
19
|
+
|
|
20
|
+
Why it cannot share `scrfd.py` (measured 2026-09-26: the SCRFD decoder finds 0
|
|
21
|
+
faces on 413 person crops with YuNet's outputs):
|
|
22
|
+
|
|
23
|
+
1. ONE prior per grid cell, not two; anchor-free — the prior is the cell's
|
|
24
|
+
top-left corner, `(col, row) * stride`, row-major, `N = ceil(640/s)^2`.
|
|
25
|
+
2. The box is centre + size, with `exp()` on width and height — SCRFD's is four
|
|
26
|
+
distances from the anchor.
|
|
27
|
+
3. The score is `sqrt(cls * obj)` over TWO tensors, both clamped to [0,1].
|
|
28
|
+
|
|
29
|
+
This is a port of OpenCV's `FaceDetectorYN::postProcess`
|
|
30
|
+
(`modules/objdetect/src/face_detect.cpp`).
|
|
31
|
+
|
|
32
|
+
Landmarks come out in YuNet's order — right eye, left eye, nose tip, right
|
|
33
|
+
mouth corner, left mouth corner, where right/left are the SUBJECT'S. That is
|
|
34
|
+
image-left eye first, the same order SCRFD emits and `face-align.ts` expects
|
|
35
|
+
(ARCFACE_TEMPLATE_112), so they are passed through unchanged. Measured on 196
|
|
36
|
+
COCO faces: index 0 is the image-left eye except on 3 profile faces, the same
|
|
37
|
+
rate as SCRFD's 2.
|
|
38
|
+
|
|
39
|
+
The per-candidate arithmetic (`prior_cell`, `decode_prior`, `to_source`, `nms`)
|
|
40
|
+
is plain Python so the layout, decode and landmark-order tests run on CI's bare
|
|
41
|
+
interpreter; numpy only vectorises the score threshold over the 8400 priors.
|
|
42
|
+
|
|
43
|
+
Output matches the scrfd postprocessor:
|
|
44
|
+
``{"kind": "detections", "detections": [{"class": "face", "score", "bbox": [x1,y1,x2,y2], "landmarks"}]}``
|
|
45
|
+
in ORIGINAL (pre-letterbox) pixel coordinates.
|
|
46
|
+
"""
|
|
47
|
+
from __future__ import annotations
|
|
48
|
+
|
|
49
|
+
import math
|
|
50
|
+
import sys
|
|
51
|
+
import time
|
|
52
|
+
|
|
53
|
+
import numpy as np
|
|
54
|
+
|
|
55
|
+
STRIDES: tuple[int, ...] = (8, 16, 32)
|
|
56
|
+
NUM_LANDMARKS = 5
|
|
57
|
+
DEFAULT_NMS_IOU = 0.45
|
|
58
|
+
|
|
59
|
+
# At most this many candidates, best first, reach the NMS. OpenCV's
|
|
60
|
+
# FaceDetectorYN caps at 5000 (`top_k`), but its NMS is C++; `nms` below is
|
|
61
|
+
# pure Python and O(n·kept), measured on this Mac at 28 ms for 500 disjoint
|
|
62
|
+
# candidates, 113 ms for 1000 and 2.8 s for 5000 — an unbounded frame (every
|
|
63
|
+
# prior passing a low floor: 8400) would hold a pool worker for ~8 s. Real
|
|
64
|
+
# frames are far below the cap: on the spike's 413 person crops the most
|
|
65
|
+
# candidates any frame produced was 38 at the step's 0.5 floor and 110 at 0.1.
|
|
66
|
+
TOP_K = 750
|
|
67
|
+
# A frame that hits the cap is reported, at most once per this interval, on
|
|
68
|
+
# stderr (the pool's log): dropped work is never silent, and a pathological
|
|
69
|
+
# model/threshold must not flood the log either.
|
|
70
|
+
TOP_K_LOG_INTERVAL_S = 60.0
|
|
71
|
+
_last_top_k_log = 0.0
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def grid_cols(stride: int, input_size: int) -> int:
|
|
75
|
+
"""Priors per row (and per column — the input is square) at `stride`."""
|
|
76
|
+
return int(math.ceil(input_size / stride))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def prior_cell(index: int, cols: int) -> tuple[int, int]:
|
|
80
|
+
"""`(row, col)` of prior `index` — row-major, one prior per cell."""
|
|
81
|
+
return divmod(index, cols)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def score_of(cls: float, obj: float) -> float:
|
|
85
|
+
"""YuNet's score: geometric mean of the two probabilities, each clamped."""
|
|
86
|
+
return math.sqrt(min(max(cls, 0.0), 1.0) * min(max(obj, 0.0), 1.0))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def decode_prior(
|
|
90
|
+
stride: int,
|
|
91
|
+
row: int,
|
|
92
|
+
col: int,
|
|
93
|
+
bbox: "list[float] | tuple[float, ...]",
|
|
94
|
+
kps: "list[float] | tuple[float, ...]",
|
|
95
|
+
) -> tuple[tuple[float, float, float, float], list[tuple[float, float]]]:
|
|
96
|
+
"""One prior → `(x1, y1, x2, y2)` and 5 landmark points, in NETWORK space."""
|
|
97
|
+
cx = (col + bbox[0]) * stride
|
|
98
|
+
cy = (row + bbox[1]) * stride
|
|
99
|
+
w = math.exp(bbox[2]) * stride
|
|
100
|
+
h = math.exp(bbox[3]) * stride
|
|
101
|
+
box = (cx - w / 2.0, cy - h / 2.0, cx + w / 2.0, cy + h / 2.0)
|
|
102
|
+
points = [
|
|
103
|
+
((kps[2 * p] + col) * stride, (kps[2 * p + 1] + row) * stride)
|
|
104
|
+
for p in range(NUM_LANDMARKS)
|
|
105
|
+
]
|
|
106
|
+
return box, points
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def to_source(x: float, y: float, scale: float, pad: tuple[int, int]) -> tuple[float, float]:
|
|
110
|
+
"""Undo the pool's letterbox: network pixels → original frame pixels."""
|
|
111
|
+
return (x - pad[0]) / scale, (y - pad[1]) / scale
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _iou(a: tuple, b: tuple) -> float:
|
|
115
|
+
ix = max(0.0, min(a[2], b[2]) - max(a[0], b[0]))
|
|
116
|
+
iy = max(0.0, min(a[3], b[3]) - max(a[1], b[1]))
|
|
117
|
+
inter = ix * iy
|
|
118
|
+
if inter == 0:
|
|
119
|
+
return 0.0
|
|
120
|
+
union = (a[2] - a[0]) * (a[3] - a[1]) + (b[2] - b[0]) * (b[3] - b[1]) - inter
|
|
121
|
+
return inter / union if union > 0 else 0.0
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def cap_top_k(candidates: list[dict], k: int = TOP_K) -> tuple[list[dict], int]:
|
|
125
|
+
"""The `k` best candidates by score, and how many were dropped."""
|
|
126
|
+
if len(candidates) <= k:
|
|
127
|
+
return candidates, 0
|
|
128
|
+
best = sorted(candidates, key=lambda c: c["score"], reverse=True)
|
|
129
|
+
return best[:k], len(candidates) - k
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _log_top_k_drop(dropped: int, total: int) -> None:
|
|
133
|
+
global _last_top_k_log
|
|
134
|
+
now = time.monotonic()
|
|
135
|
+
if now - _last_top_k_log < TOP_K_LOG_INTERVAL_S:
|
|
136
|
+
return
|
|
137
|
+
_last_top_k_log = now
|
|
138
|
+
sys.stderr.write(
|
|
139
|
+
f"yunet: {total} candidates above the confidence floor, kept the best {TOP_K} "
|
|
140
|
+
f"for NMS and dropped {dropped} (logged at most once per "
|
|
141
|
+
f"{TOP_K_LOG_INTERVAL_S:.0f}s)\n"
|
|
142
|
+
)
|
|
143
|
+
sys.stderr.flush()
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def nms(candidates: list[dict], iou_threshold: float) -> list[dict]:
|
|
147
|
+
"""Greedy NMS on `_xyxy`, highest score first."""
|
|
148
|
+
kept: list[dict] = []
|
|
149
|
+
for cand in sorted(candidates, key=lambda c: c["score"], reverse=True):
|
|
150
|
+
if all(_iou(cand["_xyxy"], k["_xyxy"]) <= iou_threshold for k in kept):
|
|
151
|
+
kept.append(cand)
|
|
152
|
+
return kept
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
_OUTPUT_WIDTHS: tuple[tuple[str, int], ...] = (
|
|
156
|
+
("cls", 1), ("obj", 1), ("bbox", 4), ("kps", 2 * NUM_LANDMARKS),
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def missing_outputs(output_names) -> list[str]:
|
|
161
|
+
"""The named outputs this decoder needs that the model did not produce.
|
|
162
|
+
|
|
163
|
+
Matched by NAME only, with no shape fallback: `cls_*` and `obj_*` have
|
|
164
|
+
identical shapes, so a fallback could only guess. Every published format
|
|
165
|
+
names its outputs (the CoreML conversion names them explicitly, the
|
|
166
|
+
OpenVINO IR has its internal aliases cleared)."""
|
|
167
|
+
present = set(output_names)
|
|
168
|
+
return [
|
|
169
|
+
f"{kind}_{stride}" for stride in STRIDES for kind, _ in _OUTPUT_WIDTHS
|
|
170
|
+
if f"{kind}_{stride}" not in present
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def value_count(value) -> int:
|
|
175
|
+
"""Number of scalars in an ndarray-like (`.size`) or a nested sequence.
|
|
176
|
+
Pure Python, so the size gate below needs no numpy."""
|
|
177
|
+
size = getattr(value, "size", None)
|
|
178
|
+
if isinstance(size, int):
|
|
179
|
+
return size
|
|
180
|
+
if isinstance(value, (list, tuple)):
|
|
181
|
+
return sum(value_count(v) for v in value)
|
|
182
|
+
return 1
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def check_outputs(predictions: dict, input_size: int) -> None:
|
|
186
|
+
"""RAISE unless all twelve outputs are present and sized for `input_size`.
|
|
187
|
+
|
|
188
|
+
Returning `[]` instead would read as "no faces" forever with no line
|
|
189
|
+
saying why — which is exactly what the SCRFD decoder did on this graph. A
|
|
190
|
+
size mismatch means the model's input is not `inputSize` (e.g. a 320
|
|
191
|
+
export under a 640 catalog entry): decoding it would put every prior in the
|
|
192
|
+
wrong cell."""
|
|
193
|
+
missing = missing_outputs(predictions.keys())
|
|
194
|
+
if missing:
|
|
195
|
+
raise ValueError(
|
|
196
|
+
f"yunet: outputs {missing} missing (model outputs: {sorted(predictions)})"
|
|
197
|
+
)
|
|
198
|
+
for stride in STRIDES:
|
|
199
|
+
priors = grid_cols(stride, input_size) ** 2
|
|
200
|
+
for kind, width in _OUTPUT_WIDTHS:
|
|
201
|
+
key = f"{kind}_{stride}"
|
|
202
|
+
got = value_count(predictions[key])
|
|
203
|
+
if got != priors * width:
|
|
204
|
+
raise ValueError(
|
|
205
|
+
f"yunet: output '{key}' has {got} values, expected {priors * width} "
|
|
206
|
+
f"({priors} priors × {width}) — inputSize {input_size} does not match the model"
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _stride_tensors(predictions: dict, stride: int) -> dict:
|
|
211
|
+
"""The four flattened tensors of one stride (sizes already checked)."""
|
|
212
|
+
return {
|
|
213
|
+
kind: np.asarray(predictions[f"{kind}_{stride}"], dtype=np.float32).reshape(-1)
|
|
214
|
+
for kind, _ in _OUTPUT_WIDTHS
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def postprocess_yunet(
|
|
219
|
+
predictions: dict,
|
|
220
|
+
config: dict,
|
|
221
|
+
orig_w: int,
|
|
222
|
+
orig_h: int,
|
|
223
|
+
scale: float,
|
|
224
|
+
pad: tuple[int, int],
|
|
225
|
+
) -> dict:
|
|
226
|
+
"""Postprocess YuNet output to structured face detections."""
|
|
227
|
+
conf_threshold = float(config.get("confidence", 0.5) or 0.5)
|
|
228
|
+
input_size = int(config.get("inputSize", 640))
|
|
229
|
+
nms_iou = float(config.get("nmsIouThreshold", DEFAULT_NMS_IOU))
|
|
230
|
+
|
|
231
|
+
check_outputs(predictions, input_size)
|
|
232
|
+
|
|
233
|
+
candidates: list[dict] = []
|
|
234
|
+
for stride in STRIDES:
|
|
235
|
+
cols = grid_cols(stride, input_size)
|
|
236
|
+
t = _stride_tensors(predictions, stride)
|
|
237
|
+
bbox = t["bbox"].reshape(-1, 4)
|
|
238
|
+
kps = t["kps"].reshape(-1, 2 * NUM_LANDMARKS)
|
|
239
|
+
# numpy only PRE-filters, conservatively: sqrt(cls·obj) <= max(cls, obj),
|
|
240
|
+
# so a prior below the threshold on both tensors cannot pass. The
|
|
241
|
+
# decision itself is `score_of`, per prior.
|
|
242
|
+
maybe = np.flatnonzero(np.maximum(t["cls"], t["obj"]) >= conf_threshold)
|
|
243
|
+
for index in maybe.tolist():
|
|
244
|
+
score = score_of(float(t["cls"][index]), float(t["obj"][index]))
|
|
245
|
+
if score < conf_threshold:
|
|
246
|
+
continue
|
|
247
|
+
row, col = prior_cell(index, cols)
|
|
248
|
+
(x1, y1, x2, y2), points = decode_prior(
|
|
249
|
+
stride, row, col, bbox[index].tolist(), kps[index].tolist()
|
|
250
|
+
)
|
|
251
|
+
sx1, sy1 = to_source(x1, y1, scale, pad)
|
|
252
|
+
sx2, sy2 = to_source(x2, y2, scale, pad)
|
|
253
|
+
ox1, oy1 = max(0.0, min(orig_w, sx1)), max(0.0, min(orig_h, sy1))
|
|
254
|
+
ox2, oy2 = max(0.0, min(orig_w, sx2)), max(0.0, min(orig_h, sy2))
|
|
255
|
+
if (ox2 - ox1) < 1 or (oy2 - oy1) < 1:
|
|
256
|
+
continue
|
|
257
|
+
landmarks = []
|
|
258
|
+
for px, py in points:
|
|
259
|
+
lx, ly = to_source(px, py, scale, pad)
|
|
260
|
+
landmarks.append({"x": round(lx, 1), "y": round(ly, 1)})
|
|
261
|
+
candidates.append({
|
|
262
|
+
"class": "face",
|
|
263
|
+
"score": round(score, 4),
|
|
264
|
+
"bbox": [round(ox1, 1), round(oy1, 1), round(ox2, 1), round(oy2, 1)],
|
|
265
|
+
"landmarks": landmarks,
|
|
266
|
+
"_xyxy": (ox1, oy1, ox2, oy2),
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
capped, dropped = cap_top_k(candidates)
|
|
270
|
+
if dropped:
|
|
271
|
+
_log_top_k_drop(dropped, len(candidates))
|
|
272
|
+
kept = nms(capped, nms_iou)
|
|
273
|
+
for det in kept:
|
|
274
|
+
del det["_xyxy"]
|
|
275
|
+
return {"kind": "detections", "detections": kept}
|