Quantization apparatus and method for artificial neural network and image processing device having the same
The present disclosure provides a quantization apparatus and method, and an image processing apparatus, capable of improving operation efficiency while suppressing performance degradation due to quantization errors by receiving one of a plurality of matrices obtained for neural network operation in an artificial neural network as an input matrix, dividing the input matrix into a plurality of channels, selecting a quantizer for each channel by analyzing the distribution of element values included in each of the plurality of divided channels, and quantizing element values included in the channels using the selected quantizer.
1 . A quantization apparatus, comprising:
a memory; and
a processor that executes at least a part of an operation according to a neural network model stored in the memory,
wherein the processor receives one of a plurality of matrices obtained for neural network operation in an artificial neural network as an input matrix, divides the input matrix into a plurality of channels,
selects a quantizer for each channel by analyzing the distribution of element values included in each of the plurality of divided channels, and
quantizes element values included in the channels using the selected quantizer,
wherein the processor converts an image input to the artificial neural network, thereby dividing the obtained input matrix into a plurality of channels according to color information.
2 . The quantization apparatus according to claim 1 ,
wherein the processor selects a quantizer for quantizing the element value of the corresponding channel by checking the maximum value and the minimum value of the element value included in each channel.
3 . The quantization apparatus according to claim 1 ,
wherein the processor selects a quantizer having a minimum error distance by comparing the maximum and minimum values of element values included in each channel with upper and lower limits according to quantization ranges of each of a plurality of quantizers.
4 . The quantization apparatus according to claim 1 ,
wherein the processor segments and converts the image input to the artificial neural network into a plurality of patches, thereby dividing the obtained input matrix into a plurality of channels according to each patch.
5 . The quantization apparatus according to claim 1 ,
wherein the processor converts the image input to the artificial neural network, thereby dividing the obtained input matrix into a plurality of channels according to pixels of the image.
6 . A quantization method, which is performed by a processor executing at least part of an operation according to a neural network model,
wherein the method includes the steps of:
receiving one of a plurality of matrices obtained for neural network operation in an artificial neural network as an input matrix, and dividing the input matrix into a plurality of channels;
selecting a quantizer for each channel by analyzing a distribution of element values included in each of the plurality of divided channels; and
quantizing element values included in the channels using the selected quantizer,
wherein the step of dividing the input matrix into a plurality of channels comprises converting an image input to the artificial neural network, thereby dividing the obtained input matrix into a plurality of channels according to color information.
7 . The quantization method according to claim 6 ,
wherein the step of selecting a quantizer comprises selecting a quantizer for quantizing the element value of the corresponding channel by checking the maximum value and the minimum value of the element value included in each channel.
8 . The quantization method according to claim 6 ,
wherein the step of selecting a quantizer comprises selecting a quantizer having a minimum error distance by comparing the maximum and minimum values of element values included in each channel with upper and lower limits according to quantization ranges of each of a plurality of quantizers.
9 . The quantization method according to claim 6 ,
wherein the step of dividing the input matrix into a plurality of channels comprises segmenting and converting the image input to the artificial neural network into a plurality of patches, thereby dividing the obtained input matrix into a plurality of channels according to each patch.
10 . The quantization method according to claim 6 ,
wherein the step of dividing the input matrix into a plurality of channels comprises segmenting and converting the image input to the artificial neural network into a plurality of patches, thereby dividing the obtained input matrix into a plurality of channels according to pixels of the image.