Python object_detection.utils.ops.dense_to_sparse_boxes() Examples
The following are 30
code examples of object_detection.utils.ops.dense_to_sparse_boxes().
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.ops
, or try the search function
.
Example #1
Source File: ops_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #2
Source File: ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #3
Source File: ops_test.py From HereIsWally with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #4
Source File: ops_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #5
Source File: ops_test.py From models with Apache License 2.0 | 6 votes |
def test_return_only_valid_boxes_when_input_contains_invalid_boxes(self): num_classes = 4 num_valid_boxes = 3 num_boxes = 10 code_size = 4 def graph_fn(dense_location, dense_num_boxes): box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location, dense_num_boxes, num_classes) return box_locations, box_classes dense_location_np = np.random.uniform(size=[num_boxes, code_size]) dense_num_boxes_np = np.array([1, 0, 0, 2], dtype=np.int32) expected_box_locations = dense_location_np[:num_valid_boxes] expected_box_classses = np.array([0, 3, 3]) # Executing on CPU only since output shape is not constant. box_locations, box_classes = self.execute_cpu( graph_fn, [dense_location_np, dense_num_boxes_np]) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #6
Source File: ops_test.py From models with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 def graph_fn(dense_location, dense_num_boxes): box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location, dense_num_boxes, num_classes) return box_locations, box_classes dense_location_np = np.random.uniform(size=[num_valid_boxes, code_size]) dense_num_boxes_np = np.array([1, 0, 0, 2], dtype=np.int32) expected_box_locations = dense_location_np expected_box_classses = np.array([0, 3, 3]) # Executing on CPU only since output shape is not constant. box_locations, box_classes = self.execute_cpu( graph_fn, [dense_location_np, dense_num_boxes_np]) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #7
Source File: ops_test.py From mtl-ssl with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #8
Source File: ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #9
Source File: ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #10
Source File: ops_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #11
Source File: ops_test.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #12
Source File: ops_test.py From object_detector_app with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #13
Source File: ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #14
Source File: ops_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #15
Source File: ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #16
Source File: ops_test.py From Elphas with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #17
Source File: ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #18
Source File: ops_test.py From monopsr with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #19
Source File: ops_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #20
Source File: ops_test.py From open-solution-googleai-object-detection with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #21
Source File: ops_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #22
Source File: ops_test.py From MBMD with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #23
Source File: ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #24
Source File: ops_test.py From MAX-Object-Detector with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #25
Source File: ops_test.py From moveo_ros with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #26
Source File: ops_test.py From hands-detection with MIT License | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #27
Source File: ops_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #28
Source File: ops_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #29
Source File: ops_test.py From AniSeg with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)
Example #30
Source File: ops_test.py From object_detection_kitti with Apache License 2.0 | 6 votes |
def test_return_all_boxes_when_all_input_boxes_are_valid(self): num_classes = 4 num_valid_boxes = 3 code_size = 4 dense_location_placeholder = tf.placeholder(tf.float32, shape=(num_valid_boxes, code_size)) dense_num_boxes_placeholder = tf.placeholder(tf.int32, shape=(num_classes)) box_locations, box_classes = ops.dense_to_sparse_boxes( dense_location_placeholder, dense_num_boxes_placeholder, num_classes) feed_dict = {dense_location_placeholder: np.random.uniform( size=[num_valid_boxes, code_size]), dense_num_boxes_placeholder: np.array([1, 0, 0, 2], dtype=np.int32)} expected_box_locations = feed_dict[dense_location_placeholder] expected_box_classses = np.array([0, 3, 3]) with self.test_session() as sess: box_locations, box_classes = sess.run([box_locations, box_classes], feed_dict=feed_dict) self.assertAllClose(box_locations, expected_box_locations, rtol=1e-6, atol=1e-6) self.assertAllEqual(box_classes, expected_box_classses)