AN 998: Intel® FPGA AI Suite Inference on Quantized Graphs

ID 786296
Date 12/01/2023
Public

1.4. Programming the Hardware and Running Inference

To program the FPGA with an instance from the Intel FPGA AI Suite that supports quantization, issue the following commands:
curarch=$COREDLA_ROOT/example_architectures/AGX7_Quantized.arch
jtagdir=$COREDLA_WORK/runtime/build_Release/fpga_jtag_reprogram
bitsdir=$COREDLA_WORK/demo/bitstreams
$jtagdir/fpga_jtag_reprogram $bitsdir/AGX7_Quantized.sof
After the FPGA is programmed with the correct bitstream, you can run inference with the quantized ResNet-18 on the validation images from the Imagenette dataset. To run inference on the validation images, run the following commands:
imagedir=$COREDLA_WORK/demo/imagenette/imagenette2-160/organized
xmldir=~/build-quantization-env/openvino_notebooks/notebooks/\
305-tensorflow-quantization-aware-training/output
$COREDLA_WORK/runtime/build_Release/dla_benchmark/dla_benchmark \ 
  -b=1 \ 
  -m $xmldir/ResNet-18_int8.xml \ 
  -d=HETERO:FPGA \ 
  -niter=3925 \ 
  -plugins_xml_file $COREDLA_WORK/runtime/plugins.xml \ 
  -arch_file $curarch \ 
  -api=async \ 
  -perf_est \ 
  -nireq=1 \ 
  -i $imagedir \ 
  -groundtruth_loc $imagedir/correct_classifications.txt \
  -mean_values "[123.675, 116.28, 103.53]" \
  -scale_values "[58.395, 57.120000000000005, 57.375]"
After the command runs, you should see accuracy and performance information similar to the following example output:
[Step 12/12] Dumping the output values
[ INFO ] Dumping result of model to result.txt and result_tensor_boundaries.txt
[ INFO ] Comparing ground truth file ../correct_classifications.txt with network model
top1 accuracy: 95.5414 %
top5 accuracy: 99.9236 %
[ INFO ] Get top results for "model" graph passed