Python object_detection.core.keypoint_ops.clip_to_window() Examples
The following are 30
code examples of object_detection.core.keypoint_ops.clip_to_window().
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.keypoint_ops
, or try the search function
.
Example #1
Source File: keypoint_ops_test.py From hands-detection with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #2
Source File: keypoint_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #3
Source File: keypoint_ops_test.py From mtl-ssl with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #4
Source File: keypoint_ops_test.py From motion-rcnn with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #5
Source File: keypoint_ops_test.py From models with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): def graph_fn(): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) return output, expected_keypoints output, expected_keypoints = self.execute(graph_fn, []) self.assertAllClose(output, expected_keypoints)
Example #6
Source File: keypoint_ops_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #7
Source File: keypoint_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #8
Source File: keypoint_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #9
Source File: keypoint_ops_test.py From AniSeg with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #10
Source File: keypoint_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #11
Source File: keypoint_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #12
Source File: keypoint_ops_test.py From Elphas with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #13
Source File: keypoint_ops_test.py From MBMD with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #14
Source File: keypoint_ops_test.py From object_detection_kitti with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #15
Source File: keypoint_ops_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #16
Source File: keypoint_ops_test.py From moveo_ros with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #17
Source File: keypoint_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #18
Source File: keypoint_ops_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #19
Source File: keypoint_ops_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #20
Source File: keypoint_ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #21
Source File: keypoint_ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #22
Source File: keypoint_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #23
Source File: keypoint_ops_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #24
Source File: keypoint_ops_test.py From HereIsWally with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #25
Source File: keypoint_ops_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #26
Source File: keypoint_ops_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #27
Source File: keypoint_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #28
Source File: keypoint_ops_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #29
Source File: keypoint_ops_test.py From object_detector_app with MIT License | 6 votes |
def test_clip_to_window(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) window = tf.constant([0.25, 0.25, 0.75, 0.75]) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.25], [0.75, 0.75]] ]) output = keypoint_ops.clip_to_window(keypoints, window) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #30
Source File: center_net_meta_arch.py From models with Apache License 2.0 | 5 votes |
def convert_strided_predictions_to_normalized_boxes(boxes, stride, true_image_shapes): """Converts predictions in the output space to normalized boxes. Boxes falling outside the valid image boundary are clipped to be on the boundary. Args: boxes: A tensor of shape [batch_size, num_boxes, 4] holding the raw coordinates of boxes in the model's output space. stride: The stride in the output space. true_image_shapes: A tensor of shape [batch_size, 3] representing the true shape of the input not considering padding. Returns: boxes: A tensor of shape [batch_size, num_boxes, 4] representing the coordinates of the normalized boxes. """ def _normalize_boxlist(args): boxes, height, width = args boxes = box_list_ops.scale(boxes, stride, stride) boxes = box_list_ops.to_normalized_coordinates(boxes, height, width) boxes = box_list_ops.clip_to_window(boxes, [0., 0., 1., 1.], filter_nonoverlapping=False) return boxes box_lists = [box_list.BoxList(boxes) for boxes in tf.unstack(boxes, axis=0)] true_heights, true_widths, _ = tf.unstack(true_image_shapes, axis=1) true_heights_list = tf.unstack(true_heights, axis=0) true_widths_list = tf.unstack(true_widths, axis=0) box_lists = list(map(_normalize_boxlist, zip(box_lists, true_heights_list, true_widths_list))) boxes = tf.stack([box_list_instance.get() for box_list_instance in box_lists], axis=0) return boxes