def get_synthetic_inputs(self, input_name, nclass): """Generating synthetic data matching real data shape and type.""" inputs = tf.random_uniform( self.get_input_shapes('train')[0], dtype=self.data_type) inputs = contrib_framework.local_variable(inputs, name=input_name) boxes = tf.random_uniform( [self.batch_size, ssd_constants.NUM_SSD_BOXES, 4], dtype=tf.float32) classes = tf.random_uniform( [self.batch_size, ssd_constants.NUM_SSD_BOXES, 1], dtype=tf.float32) nboxes = tf.random_uniform( [self.batch_size], minval=1, maxval=10, dtype=tf.float32) return (inputs, boxes, classes, nboxes)
def get_synthetic_inputs(self, input_name, nclass): # Synthetic input should be within [0, 255]. image_shape, label_shape = self.get_input_shapes('train') inputs = tf.truncated_normal(image_shape, dtype=self.data_type, mean=127, stddev=60, name=self.model_name + '_synthetic_inputs') inputs = contrib_framework.local_variable(inputs, name=input_name) labels = tf.random_uniform(label_shape, minval=0, maxval=nclass - 1, dtype=tf.int32, name=self.model_name + '_synthetic_labels') return (inputs, labels)
def _streaming_sum(scalar_tensor): """Create a sum metric and update op.""" sum_metric = framework.local_variable(constant_op.constant(0.0)) sum_update = sum_metric.assign_add(scalar_tensor) return sum_metric, sum_update
def _streaming_sum(scalar_tensor): """Create a sum metric and update op.""" sum_metric = framework.local_variable(constant_op.constant(0.0)) sum_update = sum_metric.assign_add(scalar_tensor) return sum_metric, sum_update