Digits Classification is a sample tutorial program for those who are new to OpenVX. It runs inference on handwritten digits with the MNIST NNEF model using OpenVX NNEF Import conformance feature set.
The NNEF Import Conformance Feature Set defines a minimum set of functions to import and execute neural networks described in the NNEF standard format.
Applications using this feature set will use the vxImportKernelFromURL
function to import an NNEF
file at the location of the URL
to create an OpenVX kernel
representing the neural network. This kernel can subsequently be used to create a node
in an OpenVX graph
, which can be executed using the normal OpenVX functions from the Base Feature Set. The inputs and outputs of the neural network node will be vx_tensor
objects.
This feature set is dependent on the Base feature set and the tensor data object, which must also be supported in order to support this feature set.
The name of this feature set is vx_khr_nnef_import
.
-
Conformant OpenVX 1.3 Implementation with NNEF Import Feature Set
-
Linux
X86_64
/Raspberry Pi
system -
OpenCV - For GUI
-
Step - 1: Build and install Conformant OpenVX Implementation. In this example we will use the OpenVX Sample Implementation available on GitHub
- Git Clone project with a recursive flag to get submodules
git clone --recursive https://github.com/KhronosGroup/OpenVX-sample-impl.git
- Use Build.py script on x86_64 system
cd OpenVX-sample-impl/ python Build.py --os=Linux --arch=64 --conf=Debug --conf_nnef
- Use Build.py script on Raspberry Pi system
cd OpenVX-sample-impl/ python Build.py --os=Linux --venum --conf=Debug --conf_nnef
-
Step - 2: Export OpenVX Directory Path
- x86_64 system
export OPENVX_DIR=$(pwd)/install/Linux/x64/Debug
- Raspberry Pi system
export OPENVX_DIR=$(pwd)/install/Linux/x32/Debug
-
Step - 3: Clone the project
Digit Classification
application
cd ~/ && mkdir OpenVXSample-nnef
cd OpenVXSample-nnef/
git clone https://github.com/kiritigowda/openvx.git
- Step - 4: CMake and Build
Digit Classification
application
mkdir nnef-build && cd nnef-build
cmake -DOPENVX_INCLUDES=$OPENVX_DIR/include -DOPENVX_LIBRARIES=$OPENVX_DIR/bin/libopenvx.so\;$OPENVX_DIR/bin/libvxu.so\;$OPENVX_DIR/bin/libnnef-lib.a\;pthread\;dl\;m\;rt ../openvx/digitClassification/
make
-
Step - 5: Run
Digit Classification
application- Usage
./DGTest [NNEF Model URL]
- MNIST NNEF
./DGTest ../openvx/digitClassification/mnist