You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Published s3/p4 .espdl models have (N/16)HWC16-packed Conv filters that the C/C++ Conv kernels cannot consume #320
The published per-chip .espdl model files (e.g. models/human_face_detect/models/s3/*.espdl, .../p4/*.espdl) ship their Conv filters pre-packed in the chip's SIMD layout — each weight tensor's doc_string carries the tag layout ==> N16HWC16 / N16HWC16_UNALIGNED (esp-ppq reset_conv_filter_layout: aligned rows as [N/16][H][W][C][16], tail rows in plain order). The generic C/C++ Conv kernels (dl_base_conv2d.cpp, comment "filter in sequence [N, H, W, C]"; depthwise [H][W][C]) read the tensor as a plain array and nothing in the runtime unpacks it.
Consequently any build that takes the C path — IDF_TARGET=linux, or a chip without the PIE/TIE kernels — runs the shipped s3/p4 models with scrambled weights. Inference completes without error but the output is garbage: with v3.2.3 on the Linux target, human_face_detect_msr produces the same saturated score map for every input and a black frame "detects a face" at score 0.531. (Two further C-path defects contributed to that symptom; one is filed separately, one is already fixed on master.)
Present at v3.2.3 (7089b94) and on current master (12c0616).
Expected
Either (a) the runtime unpacks packed filter layouts when the C kernels are selected (keyed on the layout tag, which is already in the file), or (b) the packed-layout assumption is documented and the models directory also provides C-layout (ESPDL_C_* target) exports for the published models, or at least the C path refuses packed tensors loudly instead of computing the wrong function silently.
Reproduction
Build for IDF_TARGET=linux (C kernels).
Load human_face_detect_msr_s8_v1.espdl (s3), feed an all-zero input and a random input — the outputs are statistically identical; score0/score1 are pinned at ±127.
Unpack each 4-D Conv filter in the loader to [N][H][W][C] (group 1) / [H][W][C][N] (depthwise), using the esp-ppq packing rule and the node's group attribute. Every Conv node in MSR, MNP and MFN then matches an independent int8 reference bit-for-bit, and the s3 and p4 variants unpack to byte-identical filters for 233 of 234 parameters.
The unpack we used (~100 lines, in our host loader) is essentially the inverse of reset_conv_filter_layout in esp_ppq/parser/espdl/export_patterns.py; we can contribute it as a PR if you'd like it in fbs_loader/dl_module_conv.
Disclosure
This was found and the report written with Claude (Anthropic's AI assistant) working under the direction of Dr Liz James, as part of an assurance project that runs ESP-DL's published face models off-device. Claims above were verified by running the code.
Activity