Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
This repository contains a number of models optimized by Intel to run machine
learning workloads on Intel® Xeon® Scalable processors. For information on
how to run key benchmarks, see the [README](/benchmarks)
in the benchmarks folder. How-tos and tutorials can be found in the [docs](/docs) folder.
in the benchmarks folder. How-tos and tutorials can be found in the [docs](/docs) folder.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
* Intel-Optimized TensorFlow Serving:
* [Image Recognition](/docs/image_recognition/tensorflow_serving/Tutorial.md) (ResNet50 and InceptionV3)
* Object Detection (*coming soon*)


Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ def __init__(self):
'the benchmark will use random/dummy data.',
dest="data_location", default=None)

arg_parser.add_argument('-s', "--steps",
help='Specify the number of inference steps.',
dest="steps", default=40)

arg_parser.add_argument('-r', "--accuracy-only",
help='For accuracy measurement only.',
dest='accuracy_only', action='store_true')
# parse the arguments
self.args = arg_parser.parse_args()
# validate the arguements
# validate the arguments
self.validate_args()

def run(self):
Expand All @@ -92,7 +96,7 @@ def run(self):

with tf.Session(config=config) as sess:

# convert the freezed graph to optimized graph
# convert the frozen graph to optimized graph
graph_def = tf.GraphDef()
with tf.gfile.FastGFile(self.args.input_graph, 'rb') as input_file:
input_graph_content = input_file.read()
Expand Down Expand Up @@ -127,13 +131,12 @@ def run(self):
num_remaining_images = IMAGENET_VALIDATION_IMAGES

if (not self.args.accuracy_only): # performance check
iteration = 0
step = 0
warm_up_iteration = 10
total_run = 40
total_time = 0

while num_remaining_images >= self.args.batch_size and iteration < total_run:
iteration += 1
while num_remaining_images >= self.args.batch_size and step < self.args.steps:
step += 1

# Reads and preprocess data
if (self.args.data_location):
Expand All @@ -149,11 +152,11 @@ def run(self):
(predicts) = sess.run([output_tensor], feed_dict={input_tensor: image_np})
time_consume = time.time() - start_time

print('Iteration %d: %.3f sec' % (iteration, time_consume))
if iteration > warm_up_iteration:
print('Iteration %d: %.3f sec' % (step, time_consume))
if step > warm_up_iteration:
total_time += time_consume

time_average = total_time / (iteration - warm_up_iteration)
time_average = total_time / (step - warm_up_iteration)
print('Average time: %.3f sec' % (time_average))

print('Batch size = %d' % self.args.batch_size)
Expand Down