Python object_detection.core.box_list_ops.select_random_box() Examples
The following are 28
code examples of object_detection.core.box_list_ops.select_random_box().
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.core.box_list_ops
, or try the search function
.
Example #1
Source File: box_list_ops_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #2
Source File: box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #3
Source File: box_list_ops_test.py From AniSeg with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #4
Source File: box_list_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #5
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #6
Source File: box_list_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #7
Source File: box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #8
Source File: box_list_ops_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #9
Source File: box_list_ops_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #10
Source File: box_list_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #11
Source File: box_list_ops_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #12
Source File: box_list_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #13
Source File: box_list_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #14
Source File: box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #15
Source File: box_list_ops_test.py From models with Apache License 2.0 | 5 votes |
def test_select_random_box(self): boxes = [[0., 0., 1., 1.], [0., 1., 2., 3.], [0., 2., 3., 4.]] def graph_fn(): corners = tf.constant(boxes, dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) return random_bbox, valid random_bbox_out, valid_out = self.execute(graph_fn, []) norm_small = any( [np.linalg.norm(random_bbox_out - box) < 1e-6 for box in boxes]) self.assertTrue(norm_small) self.assertTrue(valid_out)
Example #16
Source File: box_list_ops_test.py From models with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): def graph_fn(): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) return random_bbox, valid random_bbox_out, valid_out = self.execute_cpu(graph_fn, []) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #17
Source File: box_list_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #18
Source File: box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #19
Source File: box_list_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #20
Source File: box_list_ops_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #21
Source File: box_list_ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #22
Source File: box_list_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #23
Source File: box_list_ops_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #24
Source File: box_list_ops_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #25
Source File: box_list_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #26
Source File: box_list_ops_test.py From Person-Detection-and-Tracking with MIT License | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #27
Source File: box_list_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)
Example #28
Source File: box_list_ops_test.py From vehicle_counting_tensorflow with MIT License | 5 votes |
def test_select_random_box_with_empty_boxlist(self): corners = tf.constant([], shape=[0, 4], dtype=tf.float32) boxlist = box_list.BoxList(corners) random_bbox, valid = box_list_ops.select_random_box(boxlist) with self.test_session() as sess: random_bbox_out, valid_out = sess.run([random_bbox, valid]) expected_bbox_out = np.array([[-1., -1., -1., -1.]], dtype=np.float32) self.assertAllEqual(expected_bbox_out, random_bbox_out) self.assertFalse(valid_out)