Verilog Code generation for my ONNX Model

조회 수: 35 (최근 30일)
ATHUL
ATHUL 2024년 10월 25일
편집: Manikanta Aditya 2024년 11월 13일
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

답변 (1개)

Subhajyoti
Subhajyoti 2024년 10월 29일
Hi @ATHUL,
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일
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
Manikanta Aditya 2024년 11월 13일
편집: Manikanta Aditya 2024년 11월 13일
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!

Translated by