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


Python pixelda_preprocess.preprocess_classification方法代码示例

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


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

示例1: assert_preprocess_classification_is_centered

# 需要导入模块: from domain_adaptation.pixel_domain_adaptation import pixelda_preprocess [as 别名]
# 或者: from domain_adaptation.pixel_domain_adaptation.pixelda_preprocess import preprocess_classification [as 别名]
def assert_preprocess_classification_is_centered(self, dtype, is_training):
    tf.set_random_seed(0)

    if dtype == tf.uint8:
      image = tf.random_uniform((100, 200, 3), maxval=255, dtype=tf.int64)
      image = tf.cast(image, tf.uint8)
    else:
      image = tf.random_uniform((100, 200, 3), maxval=1.0, dtype=dtype)

    labels = {}
    image, labels = pixelda_preprocess.preprocess_classification(
        image, labels, is_training=is_training)

    with self.test_session() as sess:
      np_image = sess.run(image)

      self.assertTrue(np_image.min() <= -0.95)
      self.assertTrue(np_image.min() >= -1.0)
      self.assertTrue(np_image.max() >= 0.95)
      self.assertTrue(np_image.max() <= 1.0) 
开发者ID:rky0930,项目名称:yolo_v2,代码行数:22,代码来源:pixelda_preprocess_test.py


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