Main Content

半精度データ型によるイメージの量子化

この例では、イメージに対する量子化の効果を説明します。ex_imagequantization モデルは、チェッカーボードのイメージの 2 次元フーリエ変換を計算します。一番左の列に元のイメージが表示されており、固定小数点、半精度、単精度データ型の結果が表示されています。結果のイメージから分かるように、固定小数点データ型では許容可能な結果が常に得られるとは限らないのに対し、固定小数点データ型と同じビット数を使用する半精度データ型では、単精度と同等の結果が得られています。

model = 'ex_image_quantization.slx';
open_system(model);
sim(model)

Figure contains 12 axes objects. Axes object 1 with title fixdt(1,16,4) contains an object of type image. Axes object 2 with title half precision contains an object of type image. Axes object 3 with title single precision contains an object of type image. Axes object 4 with title original chessboard image range [0, 1024] contains an object of type image. Axes object 5 with title fixdt(1,16,4) contains an object of type image. Axes object 6 with title half precision contains an object of type image. Axes object 7 with title single precision contains an object of type image. Axes object 8 with title original chessboard image range [0, 1] contains an object of type image. Axes object 9 with title fixdt(1,16,4) contains an object of type image. Axes object 10 with title half precision contains an object of type image. Axes object 11 with title single precision contains an object of type image. Axes object 12 with title original chessboard image range [0, 1/1024] contains an object of type image.