MIVisionX DGtest#

MIVisionX DGtest is a tutorial program for those who are new to MIOpen & OpenVX. It runs inference on the MNIST dataset using MIOpen & OpenVX.

Explanation#

The program is divided into four parts:

1. annmodule#

annmodule is created by the AMD model compiler. You can convert your own trained caffemodel to an openvx graph using the model-compiler. See the below section for the detailed instruction. Once the conversion is done, the corresponding c++ codes will be generated including annmodule which contains the information about your pre-trained caffemodel.

2. Userinterface#

The user-interface class is for the GUI functionality of the DGtest. It has the palette and the result window to draw the image and show the resulting output.

3. DGtest#

DGtest class is where you run the inference. Using the annAddToGraph() function in annmodule, it adds weights, input tensor, and output tensor to the graph. If it was successful, it preprocesses the image and processes the graph (runs the inference) using the vxProcessGraph() function.

See the OpenVX documentation for detailed explanation about OpenVX API calls.

Pre-requisites#

  1. Build & Install MIVisionX

  2. OpenCV 3.1 or higher

Build using Cmake on Linux (Ubuntu 16.04 64bit)#

 mkdir build
 cd build
 cmake ..
 make

Usage#

Usage:

./DGtest [weights.bin]

weights.bin: The name of the weights file to be used for the inference. It is created by running a caffemodel converter. See the below section for using your caffemodel.

Testing with your Caffemodel#

You can test your trained MNIST caffemodel using the model compiler

  1. Convert your caffemodel->NNIR->openvx using the model compiler.

  2. From the generated files, copy

 annmodule.cpp
 annmodule.h
 weights.bin

to the DGtest folder.

  1. Build the program again.

 make

Example#

 ./DGTest ../data/weights.bin