Verilog Code generation for my ONNX Model
76 次查看(过去 30 天)
显示 更早的评论
I have my pretrained pytorch file best.pt and i converted file into ONNX Format . How can i generate verilog code for this File. How can i optimize the Model for my resources in FPGA ? Planning to implement in Zynq Ultrascale MpSoC + Boards
0 个评论
回答(1 个)
Subhajyoti
2024-10-29,14:31
It is my understanding that you are trying to generate Verilog code for the ONNX file, and later, planning to deploy it on FPGA boards.
HDL Coder can generate portable, synthesizable Verilog code from MATLAB functions, Simulink models, and Stateflow charts. But currently, the HDL Coder does not support code generation for the function 'importNetworkFromONNX'.
Alternatively, you can create a custom processor configuration and estimate the performance of a pretrained series network. You can then modify parameters of the custom processor configuration and re-estimate the performance. Once you have achieved your performance requirements you can generate a custom bitstream by using the custom processor configuration.
Here, in the following implementation, I have loaded a network from an ONNX file.
% [squeezeNet,ClassNames] = imagePretrainedNetwork("squeezenet");
% exportONNXNetwork(squeezeNet,"squeezeNet.onnx");
net = importNetworkFromONNX("squeezeNet.onnx");
analyzeNetworkForCodegen(net)
You can create, compile, and deploy a 'dlhdl.Workflow' object with the network object by using the Deep Learning HDL Toolbox. Use MATLAB to retrieve the prediction results from the target device. The steps are thoroughly illustrated in the following example:
Additionally, you can refer to the following resources to know more about Custom Deep Learning Processor Generation to Meet Performance Requirements:
2 个评论
子浩
2024-10-31,11:47
Thank you very for your help. I have a similar question. I want to deploy my trained CNN network (.pt) onto an FPGA platform, and my development board is ZedBoard instead of ZCU102. Do you know if MATLAB supports this type of deployment? Thank you.
Manikanta Aditya
2024-11-13,8:42
编辑:Manikanta Aditya
2024-11-13,8:44
Yes, MATLAB does support deploying trained convolutional neural networks (CNNs) onto FPGA platforms. You can use the Deep Learning HDL Toolbox in MATLAB to create, compile, and deploy your CNNs.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!