Algorithm and method for dynamically changing quantization precision of deep-learning network
Provided is an image recognition method including the steps of: for a deep learning network that carries out object recognition on a random image, carrying out quantization corresponding to the number of a plurality of different bits to generate a plurality of quantization models respectively corresponding to the number of bits; receiving image data as an input for the deep learning network; determining the uncertainty of the input image data; selecting any one of the plurality of quantization models on the basis of the determined uncertainty; and recognizing an object from the image data by using the selected quantization model, and outputting, as the result of the object recognition, a label corresponding to the image data.
1 . An image recognition method comprising:
generating a plurality of quantization models corresponding to a plurality of different bit numbers by performing quantization corresponding to the plurality of bit numbers on a deep learning network which performs object recognition on any image;
receiving image data as an input to the deep learning network;
determining uncertainty of the received image data at preset intervals;
selecting any one of the plurality of quantization models on the basis of the determined uncertainty; and
performing object recognition on the image data through the selected quantization model and outputting a label corresponding to the image data as an object recognition result,
wherein the determining of the uncertainty of the received image data at the preset intervals comprises determining uncertainty from every certain number of frames,
wherein the selecting of any one of the plurality of quantization models on the basis of the determined uncertainty comprises:
for a frame from which uncertainty has been determined, selecting any one of the plurality of quantization models using the determined uncertainty; and
for a frame from which uncertainty has not been determined, selecting any one of the plurality of quantization models using uncertainty determined from a previous frame.
2 . The image recognition method of claim 1 , further comprising changing the intervals for determining uncertainty on the basis of the determined uncertainty.
3 . The image recognition method of claim 1 , wherein the generating of the plurality of quantization models comprises:
generating a first quantization model corresponding to 8 bits;
generating a second quantization model corresponding to 4 bits; and
generating a third quantization model corresponding to 2 bits.
4 . The image recognition method of claim 3 , wherein the selecting any one of the plurality of quantization models comprises, when the determined uncertainty is a preset first reference value or more, selecting the first quantization model.
5 . The image recognition method of claim 4 , wherein the selecting of any one of the plurality of quantization models comprises, when the determined uncertainty is a preset second reference value or less, selecting the third quantization model.
6 . The image recognition method of claim 1 , wherein the determining of the uncertainty comprises:
calculating probabilities that the input image data will correspond to a plurality of classes related to object recognition of the deep learning network; and
calculating an uncertainty score on the basis of the probabilities calculated according to the plurality of classes.
7 . The image recognition method of claim 1 , wherein the determining of the uncertainty is performed by an uncertainty determination network which is separate from the deep learning network, and
the uncertainty determination network includes a smaller number of layers than the deep learning network.
8 . An image recognition method comprising:
generating a plurality of quantization models corresponding to a plurality of different bit numbers by performing quantization corresponding to the plurality of bit numbers on a deep learning network which performs object recognition on any image;
receiving image data as an input to the deep learning network;
determining uncertainty of the received image data at preset intervals;
selecting any one of the plurality of quantization models on the basis of the determined uncertainty; and
performing object recognition on the image data through the selected quantization model and outputting a label corresponding to the image data as an object recognition result,
wherein the determining of the uncertainty is performed by an uncertainty determination network which is separate from the deep learning network, and
the uncertainty determination network includes a smaller number of layers than the deep learning network.
9 . The image recognition method of claim 8 , wherein the determining of the uncertainty of the received image data at the preset intervals comprises determining uncertainty from every certain number of frames.
10 . The image recognition method of claim 8 , further comprising changing the intervals for determining uncertainty on the basis of the determined uncertainty.
11 . The image recognition method of claim 8 , wherein the generating of the plurality of quantization models comprises:
generating a first quantization model corresponding to 8 bits;
generating a second quantization model corresponding to 4 bits; and
generating a third quantization model corresponding to 2 bits.
12 . The image recognition method of claim 11 , wherein the selecting any one of the plurality of quantization models comprises, when the determined uncertainty is a preset first reference value or more, selecting the first quantization model.
13 . The image recognition method of claim 12 , wherein the selecting of any one of the plurality of quantization models comprises, when the determined uncertainty is a preset second reference value or less, selecting the third quantization model.
14 . The image recognition method of claim 8 , wherein the determining of the uncertainty comprises:
calculating probabilities that the input image data will correspond to a plurality of classes related to object recognition of the deep learning network; and
calculating an uncertainty score on the basis of the probabilities calculated according to the plurality of classes.