Python tensorflow.core.example.feature_pb2.Int64List() Examples
The following are 30
code examples of tensorflow.core.example.feature_pb2.Int64List().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.core.example.feature_pb2
, or try the search function
.
Example #1
Source File: dataset_test.py From spotify-tensorflow with Apache License 2.0 | 6 votes |
def _write_test_data(): schema = feature_spec_to_schema({"f0": tf.VarLenFeature(dtype=tf.int64), "f1": tf.VarLenFeature(dtype=tf.int64), "f2": tf.VarLenFeature(dtype=tf.int64)}) batches = [ [1, 4, None], [2, None, None], [3, 5, None], [None, None, None], ] example_proto = [example_pb2.Example(features=feature_pb2.Features(feature={ "f" + str(i): feature_pb2.Feature(int64_list=feature_pb2.Int64List(value=[f])) for i, f in enumerate(batch) if f is not None })) for batch in batches] return DataUtil.write_test_data(example_proto, schema)
Example #2
Source File: input_reader_builder_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #3
Source File: tf_example_decoder_test.py From Person-Detection-and-Tracking with MIT License | 5 votes |
def _Int64FeatureFromList(self, ndarray): return feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=ndarray.flatten().tolist()))
Example #4
Source File: tf_example_decoder_test.py From Person-Detection-and-Tracking with MIT License | 5 votes |
def _Int64Feature(self, value): return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
Example #5
Source File: io_ops_test.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def setUp(self): super(ParseBase, self).setUp() examples = [ example_pb2.Example(features=feature_pb2.Features(feature={ 'a': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[1])), 'b': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2, 3, 4])), })), example_pb2.Example(features=feature_pb2.Features(feature={ 'a': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'b': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[6, 7, 8])), })), ] self.serialized = core.LabeledTensor( constant_op.constant([ex.SerializeToString() for ex in examples]), ['batch']) self.features = { 'a': io_ops.FixedLenFeature([], dtypes.int64), 'b': io_ops.FixedLenFeature([('x', 3)], dtypes.int64) }
Example #6
Source File: tf_example_decoder_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def _Int64FeatureFromList(self, ndarray): return feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=ndarray.flatten().tolist()))
Example #7
Source File: input_reader_builder_test.py From tensorflow with BSD 2-Clause "Simplified" License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #8
Source File: input_reader_builder_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #9
Source File: tf_example_decoder_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def _Int64Feature(self, value): return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
Example #10
Source File: tf_example_decoder_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def _Int64FeatureFromList(self, ndarray): return feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=ndarray.flatten().tolist()))
Example #11
Source File: input_reader_builder_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #12
Source File: tf_example_decoder_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def _Int64Feature(self, value): return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
Example #13
Source File: tf_example_decoder_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def _Int64FeatureFromList(self, ndarray): return feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=ndarray.flatten().tolist()))
Example #14
Source File: input_reader_builder_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #15
Source File: tf_example_decoder_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def _Int64Feature(self, value): return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
Example #16
Source File: tf_example_decoder_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def _Int64FeatureFromList(self, ndarray): return feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=ndarray.flatten().tolist()))
Example #17
Source File: input_reader_builder_test.py From object_detector_app with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #18
Source File: input_reader_builder_test.py From moveo_ros with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #19
Source File: input_reader_builder_test.py From hands-detection with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #20
Source File: input_reader_builder_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #21
Source File: input_reader_builder_test.py From MBMD with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #22
Source File: input_reader_builder_test.py From Elphas with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #23
Source File: input_reader_builder_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #24
Source File: input_reader_builder_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #25
Source File: input_reader_builder_test.py From AniSeg with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) flat_mask = (4 * 5) * [1.0] with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/height': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[4])), 'image/width': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), 'image/object/mask': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=flat_mask)), })) writer.write(example.SerializeToString()) writer.close() return path
Example #26
Source File: input_reader_builder_test.py From motion-rcnn with MIT License | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #27
Source File: input_reader_builder_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def create_tf_record(self): path = os.path.join(self.get_temp_dir(), 'tfrecord') writer = tf.python_io.TFRecordWriter(path) image_tensor = np.random.randint(255, size=(4, 5, 3)).astype(np.uint8) with self.test_session(): encoded_jpeg = tf.image.encode_jpeg(tf.constant(image_tensor)).eval() example = example_pb2.Example(features=feature_pb2.Features(feature={ 'image/encoded': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=[encoded_jpeg])), 'image/format': feature_pb2.Feature( bytes_list=feature_pb2.BytesList(value=['jpeg'.encode('utf-8')])), 'image/object/bbox/xmin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/xmax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/bbox/ymin': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[0.0])), 'image/object/bbox/ymax': feature_pb2.Feature( float_list=feature_pb2.FloatList(value=[1.0])), 'image/object/class/label': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2])), })) writer.write(example.SerializeToString()) writer.close() return path
Example #28
Source File: tfexample_decoder_test.py From keras-lambda with MIT License | 5 votes |
def _EncodedInt64Feature(self, ndarray): return feature_pb2.Feature(int64_list=feature_pb2.Int64List( value=ndarray.flatten().tolist()))
Example #29
Source File: test_utils.py From keras-lambda with MIT License | 5 votes |
def _encoded_int64_feature(ndarray): return feature_pb2.Feature(int64_list=feature_pb2.Int64List( value=ndarray.flatten().tolist()))
Example #30
Source File: io_ops_test.py From keras-lambda with MIT License | 5 votes |
def setUp(self): super(ParseBase, self).setUp() examples = [ example_pb2.Example(features=feature_pb2.Features(feature={ 'a': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[1])), 'b': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[2, 3, 4])), })), example_pb2.Example(features=feature_pb2.Features(feature={ 'a': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[5])), 'b': feature_pb2.Feature( int64_list=feature_pb2.Int64List(value=[6, 7, 8])), })), ] self.serialized = core.LabeledTensor( constant_op.constant([ex.SerializeToString() for ex in examples]), ['batch']) self.features = { 'a': io_ops.FixedLenFeature([], dtypes.int64), 'b': io_ops.FixedLenFeature([('x', 3)], dtypes.int64) }