FPGA Implementation for the Sigmoid with Piecewise Linear Fitting Method Based on Curvature Analysis
FPGA Implementation for the Sigmoid with Piecewise Linear Fitting Method Based on Curvature Analysis
复制标题
基于曲率分析的分段线性拟合Sigmoid函数的FPGA实现
DOI:
10.3390/electronics11091365
复制
发表时间:
2022
期刊:
影响因子:
2.9
通讯作者:
Qinglin Wang
中科院分区:
文献类型:
--
作者:
Zerun Li;Yang Zhang;Bingcai Sui;Zuocheng Xing;Qinglin Wang
The sigmoid activation function is popular in neural networks, but its complexity limits the hardware implementation and speed. In this paper, we use curvature values to divide the sigmoid function into different segments and employ the least squares method to solve the expressions of the piecewise linear fitting function in each segment. We then adopt an optimization method with maximum absolute errors and average absolute errors to select an appropriate function expression with a specified number of segments. Finally, we implement the sigmoid function on the field-programmable gate array (FPGA) development platform and apply parallel operations of arithmetic (multiplying and adding) and range selection at the same time. The FPGA implementation results show that the clock frequency of our design is up to 208.3 MHz, while the end-to-end latency is just 9.6 ns. Our piecewise linear fitting method based on curvature analysis (PWLC) achieves recognition accuracy on the MNIST dataset of 97.51% with a deep neural network (DNN) and 98.65% with a convolutional neural network (CNN). Experimental results demonstrate that our FPGA design of sigmoid function can obtain the lowest latency, reduce absolute errors, and achieve high recognition accuracies, while the hardware cost is acceptable in practical applications.