Skip to content

Commit

Permalink
Fix dummy data performance problem for RN50 FP32 and InceptionV3 FP32…
Browse files Browse the repository at this point in the history
… (#204)
  • Loading branch information
Mandy Li authored and dmsuehir committed Feb 28, 2019
1 parent 8e64ea1 commit 0b51a70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def run(self):
tf.global_variables_initializer()

num_processed_images = 0
num_remaining_images = IMAGENET_VALIDATION_IMAGES

if (self.args.data_location):
print("Inference with real data.")
Expand All @@ -105,7 +106,8 @@ def run(self):
- num_processed_images
else:
print("Inference with dummy data.")
num_remaining_images = IMAGENET_VALIDATION_IMAGES
input_shape = [self.args.batch_size, INCEPTION_V3_IMAGE_SIZE, INCEPTION_V3_IMAGE_SIZE, 3]
images = tf.random.uniform(input_shape, 0.0, 255.0, dtype=tf.float32, name='synthetic_images')

if (not self.args.accuracy_only): # performance check
iteration = 0
Expand All @@ -121,8 +123,7 @@ def run(self):
preprocessed_images = sess.run([images[0]])
image_np = preprocessed_images[0]
else:
image_np = np.random.rand(self.args.batch_size, INCEPTION_V3_IMAGE_SIZE, INCEPTION_V3_IMAGE_SIZE, 3) \
.astype(np.uint8)
image_np = sess.run(images)

num_processed_images += self.args.batch_size
num_remaining_images -= self.args.batch_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def run(self):
tf.global_variables_initializer()

num_processed_images = 0
num_remaining_images = IMAGENET_VALIDATION_IMAGES

if (self.args.data_location):
print("Inference with real data.")
Expand All @@ -129,7 +130,8 @@ def run(self):
- num_processed_images
else:
print("Inference with dummy data.")
num_remaining_images = IMAGENET_VALIDATION_IMAGES
input_shape = [self.args.batch_size, RESNET_IMAGE_SIZE, RESNET_IMAGE_SIZE, 3]
images = tf.random.uniform(input_shape, 0.0, 255.0, dtype=tf.float32, name='synthetic_images')

if (not self.args.accuracy_only): # performance check
iteration = 0
Expand All @@ -145,7 +147,7 @@ def run(self):
preprocessed_images = sess.run([images[0]])
image_np = preprocessed_images[0]
else:
image_np = np.random.rand(self.args.batch_size, RESNET_IMAGE_SIZE, RESNET_IMAGE_SIZE, 3).astype(np.uint8)
image_np = sess.run(images)

num_processed_images += self.args.batch_size
num_remaining_images -= self.args.batch_size
Expand Down

0 comments on commit 0b51a70

Please sign in to comment.