ValueError: current model is not supported by esp-dl

gjhave
Posts: 12
Joined: Mon Aug 14, 2023 7:27 am

ValueError: current model is not supported by esp-dl

Postby gjhave » Mon Aug 21, 2023 8:42 am

使用esp-dl中的example量化我的YOLO模型时,提示:ValueError: current model is not supported by esp-dl 错误,
请看我的代码和模型结构,我的模型中,只用了con2d, batchnormal, leakyrelu,convtranspos2d,add,concat
这些算子esp-dl中的量化算子规范都是支持的,不知道为什么还会提示不支持。
我使用的是esp-dl-release-1.1分支,esp-idf-v4.4分支
1.png
代码和报错提示
1.png (63.64 KiB) Viewed 46471 times
model.png
模型结构
model.png (655.58 KiB) Viewed 46471 times

ESP_Sandra
Posts: 46
Joined: Mon Dec 10, 2018 10:55 am

Re: ValueError: current model is not supported by esp-dl

Postby ESP_Sandra » Mon Aug 21, 2023 9:04 am

Hi
convtranspose2d 没有支持哦

gjhave
Posts: 12
Joined: Mon Aug 14, 2023 7:27 am

Re: ValueError: current model is not supported by esp-dl

Postby gjhave » Mon Aug 21, 2023 9:12 am

ESP_Sandra wrote:
Mon Aug 21, 2023 9:04 am
Hi
convtranspose2d 没有支持哦
请问在sdk中,有什么可以替代的吗?主要是上采样

@Shawn
Posts: 14
Joined: Wed Dec 18, 2019 11:15 am

Re: ValueError: current model is not supported by esp-dl

Postby @Shawn » Tue Aug 29, 2023 8:42 am

可以直接复制相邻像素来做上采样,具体可以看
torch.nn.Upsample: https://pytorch.org/docs/stable/generat ... ample.html

gjhave
Posts: 12
Joined: Mon Aug 14, 2023 7:27 am

Re: ValueError: current model is not supported by esp-dl

Postby gjhave » Tue Aug 29, 2023 9:27 am

@Shawn wrote:
Tue Aug 29, 2023 8:42 am
可以直接复制相邻像素来做上采样,具体可以看
torch.nn.Upsample: https://pytorch.org/docs/stable/generat ... ample.html
您好!感谢回复!
我也尝试过padding,transposeconv2d,nn.upsample等其他方法来进行上采样,训练是没有问题的,但会带来其他几个问题:
1、不同的上采样方法,在转ONNX并进行量化的过程中,由于图优化的过程可能会产生一些胶水层,会增加运算量
2、具体部署过程的工具由ESP官方提供,这些上采样的方法或者算子,dl_layer中并没有提供,图优化过程中产生的胶水层也不太可控,dl_layer中更不可能支持
3、也想过,在模型中把一些算子手动实现,然后用手动部署,通过自定义层,过程中结合model_coefficient.hpp手动复现,想想这种方法的不可控因素也挺多,因为毕竟手写算子可能也会有权重参数和相关逻辑,一切最终效果都依赖esp-dl,性能和效果都不确定,开发会耗费大量时间
4、不光是上采样的问题,这两天又碰到deptwidth_conv的问题,我的模型用pytorch写的,torch中是没有这个算子的,只能用conv2d把,input,output,groups都设置成相等来实现,这样写的模型,经过转onnx和量化出来的结果图中还是conv2d层,但是我看esp-dl下的dl_layer_conv2d定义是不知groups参数的。因此要想用deptwidt_conv,可能得用tf重写一遍模型。
总之,还是要先熟悉esp-dl和芯片的性能,再根据实际情况调整自己的模型,各种算子的加速效果也要尝试测试。
如果能得到官方支持,相信会轻松很多

ESP_Sandra
Posts: 46
Joined: Mon Dec 10, 2018 10:55 am

Re: ValueError: current model is not supported by esp-dl

Postby ESP_Sandra » Wed Aug 30, 2023 6:45 am

hi 有没有试过用 tvm 部署呢?https://github.com/espressif/esp-dl/releases/tag/v2.0

Who is online

Users browsing this forum: No registered users and 92 guests