Skip to content

hansely/DGtest

Repository files navigation

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 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

Userinterface class is for the gui functionality of the DGtest. It has the palette and the result window to draw the image and show the result output.

3. DGtest

DGtest class is where you actually run the inference. Using annAddToGraph() function in annmodule, it adds weights, input tensor, and output tensor to the graph. If it was successful, it preprocess the image and process the graph (runs the inference) using 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]\n"
 
 [weights.bin]
     The name of the weights file to be used for the inference. It is created by running caffemodel converter.
     See the belows section for using your own caffemodel.

Testing with your own Caffemodel

You can test your own 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.
3. Build the program again.
     make

Example

./DGTest ../data/weights.bin

About

Digit test using MIVisionX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published