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

ESP-DL Quant Tool | TVM conversion & deployment on ESP32S3-EYE (AIV-675) #152

Closed
MichelBerg opened this issue Jan 26, 2024 · 2 comments
Closed

Comments

@MichelBerg
Copy link

Recently I am working with ESP-DL Quantization Tool and TVM. I am trying to build different models and try to deploy them to the ESP32S3-EYE.

Creating several simple models works in most cases with the quantization tool, but rarely with TVM.

While comparing simple model like this:
96x96x3_Model_architecture

My tests are using a static dummy image with the correct shape.
Using the Quantization Tool: ~113122 us
Using TVM: ~680491 us

Overall the performance of TVM, seams to be very inefficient for me right now. In most of these szenarios with "large" Models, TVM needs a large amount of memory. To fix the overflow in the .dram0.bss segment, I already moved the data to the PSRAM. (using EXT_RAM_BSS_ATTR and the necessary menuconfig ind the esp-idf)

What I want to do is Transfer learning with MobileNetV2. Building and train it with TF and converting it to ONNX isn't a problem. But somehow the conversions given with the ESP-DL Tools (Quant and TVM) is one. I understand that using the quantization tool won't be able to convert MobileNetV2 due to the missing layers, that are not implemented yet (ESP-DL Layers)
But using the TVM method leads to errors by using esp-dl/tools/tvm/export_onnx_model.py.

My Transfer learning dummy model looks like this:

base_model = tf.keras.applications.MobileNetV2(input_shape=IMAGE_SHAPE,
                                               alpha=0.35,
                                               include_top=False,
                                               weights='imagenet')
model = tf.keras.Sequential([
    base_model,
    layers.GlobalAveragePooling2D(),
    layers.Dense(len(class_names), activation='softmax')
])

Exporting it to ONNX looks like this:

python -m tf2onnx.convert --saved-model tmp_model --output {model_name} --opset {opset}

For building a model i use a seperate google colab notebook.
The versions I use:

  • Python: 3.10
  • ONNX: 1.15.0
  • TF2ONNX: 1.16.1 (primary using opset=13)

As a test I tried the TVM export by using different opsets (10-15). But the error looks for every version the same.

My colab notebook for the TVM export is based on #139.

The resulting error looks like this:

Using '/content/onnx/onnx_from_tensorflow_models/96x96x3_mobilenetV2_0_35_opset_14_model.onnx' for ESP-DL TVM conversion!
WARNING:root:Please use QuantFormat.QDQ for activation type QInt8 and weight type QInt8. Or it will lead to bad performance on x64.
Collecting tensor data and making histogram ...
Finding optimal threshold for each tensor using entropy algorithm ...
Number of tensors : 107
Number of histogram bins : 128 (The number may increase depends on the data it collects)
Number of quantized bins : 128



[13:24:51] /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/convert_layout.cc:99: Warning: Desired layout(s) not specified for op: nn.global_avg_pool2d
Model Information:
------------------
Input Name: input_4
Input Shape: (1, 96, 96, 3)
Input DType: float
Output Name: dense_4
Output Shape: (1, 10)
Output DType: float
Traceback (most recent call last):
  File "esp-dl/tools/tvm/export_onnx_model.py", line 237, in <module>
    dump_tvm_onnx_project(target_chip=args.target_chip, model_path=args.model_path, img_path=args.img_path,  template_path=args.template_path, generated_project_path=args.out_path)
  File "esp-dl/tools/tvm/export_onnx_model.py", line 167, in dump_tvm_onnx_project
    mod = preprocess_onnx_for_esp(mod, params)
  File "/content/esp-dl/tools/tvm/python/tvm/relay/op/contrib/esp.py", line 61, in preprocess_onnx_for_esp
    return seq(mod)
  File "/content/esp-dl/tools/tvm/python/tvm/ir/transform.py", line 160, in __call__
    return _ffi_transform_api.RunPass(self, mod)
  File "/content/esp-dl/tools/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 238, in __call__
    raise get_last_ffi_error()
tvm.error.InternalError: Traceback (most recent call last):
  92: 0xffffffffffffffff
  91: _start
  90: __libc_start_main
  89: 0x00007d5eb1eaed8f
  88: _Py_UnixMain
  87: 0x000000000057b93a
  86: PyRun_SimpleFileExFlags
  85: PyRun_FileExFlags
  84: 0x00000000005a4726
  83: PyEval_EvalCode
  82: _PyEval_EvalCodeWithName
  81: _PyEval_EvalFrameDefault
  80: 0x00000000004de313
  79: _PyFunction_FastCallKeywords
  78: _PyEval_EvalCodeWithName
  77: _PyEval_EvalFrameDefault
  76: 0x00000000004de313
  75: _PyFunction_FastCallKeywords
  74: _PyEval_EvalCodeWithName
  73: _PyEval_EvalFrameDefault
  72: 0x00000000004de44c
  71: _PyObject_FastCallKeywords
  70: 0x00000000005abdaa
  69: _PyObject_Call_Prepend
  68: _PyFunction_FastCallDict
  67: _PyEval_EvalFrameDefault
  66: 0x00000000004de44c
  65: _PyObject_FastCallKeywords
  64: 0x00000000005abdaa
  63: _PyObject_Call_Prepend
  62: _PyFunction_FastCallDict
  61: _PyEval_EvalCodeWithName
  60: _PyEval_EvalFrameDefault
  59: 0x00000000004de44c
  58: _PyObject_FastCallKeywords
  57: 0x00007d5eb1a4d0d6
  56: 0x00007d5eb1a43eae
  55: 0x00007d5eb182c492
  54: 0x00007d5eb182fe2d
  53: tvm::runtime::TVMRetValue tvm::runtime::PackedFunc::operator()<tvm::IRModule, tvm::transform::PassContext>(tvm::IRModule&&, tvm::transform::PassContext&&) const
  52: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:325
  51: tvm::relay::contrib::esp::GenerateConstants(tvm::IRModule const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:312
  50: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  49: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  48: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  47: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  46: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  45: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  44: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  43: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  42: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  41: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  40: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  39: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  38: tvm::relay::contrib::esp::GenerateConstantsMutator::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:273
  37: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  36: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  35: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  34: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  33: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  32: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  31: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  30: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  29: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  28: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  27: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  26: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  25: tvm::relay::contrib::esp::GenerateConstantsMutator::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:290
  24: tvm::relay::contrib::esp::GenerateConstantsMutator::GenerateConv2dExpConstants(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:214
  23: tvm::relay::contrib::esp::GenerateConstantsMutator::ConvertConv2dLayout(tvm::RelayExpr, tvm::relay::Conv2DAttrs const*, tvm::Attrs*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:167
  22: tvm::relay::transform::FoldConstantExpr(tvm::RelayExpr const&, bool)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:430
  21: tvm::relay::transform::FoldConstantExpr(tvm::RelayExpr const&, tvm::IRModule const&, bool)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:423
  20: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  19: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  18: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  17: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  16: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  15: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  14: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  13: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  12: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  11: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  10: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  9: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  8: Rewrite_
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:202
  7: ConstEvaluate
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:270
  6: tvm::relay::Eval(tvm::RelayExpr, tvm::runtime::Map<tvm::GlobalTypeVar, tvm::TypeData, void, void>, std::unordered_set<tvm::runtime::String, std::hash<tvm::runtime::String>, std::equal_to<tvm::runtime::String>, std::allocator<tvm::runtime::String> >, DLDevice, tvm::Target, tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void>)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/interpreter.cc:1108
  5: tvm::relay::Prepare(tvm::IRModule, tvm::CompilationConfig const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/interpreter.cc:961
  4: tvm::runtime::TVMRetValue tvm::runtime::PackedFunc::operator()<tvm::IRModule, tvm::transform::PassContext>(tvm::IRModule&&, tvm::transform::PassContext&&) const
  3: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:981
  2: tvm::relay::TypeInferencer::Infer(tvm::GlobalVar, tvm::relay::Function)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:787
  1: tvm::relay::TypeInferencer::Solve()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:623
  0: tvm::relay::TypeSolver::Solve()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/analysis/type_solver.cc:643
  94: 0xffffffffffffffff
  93: _start
  92: __libc_start_main
  91: 0x00007d5eb1eaed8f
  90: _Py_UnixMain
  89: 0x000000000057b93a
  88: PyRun_SimpleFileExFlags
  87: PyRun_FileExFlags
  86: 0x00000000005a4726
  85: PyEval_EvalCode
  84: _PyEval_EvalCodeWithName
  83: _PyEval_EvalFrameDefault
  82: 0x00000000004de313
  81: _PyFunction_FastCallKeywords
  80: _PyEval_EvalCodeWithName
  79: _PyEval_EvalFrameDefault
  78: 0x00000000004de313
  77: _PyFunction_FastCallKeywords
  76: _PyEval_EvalCodeWithName
  75: _PyEval_EvalFrameDefault
  74: 0x00000000004de44c
  73: _PyObject_FastCallKeywords
  72: 0x00000000005abdaa
  71: _PyObject_Call_Prepend
  70: _PyFunction_FastCallDict
  69: _PyEval_EvalFrameDefault
  68: 0x00000000004de44c
  67: _PyObject_FastCallKeywords
  66: 0x00000000005abdaa
  65: _PyObject_Call_Prepend
  64: _PyFunction_FastCallDict
  63: _PyEval_EvalCodeWithName
  62: _PyEval_EvalFrameDefault
  61: 0x00000000004de44c
  60: _PyObject_FastCallKeywords
  59: 0x00007d5eb1a4d0d6
  58: 0x00007d5eb1a43eae
  57: 0x00007d5eb182c492
  56: 0x00007d5eb182fe2d
  55: tvm::runtime::TVMRetValue tvm::runtime::PackedFunc::operator()<tvm::IRModule, tvm::transform::PassContext>(tvm::IRModule&&, tvm::transform::PassContext&&) const
  54: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:325
  53: tvm::relay::contrib::esp::GenerateConstants(tvm::IRModule const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:312
  52: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  51: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  50: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  49: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  48: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  47: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  46: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  45: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  44: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  43: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  42: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  41: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  40: tvm::relay::contrib::esp::GenerateConstantsMutator::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:273
  39: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  38: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  37: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  36: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  35: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  34: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  33: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  32: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  31: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  30: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  29: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  28: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  27: tvm::relay::contrib::esp::GenerateConstantsMutator::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:290
  26: tvm::relay::contrib::esp::GenerateConstantsMutator::GenerateConv2dExpConstants(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:214
  25: tvm::relay::contrib::esp::GenerateConstantsMutator::ConvertConv2dLayout(tvm::RelayExpr, tvm::relay::Conv2DAttrs const*, tvm::Attrs*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/contrib/esp/generate_constants.cc:167
  24: tvm::relay::transform::FoldConstantExpr(tvm::RelayExpr const&, bool)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:430
  23: tvm::relay::transform::FoldConstantExpr(tvm::RelayExpr const&, tvm::IRModule const&, bool)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:423
  22: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:102
  21: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:509
  20: ExpandDataflow<tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>, tvm::relay::ExpandDataflow(tvm::relay::Expr, FCheckVisited, FVisitLeaf) [with FCheckVisited = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>; FVisitLeaf = tvm::relay::MixedModeMutator::VisitExpr(const Expr&)::<lambda(const Expr&)>]::<lambda(const Expr&)> >
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:468
  19: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:98
  18: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:81
  17: tvm::relay::MixedModeMutator::DispatchVisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:94
  16: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/ir/expr_functor.cc:158
  15: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:95
  14: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  13: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:128
  12: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:291
  11: tvm::RelayExpr tvm::relay::MixedModeMutator::Rewrite<tvm::relay::CallNode>(tvm::relay::CallNode const*)
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/relay/expr_functor.h:313
  10: Rewrite_
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:202
  9: ConstEvaluate
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/fold_constant.cc:270
  8: tvm::relay::Eval(tvm::RelayExpr, tvm::runtime::Map<tvm::GlobalTypeVar, tvm::TypeData, void, void>, std::unordered_set<tvm::runtime::String, std::hash<tvm::runtime::String>, std::equal_to<tvm::runtime::String>, std::allocator<tvm::runtime::String> >, DLDevice, tvm::Target, tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void>)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/interpreter.cc:1108
  7: tvm::relay::Prepare(tvm::IRModule, tvm::CompilationConfig const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/backend/interpreter.cc:961
  6: tvm::runtime::TVMRetValue tvm::runtime::PackedFunc::operator()<tvm::IRModule, tvm::transform::PassContext>(tvm::IRModule&&, tvm::transform::PassContext&&) const
  5: operator()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:981
  4: tvm::relay::TypeInferencer::Infer(tvm::GlobalVar, tvm::relay::Function)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:787
  3: tvm::relay::TypeInferencer::Solve()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/transforms/type_infer.cc:623
  2: tvm::relay::TypeSolver::Solve()
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/analysis/type_solver.cc:632
  1: tvm::TypedEnvFunc<bool (tvm::runtime::Array<tvm::Type, void> const&, int, tvm::Attrs const&, tvm::TypeReporter const&)>::operator()(tvm::runtime::Array<tvm::Type, void> const&, int, tvm::Attrs const&, tvm::TypeReporter const&) const
        at /home/gansichen/Workspace/projects/local/framework/tvm/include/tvm/ir/env_func.h:142
  0: tvm::relay::SplitRel(tvm::runtime::Array<tvm::Type, void> const&, int, tvm::Attrs const&, tvm::TypeReporter const&)
        at /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/op/tensor/transform.cc:3070
  File "/home/gansichen/Workspace/projects/local/framework/tvm/src/relay/analysis/type_solver.cc", line 643
InternalError: Check failed: (false) is false: [13:28:38] /home/gansichen/Workspace/projects/local/framework/tvm/src/relay/op/tensor/transform.cc:3070: InternalError: Check failed: (reporter->Assert(indices[i] > begin)) is false: indices_or_sections need to be a sorted ascending list

My goal is to compare these tools from Espressif directly with TF Lite micro or with models that are build with EdgeImpulse.
I wonder if somebody tried the same and faced similar issues.

I would be very happy about any kind of advice and support.

@github-actions github-actions bot changed the title ESP-DL Quant Tool | TVM conversion & deployment on ESP32S3-EYE ESP-DL Quant Tool | TVM conversion & deployment on ESP32S3-EYE (AIV-675) Jan 26, 2024
@MichelBerg
Copy link
Author

MichelBerg commented Jan 30, 2024

I got an other version of MobilenetV2 actually converting using the TVM tool. But after flashing my ESP32S3-EYE i get the following error:

ELF file SHA256: f5fcc5d1cf125178



Rebooting...

ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x3 (RTC_SW_SYS_RST),boot:0x2a (SPI_FAST_FLASH_BOOT)

Saved PC:0x40375945

0x40375945: esp_restart_noos_dig at /home/bergm/esp_v5.0/esp-idf/components/esp_system/esp_system.c:64 (discriminator 1)



SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce3810,len:0x1860

load:0x403c9700,len:0xd7c

load:0x403cc700,len:0x2e5c

entry 0x403c9934

I (25) boot: ESP-IDF v5.0.4-384-ge42bcf2e88 2nd stage bootloader

I (26) boot: compile time 19:13:40

I (27) boot: Multicore bootloader

I (29) boot: chip revision: v0.1

I (33) qio_mode: Enabling default flash chip QIO

I (38) boot.esp32s3: Boot SPI Speed : 80MHz

I (43) boot.esp32s3: SPI Mode       : QIO

I (48) boot.esp32s3: SPI Flash Size : 8MB

I (52) boot: Enabling RNG early entropy source...

I (58) boot: Partition Table:

I (61) boot: ## Label            Usage          Type ST Offset   Length

I (69) boot:  0 factory          factory app      00 00 00010000 003c0000

I (76) boot:  1 nvs              WiFi data        01 02 003d0000 00004000

I (83) boot:  2 fr               Unknown data     01 06 003e0000 00020000

I (91) boot: End of partition table

I (95) esp_image: segment 0: paddr=00010020 vaddr=3c070020 size=d9864h (890980) map

I (239) esp_image: segment 1: paddr=000e988c vaddr=3fc92e00 size=02bc4h ( 11204) load

I (241) esp_image: segment 2: paddr=000ec458 vaddr=40374000 size=03bc0h ( 15296) load

I (247) esp_image: segment 3: paddr=000f0020 vaddr=42000020 size=61b54h (400212) map

I (313) esp_image: segment 4: paddr=00151b7c vaddr=40377bc0 size=0b1f8h ( 45560) load

I (329) boot: Loaded app from partition at offset 0x10000

I (330) boot: Disabling RNG early entropy source...

I (330) cpu_start: Multicore app

I (333) octal_psram: vendor id    : 0x0d (AP)

I (338) octal_psram: dev id       : 0x02 (generation 3)

I (344) octal_psram: density      : 0x03 (64 Mbit)

I (350) octal_psram: good-die     : 0x01 (Pass)

I (355) octal_psram: Latency      : 0x01 (Fixed)

I (360) octal_psram: VCC          : 0x01 (3V)

I (365) octal_psram: SRF          : 0x01 (Fast Refresh)

I (371) octal_psram: BurstType    : 0x01 (Hybrid Wrap)

I (377) octal_psram: BurstLen     : 0x01 (32 Byte)

I (382) octal_psram: Readlatency  : 0x02 (10 cycles@Fixed)

I (388) octal_psram: DriveStrength: 0x00 (1/1)

I (394) MSPI Timing: PSRAM timing tuning index: 5

I (399) esp_psram: Found 8MB PSRAM device

I (404) esp_psram: Speed: 80MHz

I (408) cpu_start: Pro cpu up.

I (411) cpu_start: Starting app cpu, entry point is 0x40375424

0x40375424: call_start_cpu1 at /home/bergm/esp_v5.0/esp-idf/components/esp_system/port/cpu_start.c:147



I (0) cpu_start: App cpu up.

I (739) esp_psram: SPI SRAM memory test OK

I (750) cpu_start: Pro cpu start user code

I (750) cpu_start: cpu freq: 240000000 Hz

I (751) cpu_start: Application information:

I (752) cpu_start: Project name:     esp32-template-project

I (757) cpu_start: App version:      1444d92-dirty

I (758) cpu_start: Compile time:     Jan 30 2024 19:13:34

I (760) cpu_start: ELF file SHA256:  f5fcc5d1cf125178...

I (761) cpu_start: ESP-IDF:          v5.0.4-384-ge42bcf2e88

I (763) cpu_start: Min chip rev:     v0.0

I (764) cpu_start: Max chip rev:     v0.99 

I (765) cpu_start: Chip rev:         v0.1

I (767) heap_init: Initializing. RAM available for dynamic allocation:

I (771) heap_init: At 3FC97B00 len 00051C10 (327 KiB): DRAM

I (774) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM

I (777) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM

I (781) esp_psram: Adding pool of 8048K of PSRAM memory to heap allocator

I (784) spi_flash: detected chip: generic

I (784) spi_flash: flash io: qio

I (787) app_start: Starting scheduler on CPU0

I (788) main_task: Started on CPU0

I (788) app_start: Starting scheduler on CPU1

I (788) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations

I (798) main_task: Calling app_main()

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.



Core  0 register dump:

PC      : 0x4201fd3c  PS      : 0x00060d30  A0      : 0x8200bd42  A1      : 0x3fca5360  

0x4201fd3c: tie728_s8_conv2d_per_channel_hwcn_bias_relu_loop at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/isa/tie728/dl_tie728_s8_conv2d.S:2028



A2      : 0x3c150000  A3      : 0x3c162000  A4      : 0x3fca5bb8  A5      : 0x3c132a20  

A6      : 0x00000001  A7      : 0x00000002  A8      : 0x00000001  A9      : 0x00000000  

A10     : 0x000005c0  A11     : 0x00000600  A12     : 0x00000200  A13     : 0x3c133cc0  

A14     : 0x00000000  A15     : 0x0000000b  SAR     : 0x0000000b  EXCCAUSE: 0x0000001c  

EXCVADDR: 0x00000000  LBEG    : 0x4201fb9c  LEND    : 0x4201fbdf  LCOUNT  : 0x00000000  

0x4201fb9c: tie728_s8_conv2d_per_channel_hwcn_bias_relu_loop at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/isa/tie728/dl_tie728_s8_conv2d.S:2024



0x4201fbdf: tie728_s8_conv2d_per_channel_hwcn_bias_relu_loop at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/isa/tie728/dl_tie728_s8_conv2d.S:2024







Backtrace: 0x4201fd39:0x3fca5360 0x4200bd3f:0x3fca53e0 0x4200c84b:0x3fca5450 0x4200bb7d:0x3fca5470 0x4200b090:0x3fca5540 0x42008dea:0x3fca5650 0x420086ba:0x3fca5770 0x42007e4d:0x3fca57e0 0x42007dca:0x3fca5800 0x4037a8e5:0x3fca5830

0x4201fd39: tie728_s8_conv2d_per_channel_hwcn_bias_relu_loop at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/isa/tie728/dl_tie728_s8_conv2d.S:2028



0x4200bd3f: void dl::base::conv_operation_shell<signed char, long>(dl::base::ArgsType<signed char>&, void (*)(signed char*, signed char*, void*), void (*)(signed char*, signed char*, void*), void (*)(long*, signed char*, dl::base::ArgsType<signed char> const&), void (*)(long*, signed char*, dl::base::ArgsType<signed char> const&), void (*)(signed char*, long*, dl::base::ArgsType<signed char> const&)) at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/dl_base.hpp:471



0x4200c84b: void dl::base::conv2d<signed char, signed char, signed char, signed char, long>(void*) at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/base/dl_base_conv2d.cpp:1220



0x4200bb7d: dl::nn::conv2d(dl::Tensor<signed char>&, dl::Tensor<signed char>&, std::vector<int, std::allocator<int> >&, dl::Filter<signed char> const&, int, int, dl::Bias<signed char> const*, dl::Activation<signed char> const*, std::vector<int, std::allocator<int> > const&) at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/nn/src/dl_nn_conv2d.cpp:72



0x4200b090: esp_dl_nn_conv2d_s8_wrapper at /home/gansichen/Workspace/delete/aigit/master/dl/components/dl/tvm/src/dl_nn_kernel.cpp:39



0x42008dea: tvmgen_default_esp_main_1 at /home/bergm/Desktop/SeedStudioModels/tvm_96x96x3_mobilenetv2_0.35/local_dummy_tvm_inference_project/new_project/components/tvm_model/model/codegen/host/src/default_lib6.c:14



0x420086ba: tvmgen_default___tvm_main__ at /home/bergm/Desktop/SeedStudioModels/tvm_96x96x3_mobilenetv2_0.35/local_dummy_tvm_inference_project/new_project/components/tvm_model/model/codegen/host/src/default_lib1.c:329



0x42007e4d: tvmgen_default_run at /home/bergm/Desktop/SeedStudioModels/tvm_96x96x3_mobilenetv2_0.35/local_dummy_tvm_inference_project/new_project/components/tvm_model/model/codegen/host/src/default_lib0.c:83007



0x42007dca: inference_task at /home/bergm/Desktop/SeedStudioModels/tvm_96x96x3_mobilenetv2_0.35/local_dummy_tvm_inference_project/new_project/main/app_main.c:30



0x4037a8e5: vPortTaskWrapper at /home/bergm/esp_v5.0/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:149

The model is based on: https://github.com/Seeed-Studio/sscma-model-zoo/blob/main/docs/en/Person_Classification_MobileNetV2_0.35_Rep_96.md where i downloaded the ONNX file and exported it with ESP-DL TVM.

I wonder why this happens even if the TVM export worked.

@BlueSkyB
Copy link
Collaborator

BlueSkyB commented Feb 5, 2024

The final error in the first version of MobilenetV2 is the native interface of TVM, which may be due to the model structure not being adapted.

The issue of second version of MobilenetV2 is strange. You can try this commit first to see if it can solve your problem: 97e1c52 in https://github.com/espressif/esp-dl.git.

In addition, the support for TVM in ESP-DL is not very mature, and there may be exceptions in the deployment of some custom models. Moreover, the main branch of TVM has undergone significant updates, so this implementation needs to be refactored. However, due to our current manpower constraints, we won't start the refactoring work in the short term; we need to complete other tasks first. So if any exceptions occur, you may need to handle them on your own in the short term. Sorry for the inconvenience.

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

3 participants