|
| 1 | +.. SPDX-License-Identifier: Marvell-MIT |
| 2 | + Copyright (c) 2024 Marvell. |
| 3 | +
|
| 4 | +**************** |
| 5 | +Machine Learning |
| 6 | +**************** |
| 7 | + |
| 8 | +Introduction |
| 9 | +============ |
| 10 | + |
| 11 | +The Data Plane Development Kit (DPDK) is an open-source software project managed by the Linux Foundation. It is designed to offload TCP packet processing from the operating system kernel to user-space processes, thereby enhancing computing efficiency and packet throughput. |
| 12 | + |
| 13 | +The ``dpdk-test-mldev`` tool is a DPDK application designed to test various machine learning (mldev) use cases. As part of the DAO package, it provides a way for users to run inference operations with specific inputs. The current DAO release provides int8 ( ``resnet50_int8_t08_b01`` ) and fp16 ( ``resnet50_fp16_t08_b01`` ) quantized versions of Resnet50 models, which can be used for running inference operations. |
| 14 | + |
| 15 | +.. note:: |
| 16 | + For detailed documentation related to dpdk-test-mldev, refer to `documentation <https://doc.dpdk.org/guides/tools/testmldev.html>`_ |
| 17 | + |
| 18 | +Preprocessing of Input |
| 19 | +====================== |
| 20 | + |
| 21 | +Involves converting the input image format to a binary format that the model can accept as an input. This is done using the ``image2bin.py`` Python script. |
| 22 | + |
| 23 | +.. code-block:: console |
| 24 | +
|
| 25 | + # Convert input in Image format to binary format |
| 26 | + python image2bin.py \ |
| 27 | + --image_file input.jpeg \ |
| 28 | + --bin_file output.bin |
| 29 | +
|
| 30 | +Model Execution |
| 31 | +=============== |
| 32 | + |
| 33 | +The preprocessed binary is given as an input to the model. The model processes the input, runs the inference operation, and generates the output in binary format. |
| 34 | + |
| 35 | +.. code-block:: console |
| 36 | +
|
| 37 | + # Run inferences with dpdk-test-mldev application |
| 38 | + dpdk-test-mldev --lcores=4-23 -a 0000:00:10.0,fw_path=/lib/firmware/mlip-fw.bin -- \ |
| 39 | + --test inference_ordered \ |
| 40 | + --filelist model.tar,input.bin,output.bin,reference.bin \ |
| 41 | + --tolerance 5 \ |
| 42 | + --stats \ |
| 43 | + --repetitions 1000 |
| 44 | +
|
| 45 | +Postprocessing of Output |
| 46 | +======================== |
| 47 | + |
| 48 | +The binary output generated by the model is converted into a JSON file for easier interpretation and analysis. This is done using the ``bin2json.py`` Python script. |
| 49 | + |
| 50 | +.. code-block:: console |
| 51 | +
|
| 52 | + # Convert output in binary format to JSON format |
| 53 | + python bin2json.py \ |
| 54 | + --bin_file output.bin \ |
| 55 | + --json_file output.json |
0 commit comments