Skip to content

Commit

Permalink
Updated rapid-image-classifier to print out inference time.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinvijayakumar committed Dec 29, 2017
1 parent d055759 commit 5e39abc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/rapid-image-classifier/rapid-image-classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def infer_image( graph, file_list, imgarray, print_imgarray ):
# Get the results from NCS
output, userobj = graph.GetResult()

# Get execution time
inference_time = graph.GetGraphOption( mvnc.GraphOption.TIMETAKEN )

# Find the index of highest confidence
top_prediction = output.argmax()

Expand All @@ -120,7 +123,8 @@ def infer_image( graph, file_list, imgarray, print_imgarray ):
+ ntpath.basename( file_list[index] )
+ ": " + labels[top_prediction]
+ " with %3.1f%% confidence"
% (100.0 * output[top_prediction] ) )
% (100.0 * output[top_prediction] )
+ " in %.2f ms" % ( numpy.sum( inference_time ) ) )

# Display the image on which inference was performed
# ---------------------------------------------------------
Expand Down

0 comments on commit 5e39abc

Please sign in to comment.