Python object_detection.utils.shape_utils.pad_tensor() Examples
The following are 30
code examples of object_detection.utils.shape_utils.pad_tensor().
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
object_detection.utils.shape_utils
, or try the search function
.
Example #1
Source File: shape_utils_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #2
Source File: shape_utils_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #3
Source File: shape_utils_test.py From hands-detection with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #4
Source File: shape_utils_test.py From open-solution-googleai-object-detection with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #5
Source File: shape_utils_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #6
Source File: shape_utils_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #7
Source File: shape_utils_test.py From open-solution-googleai-object-detection with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #8
Source File: shape_utils_test.py From models with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): def graph_fn(): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) return pad_t1, pad_t2 pad_t1_result, pad_t2_result = self.execute(graph_fn, []) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #9
Source File: shape_utils_test.py From motion-rcnn with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #10
Source File: shape_utils_test.py From motion-rcnn with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #11
Source File: shape_utils_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #12
Source File: shape_utils_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #13
Source File: shape_utils_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #14
Source File: shape_utils_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #15
Source File: shape_utils_test.py From models with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): print('........pad tensor using interger input.') def graph_fn(): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) return pad_t1, pad_t2 pad_t1_result, pad_t2_result = self.execute(graph_fn, []) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #16
Source File: shape_utils_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #17
Source File: shape_utils_test.py From monopsr with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #18
Source File: shape_utils_test.py From monopsr with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #19
Source File: shape_utils_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #20
Source File: shape_utils_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #21
Source File: shape_utils_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #22
Source File: shape_utils_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #23
Source File: shape_utils_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #24
Source File: shape_utils_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #25
Source File: shape_utils_test.py From MBMD with MIT License | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #26
Source File: shape_utils_test.py From MBMD with MIT License | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #27
Source File: shape_utils_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #28
Source File: shape_utils_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #29
Source File: shape_utils_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_tensor_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, tf.constant(2)) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, tf.constant(2)) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)
Example #30
Source File: shape_utils_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def test_pad_tensor_using_integer_input(self): t1 = tf.constant([1], dtype=tf.int32) pad_t1 = shape_utils.pad_tensor(t1, 2) t2 = tf.constant([[0.1, 0.2]], dtype=tf.float32) pad_t2 = shape_utils.pad_tensor(t2, 2) self.assertEqual(2, pad_t1.get_shape()[0]) self.assertEqual(2, pad_t2.get_shape()[0]) with self.test_session() as sess: pad_t1_result, pad_t2_result = sess.run([pad_t1, pad_t2]) self.assertAllEqual([1, 0], pad_t1_result) self.assertAllClose([[0.1, 0.2], [0, 0]], pad_t2_result)