×

Search anything:

Run TensorFlow Convolutional Neural Network (TF CNN) benchmarks in CPU

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

Reading time: 15 minutes

In this article, we will walk you through running the official benchmark of TensorFlow for Convolutional Neural Network on your machine (CPU). The process is simple and we have divided it into three simple steps.

Install TensorFlow

To install the basic version of TensorFlow, use the following command:

pip install tensorflow

To install and build TensorFlow from source code so that you can enable custom optimizations, then following this guide:

Build and install TensorFlow from source with MKL DNN support and AVX enabled

Get the benchmarking code

To get the benchmarking code, use the following command:

git clone https://github.com/tensorflow/benchmarks.git

Once done, move to the correct location using the following command:

cd benchmarks/scripts/tf_cnn_benchmarks/

Run the TF CNN benchmarks

To see the help option, use the following command:

python tf_cnn_benchmark.py --help

To run the benchmark for VGG19 model for data format NHWC, use the following command:

python tf_cnn_benchmark.py --model=vgg19 --data_format=NHWC

To undergo only forward run with batch size 32 and number of batches 100, use the following command:

python tf_cnn_benchmark.py --model=vgg19 --data_format=NHWC 
--forward_only --batch_size=32 --nun_batches=100

If you have install MKL enabled TensorFlow, use the following command:

python tf_cnn_benchmark.py --model=vgg19 --data_format=NHWC 
--forward_only --batch_size=32 --nun_batches=100 --mkl=True 
--num_inter_threads=1 --num_intra_threads=2

Various models are available in the TF CNN benchmark such as:

  • googlenet
  • resnet50
  • vgg19
  • inception3
OpenGenus Tech Review Team

OpenGenus Tech Review Team

The official account of OpenGenus's Technical Review Team. This team review all technical articles and incorporates peer feedback. The team consist of experts in the leading domains of Computing.

Read More

Improved & Reviewed by:


Run TensorFlow Convolutional Neural Network (TF CNN) benchmarks in CPU
Share this