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


Python preprocessing.preprocess_images方法代碼示例

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


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

示例1: preprocess

# 需要導入模塊: import preprocessing [as 別名]
# 或者: from preprocessing import preprocess_images [as 別名]
def preprocess(self, inputs):
        """preprocessing.
        
        Outputs of this function can be passed to loss or postprocess functions.
        
        Args:
            preprocessed_inputs: A float32 tensor with shape [batch_size,
                height, width, num_channels] representing a batch of images.
            
        Returns:
            prediction_dict: A dictionary holding prediction tensors to be
                passed to the Loss or Postprocess functions.
        """
        preprocessed_inputs = preprocessing.preprocess_images(
            inputs, self._default_image_size, self._default_image_size, 
            resize_side_min=self._fixed_resize_side,
            is_training=self._is_training,
            border_expand=True, normalize=False,
            preserving_aspect_ratio_resize=False)
        preprocessed_inputs = tf.cast(preprocessed_inputs, tf.float32)
        return preprocessed_inputs 
開發者ID:Shirhe-Lyh,項目名稱:finetune_classification,代碼行數:23,代碼來源:model.py

示例2: preprocess_data

# 需要導入模塊: import preprocessing [as 別名]
# 或者: from preprocessing import preprocess_images [as 別名]
def preprocess_data(self, images, is_training):
    """Preprocesses raw images for either training or inference.

    Args:
      images: A 4-D float32 `Tensor` holding images to preprocess.
      is_training: Boolean, whether or not we're in training.

    Returns:
      data_preprocessed: data after the preprocessor.
    """
    config = self._config
    height = config.data.height
    width = config.data.width
    min_scale = config.data.augmentation.minscale
    max_scale = config.data.augmentation.maxscale
    p_scale_up = config.data.augmentation.proportion_scaled_up
    aug_color = config.data.augmentation.color
    fast_mode = config.data.augmentation.fast_mode
    crop_strategy = config.data.preprocessing.eval_cropping
    preprocessed_images = preprocessing.preprocess_images(
        images, is_training, height, width,
        min_scale, max_scale, p_scale_up,
        aug_color=aug_color, fast_mode=fast_mode,
        crop_strategy=crop_strategy)
    return preprocessed_images 
開發者ID:rky0930,項目名稱:yolo_v2,代碼行數:27,代碼來源:base_estimator.py


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