本文整理匯總了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)