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


Python static_shape.get_depth方法代碼示例

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


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

示例1: test_return_correct_depth

# 需要導入模塊: from object_detection.utils import static_shape [as 別名]
# 或者: from object_detection.utils.static_shape import get_depth [as 別名]
def test_return_correct_depth(self):
    tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3])
    self.assertEqual(3, static_shape.get_depth(tensor_shape)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:5,代碼來源:static_shape_test.py

示例2: test_die_on_tensor_shape_with_rank_three

# 需要導入模塊: from object_detection.utils import static_shape [as 別名]
# 或者: from object_detection.utils.static_shape import get_depth [as 別名]
def test_die_on_tensor_shape_with_rank_three(self):
    tensor_shape = tf.TensorShape(dims=[32, 299, 384])
    with self.assertRaises(ValueError):
      static_shape.get_batch_size(tensor_shape)
      static_shape.get_height(tensor_shape)
      static_shape.get_width(tensor_shape)
      static_shape.get_depth(tensor_shape) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:9,代碼來源:static_shape_test.py

示例3: build

# 需要導入模塊: from object_detection.utils import static_shape [as 別名]
# 或者: from object_detection.utils.static_shape import get_depth [as 別名]
def build(self, input_shapes):
    """Creates the variables of the layer."""
    if len(input_shapes) != len(self._prediction_heads[BOX_ENCODINGS]):
      raise ValueError('This box predictor was constructed with %d heads,'
                       'but there are %d inputs.' %
                       (len(self._prediction_heads[BOX_ENCODINGS]),
                        len(input_shapes)))
    for stack_index, input_shape in enumerate(input_shapes):
      net = []

      # Add additional conv layers before the class predictor.
      features_depth = static_shape.get_depth(input_shape)
      depth = max(min(features_depth, self._max_depth), self._min_depth)
      tf.logging.info(
          'depth of additional conv before box predictor: {}'.format(depth))

      if depth > 0 and self._num_layers_before_predictor > 0:
        for i in range(self._num_layers_before_predictor):
          net.append(keras.Conv2D(depth, [1, 1],
                                  name='SharedConvolutions_%d/Conv2d_%d_1x1_%d'
                                  % (stack_index, i, depth),
                                  padding='SAME',
                                  **self._conv_hyperparams.params()))
          net.append(self._conv_hyperparams.build_batch_norm(
              training=(self._is_training and not self._freeze_batchnorm),
              name='SharedConvolutions_%d/Conv2d_%d_1x1_%d_norm'
              % (stack_index, i, depth)))
          net.append(self._conv_hyperparams.build_activation_layer(
              name='SharedConvolutions_%d/Conv2d_%d_1x1_%d_activation'
              % (stack_index, i, depth),
          ))
      # Until certain bugs are fixed in checkpointable lists,
      # this net must be appended only once it's been filled with layers
      self._shared_nets.append(net)
    self.built = True 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:37,代碼來源:convolutional_keras_box_predictor.py


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