当前位置: 首页>>代码示例>>Python>>正文


Python model.encode_coordinates_fn方法代码示例

本文整理汇总了Python中model.encode_coordinates_fn方法的典型用法代码示例。如果您正苦于以下问题:Python model.encode_coordinates_fn方法的具体用法?Python model.encode_coordinates_fn怎么用?Python model.encode_coordinates_fn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model.encode_coordinates_fn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_coordinate_encoding_is_correct_for_simple_example

# 需要导入模块: import model [as 别名]
# 或者: from model import encode_coordinates_fn [as 别名]
def test_coordinate_encoding_is_correct_for_simple_example(self):
    shape = (1, 2, 3, 4)  # batch_size, height, width, feature_size
    fake_conv_tower = tf.constant(2 * np.ones(shape), dtype=tf.float32)
    model = self.create_model()
    model.set_mparam('encode_coordinates_fn', enabled=True)
    conv_w_coords_tf = model.encode_coordinates_fn(fake_conv_tower)

    with self.test_session() as sess:
      conv_w_coords = sess.run(conv_w_coords_tf)

    # Original features
    self.assertAllEqual(conv_w_coords[0, :, :, :4],
                        [[[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]],
                         [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]])
    # Encoded coordinates
    self.assertAllEqual(conv_w_coords[0, :, :, 4:],
                        [[[1, 0, 1, 0, 0], [1, 0, 0, 1, 0], [1, 0, 0, 0, 1]],
                         [[0, 1, 1, 0, 0], [0, 1, 0, 1, 0], [0, 1, 0, 0, 1]]]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:20,代码来源:model_test.py

示例2: test_encoded_coordinates_have_correct_shape

# 需要导入模块: import model [as 别名]
# 或者: from model import encode_coordinates_fn [as 别名]
def test_encoded_coordinates_have_correct_shape(self):
    model = self.create_model()
    model.set_mparam('encode_coordinates_fn', enabled=True)
    conv_w_coords_tf = model.encode_coordinates_fn(self.fake_conv_tower)

    with self.test_session() as sess:
      conv_w_coords = sess.run(conv_w_coords_tf)

    batch_size, height, width, feature_size = self.conv_tower_shape
    self.assertEqual(conv_w_coords.shape, (batch_size, height, width,
                                           feature_size + height + width)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:13,代码来源:model_test.py

示例3: test_disabled_coordinate_encoding_returns_features_unchanged

# 需要导入模块: import model [as 别名]
# 或者: from model import encode_coordinates_fn [as 别名]
def test_disabled_coordinate_encoding_returns_features_unchanged(self):
    model = self.create_model()
    model.set_mparam('encode_coordinates_fn', enabled=False)
    conv_w_coords_tf = model.encode_coordinates_fn(self.fake_conv_tower)

    with self.test_session() as sess:
      conv_w_coords = sess.run(conv_w_coords_tf)

    self.assertAllEqual(conv_w_coords, self.fake_conv_tower_np) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:11,代码来源:model_test.py

示例4: test_alt_implementation_of_coordinate_encoding_returns_same_values

# 需要导入模块: import model [as 别名]
# 或者: from model import encode_coordinates_fn [as 别名]
def test_alt_implementation_of_coordinate_encoding_returns_same_values(self):
    model = self.create_model()
    model.set_mparam('encode_coordinates_fn', enabled=True)
    conv_w_coords_tf = model.encode_coordinates_fn(self.fake_conv_tower)
    conv_w_coords_alt_tf = self.encode_coordinates_alt(self.fake_conv_tower)

    with self.test_session() as sess:
      conv_w_coords_tf, conv_w_coords_alt_tf = sess.run(
          [conv_w_coords_tf, conv_w_coords_alt_tf])

    self.assertAllEqual(conv_w_coords_tf, conv_w_coords_alt_tf) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:13,代码来源:model_test.py


注:本文中的model.encode_coordinates_fn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。