本文整理汇总了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)