當前位置: 首頁>>代碼示例>>Python>>正文


Python ops.matmul_crop_and_resize方法代碼示例

本文整理匯總了Python中object_detection.utils.ops.matmul_crop_and_resize方法的典型用法代碼示例。如果您正苦於以下問題:Python ops.matmul_crop_and_resize方法的具體用法?Python ops.matmul_crop_and_resize怎麽用?Python ops.matmul_crop_and_resize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在object_detection.utils.ops的用法示例。


在下文中一共展示了ops.matmul_crop_and_resize方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testBatchMatMulCropAndResize3x3To2x2_2Channels

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testBatchMatMulCropAndResize3x3To2x2_2Channels(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1, 0], [2, 1], [3, 2]],
                       [[4, 3], [5, 4], [6, 5]],
                       [[7, 6], [8, 7], [9, 8]]],
                      [[[1, 0], [2, 1], [3, 2]],
                       [[4, 3], [5, 4], [6, 5]],
                       [[7, 6], [8, 7], [9, 8]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1],
                       [0, 0, .5, .5]],
                      [[1, 1, 0, 0],
                       [.5, .5, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[1, 0], [3, 2]], [[7, 6], [9, 8]]],
                        [[[1, 0], [2, 1]], [[4, 3], [5, 4]]]],
                       [[[[9, 8], [7, 6]], [[3, 2], [1, 0]]],
                        [[[5, 4], [4, 3]], [[2, 1], [1, 0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:23,代碼來源:ops_test.py

示例2: testMatMulCropAndResize2x2To1x1

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To1x1(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1]]], dtype=np.float32)
    expected_output = [[[[[2.5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:12,代碼來源:ops_test.py

示例3: testMatMulCropAndResize2x2To1x1Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To1x1Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[2.5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:12,代碼來源:ops_test.py

示例4: testMatMulCropAndResize2x2To3x3

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To3x3(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1]]], dtype=np.float32)
    expected_output = [[[[[1.0], [1.5], [2.0]],
                         [[2.0], [2.5], [3.0]],
                         [[3.0], [3.5], [4.0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:14,代碼來源:ops_test.py

示例5: testMatMulCropAndResize2x2To3x3Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To3x3Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[4.0], [3.5], [3.0]],
                         [[3.0], [2.5], [2.0]],
                         [[2.0], [1.5], [1.0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:14,代碼來源:ops_test.py

示例6: testMatMulCropAndResize3x3To2x2

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize3x3To2x2(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1],
                       [0, 0, .5, .5]]], dtype=np.float32)
    expected_output = [[[[[1], [3]], [[7], [9]]],
                        [[[1], [2]], [[4], [5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:16,代碼來源:ops_test.py

示例7: testMatMulCropAndResize3x3To2x2Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize3x3To2x2Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0],
                       [.5, .5, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[9], [7]], [[3], [1]]],
                        [[[5], [4]], [[2], [1]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:16,代碼來源:ops_test.py

示例8: testInvalidInputShape

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testInvalidInputShape(self):
    image = tf.constant([[[1], [2]], [[3], [4]]], dtype=tf.float32)
    boxes = tf.constant([[-1, -1, 1, 1]], dtype=tf.float32)
    crop_size = [4, 4]
    with self.assertRaises(ValueError):
      _ = ops.matmul_crop_and_resize(image, boxes, crop_size) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:8,代碼來源:ops_test.py

示例9: testMatMulCropAndResize2x2To1x1

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To1x1(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1]], dtype=np.float32)
    expected_output = [[[[2.5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:12,代碼來源:ops_test.py

示例10: testMatMulCropAndResize2x2To1x1Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To1x1Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0]], dtype=np.float32)
    expected_output = [[[[2.5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:12,代碼來源:ops_test.py

示例11: testMatMulCropAndResize2x2To3x3

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To3x3(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1]], dtype=np.float32)
    expected_output = [[[[1.0], [1.5], [2.0]],
                        [[2.0], [2.5], [3.0]],
                        [[3.0], [3.5], [4.0]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:14,代碼來源:ops_test.py

示例12: testMatMulCropAndResize2x2To3x3Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize2x2To3x3Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0]], dtype=np.float32)
    expected_output = [[[[4.0], [3.5], [3.0]],
                        [[3.0], [2.5], [2.0]],
                        [[2.0], [1.5], [1.0]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:14,代碼來源:ops_test.py

示例13: testMatMulCropAndResize3x3To2x2

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize3x3To2x2(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1],
                      [0, 0, .5, .5]], dtype=np.float32)
    expected_output = [[[[1], [3]], [[7], [9]]],
                       [[[1], [2]], [[4], [5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:16,代碼來源:ops_test.py

示例14: testMatMulCropAndResize3x3To2x2Flipped

# 需要導入模塊: from object_detection.utils import ops [as 別名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 別名]
def testMatMulCropAndResize3x3To2x2Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0],
                      [.5, .5, 0, 0]], dtype=np.float32)
    expected_output = [[[[9], [7]], [[3], [1]]],
                       [[[5], [4]], [[2], [1]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:16,代碼來源:ops_test.py


注:本文中的object_detection.utils.ops.matmul_crop_and_resize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。