Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error and fail malloc with Picodet network in espdl (AIV-747) #197

Open
3 tasks done
simoberny opened this issue Feb 11, 2025 · 6 comments
Open
3 tasks done

Error and fail malloc with Picodet network in espdl (AIV-747) #197

simoberny opened this issue Feb 11, 2025 · 6 comments

Comments

@simoberny
Copy link

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • Provided a clear description of your suggestion.
  • Included any relevant context or examples.

Issue or Suggestion Description

Hi, I'm trying to use a custom-trained Picodet network for person detection with ESP-DL, but I'm encountering an error when loading the model. My goal is to obtain a network similar to the one used in the pedestrian detection example, as I was informed that it is a modified version of Picodet.
I trained a Picodet XS with some modifications, using ReLU6 instead of hardswish as the activation function, to avoid opset 14 in the onnx format.

My setup version:

  • ESP-IDF 5.4.0
  • ESP-DL 3.0.0

I successfully exported the .onnx model to .espdl using the provided tools. However, when I try to load the model using dl::Model, I encounter the following error:

I (1368) dl::Model: Conv.0: Conv
I (1368) dl::Model: Clip.0: Clip
I (1368) dl::Model: Conv.1: Conv
I (1368) dl::Model: Clip.2: Clip
I (1368) dl::Model: Conv.2: Conv
I (1378) dl::Model: Clip.4: Clip
I (1378) dl::Model: Conv.3: Conv
I (1378) dl::Model: Clip.6: Clip
I (1378) dl::Model: Conv.4: Conv
I (1388) dl::Model: Clip.8: Clip
I (1388) dl::Model: Conv.5: Conv
I (1388) dl::Model: Clip.10: Clip
I (1398) dl::Model: Conv.6: Conv
I (1398) dl::Model: Clip.12: Clip
I (1398) dl::Model: Conv.7: Conv
I (1408) dl::Model: Clip.14: Clip
I (1408) dl::Model: Conv.8: Conv
I (1408) dl::Model: Clip.16: Clip
I (1408) dl::Model: Conv.9: Conv
I (1418) dl::Model: Clip.18: Clip
I (1418) dl::Model: Conv.10: Conv
I (1418) dl::Model: Clip.20: Clip
I (1428) dl::Model: Conv.11: Conv
I (1428) dl::Model: Conv.31: Conv
I (1428) dl::Model: Clip.22: Clip
I (1438) dl::Model: Clip.54: Clip
I (1438) dl::Model: Conv.12: Conv
I (1438) dl::Model: Clip.24: Clip
I (1438) dl::Model: Conv.13: Conv
I (1448) dl::Model: Clip.26: Clip
I (1448) dl::Model: Conv.14: Conv
I (1448) dl::Model: Clip.28: Clip
I (1458) dl::Model: Conv.15: Conv
I (1458) dl::Model: Clip.30: Clip
I (1458) dl::Model: Conv.16: Conv
I (1468) dl::Model: Clip.32: Clip
I (1468) dl::Model: Conv.17: Conv
I (1468) dl::Model: Clip.34: Clip
I (1478) dl::Model: Conv.18: Conv
I (1478) dl::Model: Clip.36: Clip
I (1478) dl::Model: Conv.19: Conv
I (1478) dl::Model: Clip.38: Clip
I (1488) dl::Model: Conv.20: Conv
I (1488) dl::Model: Clip.40: Clip
I (1488) dl::Model: Conv.21: Conv
I (1498) dl::Model: Clip.42: Clip
I (1498) dl::Model: Conv.22: Conv
I (1498) dl::Model: Clip.44: Clip
I (1508) dl::Model: Conv.23: Conv
I (1508) dl::Model: Conv.32: Conv
I (1508) dl::Model: Clip.46: Clip
I (1508) dl::Model: Clip.56: Clip
I (1518) dl::Model: GlobalAveragePool.0: GlobalAveragePool
I (1518) dl::Model: Conv.24: Conv
I (1528) dl::Model: Conv.25: Conv
I (1528) dl::Model: HardSigmoid.0: HardSigmoid
I (1528) dl::Model: Mul.0: Mul
I (1538) dl::Model: Conv.26: Conv
I (1538) dl::Model: Clip.48: Clip
I (1538) dl::Model: Conv.27: Conv
I (1548) dl::Model: Clip.50: Clip
I (1548) dl::Model: GlobalAveragePool.1: GlobalAveragePool
I (1548) dl::Model: Conv.28: Conv
I (1558) dl::Model: Conv.29: Conv
I (1558) dl::Model: HardSigmoid.1: HardSigmoid
I (1558) dl::Model: Mul.2: Mul
I (1568) dl::Model: Conv.30: Conv
I (1568) dl::Model: Clip.52: Clip
I (1568) dl::Model: Conv.33: Conv
I (1578) dl::Model: Clip.58: Clip
I (1578) dl::Model: Resize.0: Resize
I (1578) dl::Model: Conv.54: Conv
I (1588) dl::Model: Concat.0: Concat
I (1588) dl::Model: Clip.100: Clip
I (1588) dl::Model: Conv.34: Conv
I (1588) dl::Model: Conv.55: Conv
I (1598) dl::Model: Clip.60: Clip
I (1598) dl::Model: Clip.102: Clip
I (1598) dl::Model: Conv.35: Conv
I (1608) dl::Model: Clip.62: Clip
I (1608) dl::Model: Conv.36: Conv
I (1608) dl::Model: Clip.64: Clip
I (1618) dl::Model: Conv.37: Conv
I (1618) dl::Model: Clip.66: Clip
I (1618) dl::Model: Resize.1: Resize
I (1628) dl::Model: Concat.2: Concat
I (1628) dl::Model: Conv.38: Conv
I (1628) dl::Model: Clip.68: Clip
I (1628) dl::Model: Conv.39: Conv
I (1638) dl::Model: Clip.70: Clip
I (1638) dl::Model: Conv.40: Conv
I (1638) dl::Model: Clip.72: Clip
I (1648) dl::Model: Conv.41: Conv
I (1648) dl::Model: Clip.74: Clip
I (1648) dl::Model: Conv.42: Conv
I (1658) dl::Model: Conv.58: Conv
I (1658) dl::Model: Clip.76: Clip
I (1658) dl::Model: Clip.108: Clip
I (1658) dl::Model: Conv.43: Conv
I (1668) dl::Model: Conv.59: Conv
I (1668) dl::Model: Clip.78: Clip
I (1668) dl::Model: Clip.110: Clip
I (1678) dl::Model: Concat.4: Concat
I (1678) dl::Model: Conv.60: Conv
I (1678) dl::Model: Conv.44: Conv
I (1688) dl::Model: Clip.112: Clip
I (1688) dl::Model: Clip.80: Clip
I (1688) dl::Model: Conv.61: Conv
I (1698) dl::Model: Conv.45: Conv
I (1698) dl::Model: Clip.114: Clip
I (1698) dl::Model: Clip.82: Clip
I (1698) dl::Model: GlobalAveragePool.2: GlobalAveragePool
I (1708) dl::Model: Conv.66: Conv
I (1708) dl::Model: Conv.46: Conv
I (1718) dl::Model: Conv.62: Conv
I (1718) dl::Model: Clip.118: Clip
I (1718) dl::Model: Clip.84: Clip
I (1728) dl::Model: Sigmoid.0: Sigmoid
I (1728) dl::Model: Conv.67: Conv
I (1728) dl::Model: Conv.47: Conv
I (1738) dl::Model: Mul.4: Mul
I (1738) dl::Model: Sigmoid.1: Sigmoid
I (1738) dl::Model: Clip.86: Clip
I (1738) dl::Model: Conv.63: Conv
I (1748) dl::Model: Conv.48: Conv
I (1748) dl::Model: Conv.68: Conv
I (1748) dl::Model: Clip.116: Clip
I (1758) dl::Model: Clip.88: Clip
I (1758) dl::Model: Clip.120: Clip
I (1758) dl::Model: Conv.64: Conv
I (1768) dl::Model: Conv.65: Conv
I (1768) dl::Model: Conv.49: Conv
I (1768) dl::Model: Conv.69: Conv
I (1768) dl::Model: Sigmoid.2: Sigmoid
I (1778) dl::Model: PPQ_Operation_4: Transpose
I (1778) dl::Model: Clip.90: Clip
I (1788) dl::Model: Clip.122: Clip
I (1788) dl::Model: Mul.6: Mul
I (1788) dl::Model: Reshape.8: Reshape
I (1788) dl::Model: Concat.6: Concat
I (1798) dl::Model: Conv.70: Conv
I (1798) dl::Model: PPQ_Operation_0: DequantizeLinear
I (1808) dl::Model: Transpose.1: Transpose
I (1808) dl::Model: Conv.50: Conv
I (1808) dl::Model: Clip.124: Clip
I (1818) dl::Model: Sqrt.0: Sqrt
I (1818) dl::Model: Clip.92: Clip
I (1818) dl::Model: Conv.71: Conv
I (1828) dl::Model: PPQ_Operation_5: Transpose
I (1828) dl::Model: Conv.51: Conv
I (1828) dl::Model: Clip.126: Clip
I (1838) dl::Model: Reshape.7: Reshape
I (1838) dl::Model: Clip.94: Clip
I (1838) dl::Model: GlobalAveragePool.3: GlobalAveragePool
I (1848) dl::Model: Conv.76: Conv
I (1848) dl::Model: Transpose.0: Transpose
I (1848) dl::Model: Conv.52: Conv
I (1858) dl::Model: Conv.72: Conv
I (1858) dl::Model: Clip.130: Clip
I (1858) dl::Model: Clip.96: Clip
I (1868) dl::Model: Sigmoid.3: Sigmoid
I (1868) dl::Model: Conv.77: Conv
I (1868) dl::Model: Conv.53: Conv
I (1878) dl::Model: Mul.8: Mul
I (1878) dl::Model: Sigmoid.4: Sigmoid
I (1878) dl::Model: Clip.98: Clip
I (1878) dl::Model: Conv.73: Conv
I (1888) dl::Model: Conv.56: Conv
I (1888) dl::Model: Conv.78: Conv
I (1888) dl::Model: Clip.128: Clip
I (1898) dl::Model: Clip.104: Clip
I (1898) dl::Model: Clip.132: Clip
I (1898) dl::Model: Conv.74: Conv
I (1908) dl::Model: Conv.75: Conv
I (1908) dl::Model: Conv.57: Conv
I (1908) dl::Model: Conv.79: Conv
I (1918) dl::Model: Sigmoid.5: Sigmoid
I (1918) dl::Model: PPQ_Operation_6: Transpose
I (1918) dl::Model: Clip.106: Clip
I (1928) dl::Model: Clip.134: Clip
I (1928) dl::Model: Mul.10: Mul
I (1928) dl::Model: Reshape.13: Reshape
I (1938) dl::Model: Add.8: Add
I (1938) dl::Model: Conv.80: Conv
I (1938) dl::Model: PPQ_Operation_1: DequantizeLinear
I (1948) dl::Model: Transpose.3: Transpose
I (1948) dl::Model: Conv.88: Conv
I (1948) dl::Model: Clip.136: Clip
I (1958) dl::Model: Sqrt.1: Sqrt
I (1958) dl::Model: Clip.144: Clip
I (1958) dl::Model: Conv.81: Conv
I (1968) dl::Model: PPQ_Operation_7: Transpose
I (1968) dl::Model: Conv.89: Conv
I (1968) dl::Model: Clip.138: Clip
I (1978) dl::Model: Reshape.12: Reshape
I (1978) dl::Model: Clip.146: Clip
I (1978) dl::Model: GlobalAveragePool.4: GlobalAveragePool
I (1988) dl::Model: Conv.86: Conv
I (1988) dl::Model: Transpose.2: Transpose
I (1988) dl::Model: Conv.90: Conv
I (1998) dl::Model: Conv.82: Conv
I (1998) dl::Model: Clip.142: Clip
I (1998) dl::Model: Clip.148: Clip
I (2008) dl::Model: Sigmoid.6: Sigmoid
I (2008) dl::Model: Conv.87: Conv
I (2008) dl::Model: Conv.91: Conv
I (2018) dl::Model: Mul.12: Mul
I (2018) dl::Model: Sigmoid.7: Sigmoid
I (2018) dl::Model: Clip.150: Clip
I (2028) dl::Model: Conv.83: Conv
I (2028) dl::Model: GlobalAveragePool.5: GlobalAveragePool
I (2028) dl::Model: Conv.96: Conv
I (2038) dl::Model: Clip.140: Clip
I (2038) dl::Model: Conv.92: Conv
I (2038) dl::Model: Clip.154: Clip
I (2048) dl::Model: Conv.84: Conv
I (2048) dl::Model: Conv.85: Conv
I (2048) dl::Model: Sigmoid.9: Sigmoid
I (2058) dl::Model: Conv.97: Conv
I (2058) dl::Model: Sigmoid.8: Sigmoid
I (2058) dl::Model: PPQ_Operation_8: Transpose
I (2068) dl::Model: Mul.16: Mul
I (2068) dl::Model: Sigmoid.10: Sigmoid
I (2068) dl::Model: Mul.14: Mul
I (2078) dl::Model: Reshape.18: Reshape
I (2078) dl::Model: Conv.93: Conv
I (2078) dl::Model: PPQ_Operation_2: DequantizeLinear
I (2088) dl::Model: Transpose.5: Transpose
I (2088) dl::Model: Clip.152: Clip
I (2088) dl::Model: Sqrt.2: Sqrt
I (2098) dl::Model: Conv.94: Conv
I (2098) dl::Model: Conv.95: Conv
I (2098) dl::Model: PPQ_Operation_9: Transpose
I (2108) dl::Model: Sigmoid.11: Sigmoid
I (2108) dl::Model: PPQ_Operation_10: Transpose
I (2118) dl::Model: Reshape.17: Reshape
I (2118) dl::Model: Mul.18: Mul
I (2118) dl::Model: Reshape.23: Reshape
I (2128) dl::Model: Transpose.4: Transpose
I (2128) dl::Model: PPQ_Operation_3: DequantizeLinear
I (2128) dl::Model: Transpose.7: Transpose
I (2138) dl::Model: Sqrt.3: Sqrt
I (2138) dl::Model: PPQ_Operation_11: Transpose
I (2138) dl::Model: Reshape.22: Reshape
I (2148) dl::Model: Transpose.6: Transpose

assert failed: virtual std::vector<std::vector<int> > dl::module::Concat::get_output_shape(std::vector<std::vector<int> >&) dl_module_concat.hpp:58 (input_shapes[i][j] == input_shapes[i - 1][j])

Backtrace: 0x40379f8d:0x3fcaf8e0 0x403830ed:0x3fcaf900 0x4038ab8d:0x3fcaf920 0x420349a4:0x3fcafa40 0x42049ef3:0x3fcafa70 0x4204b046:0x3fcafc70 0x4203d62d:0x3fcafce0 0x4203dae7:0x3fcafd70 0x4200bbec:0x3fcafda0 0x42125e6b:0x3fcafe00
--- 0x40379f8d: panic_abort at /pathtoesp/v5.4/esp-idf/components/esp_system/panic.c:454
0x403830ed: esp_system_abort at /pathtoesp/v5.4/esp-idf/components/esp_system/port/esp_system_chip.c:92
0x4038ab8d: __assert_func at /path/v5.4/esp-idf/components/newlib/assert.c:80
0x420349a4: dl::module::Concat::get_output_shape(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&) at /project/managed_components/espressif__esp-dl/dl/module/include/dl_module_concat.hpp:58 (discriminator 1)
0x42049ef3: dl::memory::MemoryManagerGreedy::get_tensor_info_from_fbs(fbs::FbsModel*, std::vector<dl::module::Module*, std::allocator<dl::module::Module*> >, std::vector<dl::memory::TensorInfo*, std::allocator<dl::memory::TensorInfo*> >&) at /project/Ocio/managed_components/espressif__esp-dl/dl/model/src/dl_memory_manager_greedy.cpp:140
0x4204b046: dl::memory::MemoryManagerGreedy::alloc(fbs::FbsModel*, std::vector<dl::module::Module*, std::allocator<dl::module::Module*> >&) at /project/managed_components/espressif__esp-dl/dl/model/src/dl_memory_manager_greedy.cpp:41 (discriminator 1)
0x4203d62d: dl::Model::build(unsigned int, dl::memory_manager_t, bool) at /project/managed_components/espressif__esp-dl/dl/model/src/dl_model_base.cpp:171
0x4203dae7: dl::Model::Model(char const*, fbs::model_location_type_t, int, dl::memory_manager_t, unsigned char*, bool) at /project/managed_components/espressif__esp-dl/dl/model/src/dl_model_base.cpp:20
 (inlined by) dl::Model::Model(char const*, fbs::model_location_type_t, int, dl::memory_manager_t, unsigned char*, bool) at /project/managed_components/espressif__esp-dl/dl/model/src/dl_model_base.cpp:12
0x4200bbec: app_main at /project/main/main.cpp:222 (discriminator 1)
0x42125e6b: main_task at /pathtoesp/v5.4/esp-idf/components/freertos/app_startup.c:208

If I try to load the model using the Pico Model from the PedestrianDetection example instead, the system attempts to allocate 223,827,472 bytes, which inevitably causes a crash.

I (1378) dl::Model: Conv.0: Conv
W (1378) calloc_aligned: heap_caps_aligned_calloc failed, retry with MALLOC_CAP_8BIT
E (1388) calloc_aligned: Fail to malloc 223827472 bytes from DRAM(80235 bytyes) and PSRAM(4730728 bytes), PSRAM is on.

Thanks in advance in any help!
P.S: Is it possible to have some insight on the parameter and the procedure used to obtain the model from pedestrian example?

@github-actions github-actions bot changed the title Error and fail malloc with Picodet network in espdl Error and fail malloc with Picodet network in espdl (AIV-747) Feb 11, 2025
@100312dog
Copy link
Contributor

@simoberny
The PedestrianDetection example in esp-dl should work. Update esp-dl to 3.1.0 and try. If the PedestrianDetection example works, export your own model with latest esp-ppq, and replace the model in the example with your own.
If the issue still exists, can you share your onnx file? So that we can determine why it happens and fix it.

@simoberny
Copy link
Author

simoberny commented Feb 12, 2025

@simoberny The PedestrianDetection example in esp-dl should work. Update esp-dl to 3.1.0 and try. If the PedestrianDetection example works, export your own model with latest esp-ppq, and replace the model in the example with your own. If the issue still exists, can you share your onnx file? So that we can determine why it happens and fix it.

Thank you for your prompt response.
I have updated PPQ to the latest commit and upgraded ESP-DL to version 3.1.0.

The pedestrian example runs perfectly, but when I use my model, I still encounter the same error as before:

assert failed: virtual std::vector<std::vector<int> > dl::module::Concat::get_output_shape(std::vector<std::vector<int> >&) dl_module_concat.hpp:58 (input_shapes[i][j] == input_shapes[i - 1][j]) 

The quantization process with ppq at the end prints out:

[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_162 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_82 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_163 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_83 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_0 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_1 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_2 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_3 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_162 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_82 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_163 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_83 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_0 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_1 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_2 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_3 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_162 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_82 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_163 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_83 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_0 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:09]:  Skip PPQ_Variable_1 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_2 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_3 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_162 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_82 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_163 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_83 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_0 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_1 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_2 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  Skip PPQ_Variable_3 because it's not exportable
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[INFO][ESPDL][2025-02-12 16:04:10]:  skip not QuantableOperation
[WARNING][ESPDL][2025-02-12 16:04:10]:  save_infer_model/scale_1.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  save_infer_model/scale_2.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  save_infer_model/scale_3.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  sqrt_3.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  reshape2_22.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  reshape2_17.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  sqrt_1.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  reshape2_12.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  sqrt_0.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  reshape2_7.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  save_infer_model/scale_0.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  sqrt_2.tmp_0 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_168 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_171 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_174 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_177 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_181 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_183 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_185 does not bind exponents parameter
[WARNING][ESPDL][2025-02-12 16:04:10]:  PPQ_Variable_187 does not bind exponents parameter

Looking at the layers of the network seems really different from the pedestrian example tough.
This is my onnx file:
picodet_xs_processed.zip

@simoberny
Copy link
Author

I add some information I found out.

The problems seems to happen in the first concat element of the network (Concat.0), where converge a Resize and a Relu.6 activation.

Image

For some reason it seems that the relu comes out with 70 items for the second factor instead of the 96 as expected.
1x70x20x20 instead of 1x96x20x20.
Since in the onnx the elements seems ok, I think something is happening in the quantization process.

Image

@100312dog
Copy link
Contributor

@simoberny Thank you for your info. I did a super quick test. I am able to run the exported model without the assert failure, although the model inference result is incorrect. We will try to reproduce your problem and dig deeper to find out why the inference result is incorrect.
What's your operating system? Our quantization tools seems to have some issues on windows.

@simoberny
Copy link
Author

simoberny commented Feb 14, 2025

@100312dog Yeah my bad, Windows was the problem, I was using a conda environment.
I switched to a Linux machine, and now the exported model loads correctly.

Now it is panicking on inference call

Update 17/02

I investigate some more, in the post process all the Tensor element seems to not be found, and become consequently null.

    TensorBase *score0 = m_model->get_intermediate("score0"); // --> nullptr
    TensorBase *bbox0 = m_model->get_intermediate("bbox0");  // --> nullptr
    TensorBase *score1 = m_model->get_intermediate("score1"); // --> nullptr
    TensorBase *bbox1 = m_model->get_intermediate("bbox1");  // --> nullptr
    TensorBase *score2 = m_model->get_intermediate("score2"); // --> nullptr
    TensorBase *bbox2 = m_model->get_intermediate("bbox2");  // --> nullptr

    if (score0->dtype == DATA_TYPE_INT8) { //<-- Accesing nullptr, panic'ed
        parse_stage<int8_t>(score0, bbox0, 0);
        parse_stage<int8_t>(score1, bbox1, 1);
        parse_stage<int8_t>(score2, bbox2, 2);
    } else {
        parse_stage<int16_t>(score0, bbox0, 0);
        parse_stage<int16_t>(score1, bbox1, 1);
        parse_stage<int16_t>(score2, bbox2, 2);
    }

@simoberny
Copy link
Author

I understand that the ESP-DL post-processing code is designed for a specific network configuration.

I tried replacing score0, bbox0 with the actual output tensors from my PicoDet XS model, which was trained on a custom dataset with a single "person" label:

    TensorBase *score0 = m_model->get_intermediate("save_infer_model/scale_0.tmp_0");
    TensorBase *bbox0 = m_model->get_intermediate("save_infer_model/scale_4.tmp_0");
    TensorBase *score1 = m_model->get_intermediate("save_infer_model/scale_1.tmp_0");
    TensorBase *bbox1 = m_model->get_intermediate("save_infer_model/scale_5.tmp_0");
    TensorBase *score2 = m_model->get_intermediate("save_infer_model/scale_2.tmp_0");
    TensorBase *bbox2 = m_model->get_intermediate("save_infer_model/scale_6.tmp_0");

I'm using three out of the four FPN scales (64, 32, 16), but the code gets stuck during parsing.

Could you help me understand if I am making a conceptual mistake? Or is it possibile to have the picodet configuration to replicate the pedestrian example network.

Thank you for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants