Beispiel #1
0
 def _testContrast(self, x_np, y_np, contrast_factor):
     for use_gpu in [True, False]:
         with self.test_session(use_gpu=use_gpu):
             x = constant_op.constant(x_np, shape=x_np.shape)
             y = image_ops.adjust_contrast(x, contrast_factor)
             y_tf = y.eval()
             self.assertAllClose(y_tf, y_np, 1e-6)
Beispiel #2
0
 def _testContrast(self, x_np, y_np, contrast_factor):
   for use_gpu in [True, False]:
     with self.test_session(use_gpu=use_gpu):
       x = constant_op.constant(x_np, shape=x_np.shape)
       y = image_ops.adjust_contrast(x, contrast_factor)
       y_tf = y.eval()
       self.assertAllClose(y_tf, y_np, 1e-6)
 def _adjustContrastTf(self, x_np, contrast_factor):
   with self.test_session():
     x = array_ops.placeholder(np.float32)
     with self.test_scope():
       y = image_ops.adjust_contrast(x, contrast_factor)
     y_tf = y.eval({x: x_np})
   return y_tf
Beispiel #4
0
 def _adjustContrastTf(self, x_np, contrast_factor):
     with self.test_session():
         x = array_ops.placeholder(np.float32)
         with self.test_scope():
             y = image_ops.adjust_contrast(x, contrast_factor)
         y_tf = y.eval({x: x_np})
     return y_tf
 def _testContrast(self, x_np, y_np, contrast_factor):
   with self.test_session():
     x = array_ops.placeholder(x_np.dtype, shape=x_np.shape)
     flt_x = image_ops.convert_image_dtype(x, dtypes.float32)
     with self.test_scope():
       y = image_ops.adjust_contrast(flt_x, contrast_factor)
     y = image_ops.convert_image_dtype(y, x.dtype, saturate=True)
     y_tf = y.eval({x: x_np})
     self.assertAllClose(y_tf, y_np, 1e-6)
Beispiel #6
0
 def _testContrast(self, x_np, y_np, contrast_factor):
     with self.test_session():
         x = array_ops.placeholder(x_np.dtype, shape=x_np.shape)
         flt_x = image_ops.convert_image_dtype(x, dtypes.float32)
         with self.test_scope():
             y = image_ops.adjust_contrast(flt_x, contrast_factor)
         y = image_ops.convert_image_dtype(y, x.dtype, saturate=True)
         y_tf = y.eval({x: x_np})
         self.assertAllClose(y_tf, y_np, 1e-6)
 def _testContrast(self, x_np, y_np, contrast_factor, min_value, max_value):
   for use_gpu in [True, False]:
     with self.test_session(use_gpu=use_gpu):
       x = constant_op.constant(x_np, shape=x_np.shape)
       y = image_ops.adjust_contrast(x,
                                     contrast_factor,
                                     min_value=min_value,
                                     max_value=max_value)
       y_tf = y.eval()
       self.assertAllEqual(y_tf, y_np)
 def _testContrast(self, x_np, y_np, contrast_factor, min_value, max_value):
     for use_gpu in [True, False]:
         with self.test_session(use_gpu=use_gpu):
             x = constant_op.constant(x_np, shape=x_np.shape)
             y = image_ops.adjust_contrast(x,
                                           contrast_factor,
                                           min_value=min_value,
                                           max_value=max_value)
             y_tf = y.eval()
             self.assertAllEqual(y_tf, y_np)