Python object_detection.utils.np_box_list_ops.scale() Examples
The following are 30
code examples of object_detection.utils.np_box_list_ops.scale().
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.np_box_list_ops
, or try the search function
.
Example #1
Source File: np_box_list_ops_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #2
Source File: np_box_list_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #3
Source File: evaluator.py From mtl-ssl with Apache License 2.0 | 5 votes |
def _extract_groundtruth_values(example): _fields = fields.TfExampleFields result_dict = { 'image_id': example[_fields.source_id].bytes_list.value[0] } height = example[_fields.height].int64_list.value[0] width = example[_fields.width].int64_list.value[0] y_mins = [y_min for y_min in example[_fields.object_bbox_ymin].float_list.value] x_mins = [x_min for x_min in example[_fields.object_bbox_xmin].float_list.value] y_maxs = [y_max for y_max in example[_fields.object_bbox_ymax].float_list.value] x_maxs = [x_max for x_max in example[_fields.object_bbox_xmax].float_list.value] object_bboxes = np.asarray(zip(y_mins, x_mins, y_maxs, x_maxs)) if object_bboxes.size == 0: groundtruth_boxes = object_bboxes.reshape([0, 4]) else: normalized_gt_boxlist = np_box_list.BoxList(object_bboxes) gt_boxlist = np_box_list_ops.scale(normalized_gt_boxlist, height, width) groundtruth_boxes = gt_boxlist.get() result_dict['groundtruth_boxes'] = groundtruth_boxes result_dict['groundtruth_classes'] = \ np.asarray([label for label in example[_fields.object_class_label].int64_list.value]) result_dict['area'] = \ np.asarray([area for area in example[_fields.object_segment_area].float_list.value]) result_dict['difficult'] = \ np.asarray([difficult for difficult in example[_fields.object_difficult].int64_list.value]) # subset annotations if _fields.object_subset in example: result_dict['groundtruth_subset'] = \ np.asarray([subset for subset in example[_fields.object_subset].bytes_list.value]) return result_dict
Example #4
Source File: evaluator.py From mtl-ssl with Apache License 2.0 | 5 votes |
def _extract_groundtruth_tensors(create_input_dict_fn): input_dict = create_input_dict_fn() prefetch_queue = prefetcher.prefetch(input_dict, capacity=500) input_dict = prefetch_queue.dequeue() original_image = tf.expand_dims(input_dict[fields.InputDataFields.image], 0) tensor_dict = { 'image_id': input_dict[fields.InputDataFields.source_id] } normalized_gt_boxlist = box_list.BoxList( input_dict[fields.InputDataFields.groundtruth_boxes]) gt_boxlist = box_list_ops.scale(normalized_gt_boxlist, tf.shape(original_image)[1], tf.shape(original_image)[2]) groundtruth_boxes = gt_boxlist.get() groundtruth_classes = input_dict[fields.InputDataFields.groundtruth_classes] tensor_dict['groundtruth_boxes'] = groundtruth_boxes tensor_dict['groundtruth_classes'] = groundtruth_classes tensor_dict['area'] = input_dict[fields.InputDataFields.groundtruth_area] tensor_dict['difficult'] = input_dict[ fields.InputDataFields.groundtruth_difficult] # subset annotations if fields.InputDataFields.groundtruth_subset in input_dict: tensor_dict['groundtruth_subset'] \ = input_dict[fields.InputDataFields.groundtruth_subset] return tensor_dict
Example #5
Source File: np_box_list_ops_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #6
Source File: np_box_list_ops_test.py From motion-rcnn with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #7
Source File: np_box_list_ops_test.py From models with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #8
Source File: np_box_list_ops_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #9
Source File: np_box_list_ops_test.py From open-solution-googleai-object-detection with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #10
Source File: np_box_list_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #11
Source File: np_box_list_ops_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #12
Source File: np_box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #13
Source File: np_box_list_ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #14
Source File: np_box_list_ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #15
Source File: np_box_list_ops_test.py From MBMD with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #16
Source File: np_box_list_ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #17
Source File: np_box_list_ops_test.py From DOTA_models with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #18
Source File: np_box_list_ops_test.py From hands-detection with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #19
Source File: np_box_list_ops_test.py From moveo_ros with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #20
Source File: np_box_list_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #21
Source File: np_box_list_ops_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #22
Source File: np_box_list_ops_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #23
Source File: np_box_list_ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #24
Source File: np_box_list_ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #25
Source File: np_box_list_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #26
Source File: np_box_list_ops_test.py From yolo_v2 with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #27
Source File: np_box_list_ops_test.py From HereIsWally with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #28
Source File: np_box_list_ops_test.py From garbage-object-detection-tensorflow with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #29
Source File: np_box_list_ops_test.py From Person-Detection-and-Tracking with MIT License | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
Example #30
Source File: np_box_list_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def test_scale(self): boxlist = np_box_list.BoxList( np.array( [[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype= np.float32)) boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0) expected_boxlist_scaled = np_box_list.BoxList( np.array( [[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32)) self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())