mvNCCheck

Overview

mvNCCheck is a command line tool that checks the validity of a Caffe or TensorFlow* neural network on a neural compute device.

The check is done by running an inference on both the device and in software on the host computer using the supplied network and appropriate framework libraries. The results for both inferences are compared to determine a if the network passes or fails. The top 5 inference results are provided as output. This tool works best with image classification networks.

Syntax

Caffe

mvNCCheck network.prototxt [-w network.caffemodel] [-s max_number_of_shaves] [-in input_node_name] [-on output_node_name] [-is input_width input_height] [-i input_filename] [-id top1_validation_ID] [-S scale_factor] [-M mean_subtraction_number/npy_filename] [-cs color_sequence] [-es]

TensorFlow

mvNCCheck network.meta [-s max_number_of_shaves] [-in input_node_name] [-on output_node_name] [-is input_width input_height] [-i input_filename] [-id top1_validation_ID] [-S scale_factor] [-M mean_subtraction_number/npy_filename] [-cs color_sequence] [-es]
Argument Description
Caffe:
network.prototxt

TensorFlow:
network.meta
network.pb
Name of the network file (required).
[-h –help] Display help for the command.
[-w weights_file] Specify the weights filename from training. For Caffe this is the .caffemodel file. If omitted, zero weights will be used.

This option is not to be used for TensorFlow networks.
[-s max_number_of_shaves] Specify the maximum number of SHAVEs to use for network layers (default: 1).

The number of available SHAVEs depends on your neural compute device. The device runtime code may use fewer SHAVEs for some layers where measurements have typically shown no inference performance degradation (and consequently show a power benefit) from using fewer SHAVEs.
[-in input_node_name] Specify an alternative start point for the network. By default the network’s start point is the input layer. This option enables partial network processing. When used together with the -on option, the user can isolate one or more layers in a network for analysis.

This option is required for TensorFlow networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.
To add a named node that doesn’t change the network you can use the following:
x = tensorflow.identity(prev_tensor, name='new_node')
[-on output_node_name] Specify an alternative end point for the network. By default the network’s end point is the output layer. This option enables partial network processing. When used together with the -in option, the user can isolate one or more layers in a network for analysis.

Be aware that the parser will stop at the first instance of this node name (e.g., a Relu following a Conv will not be processed if it shares the same name).

This option is required for TensorFlow networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.
To add a named node that doesn’t change the network you can use the following:
x = tensorflow.identity(prev_tensor, name='new_node')
[-is input_width input_height] Specify input dimensions for networks that do not have dimension constraints on the input layer.

This option assumes that the batch size is 1 and the number of channels is 3.
[-i input_filename] Specify an input tensor to use for validation. If this is not set, a tensor with randomly generated data will be used.
[-S scale_factor] Use a divisor to scale each value of the input.

Typically images are stored with data for each input channel in range 0 to 255. If the neural network expects input values in range 0.0 to 1.0, using -S 255 will scale the data to the network’s expected range because each value will be divided by 255. If the network expects values in range -1.0 to 1.0, using -S 128 and -M 128 will scale the data to the network’s expected range.
[-M mean_subtraction_number]
[-M npy_filename]
Subtract mean values from the input data prior to passing to the neural network. This can be one value or a numpy mean file filename.
[-id top1_validation_ID] Provide the expected id for Top-1 validation.
[-cs color_sequence] Specify the color sequence that the neural network expects:
2,1,0 = BGR (default)
0,1,2 = RGB
[-ec] Skip certain compiler optimizations for concatenation; this may correct some issues with invalid results from concat layers or compile failures.

Examples

Caffe

mvNCCheck deploy.prototxt -w bvlc_googlenet.caffemodel -s 12 -in input -on prob -is 224 224 -cs 2,1,0

TensorFlow

mvNCCheck inception_v1.meta -s 12 -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -is 224 224 -cs 0,1,2

Further Reading