class_docstr: Unit test class for testing scikit-learn converter.
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","converter","."]
docstr: Test the image-processing parameters.
docstr_tok: ["Test","the","image-processing","parameters","."]
code: def test_image_processing(self):
      """
      Test the image-processing parameters.
      """
      from keras.layers import Conv2D
  
      # Create a simple Keras model
      model = Sequential()
      model.add(
          Conv2D(
              input_shape=(64, 64, 3),
              filters=32,
              kernel_size=(5, 5),
              activation=None,
              padding="valid",
              strides=(1, 1),
              use_bias=True,
          )
      )
      input_names = ["input"]
      output_names = ["output"]
      spec = keras.convert(
          model,
          input_names,
          output_names,
          image_input_names=["input"],
          red_bias=110.0,
          blue_bias=117.0,
          green_bias=120.0,
          is_bgr=True,
          image_scale=1.0,
      ).get_spec()
      self.assertIsNotNone(spec)
  
      # Test the model class
      self.assertIsNotNone(spec.description)
      self.assertTrue(spec.HasField("neuralNetwork"))
      self.assertEquals(
          spec.description.input[0].type.WhichOneof("Type"), "imageType"
      )
      self.assertEquals(
          spec.description.input[0].type.imageType.colorSpace,
          FeatureTypes_pb2.ImageFeatureType.ColorSpace.Value("BGR"),
      )
  
      # Test the layer parameters.
      preprocessing = spec.neuralNetwork.preprocessing[0]
      self.assertTrue(preprocessing.HasField("scaler"))
      pr_0 = preprocessing.scaler
      print("pr_0.channelScale = ", pr_0.channelScale)
      print("pr_0.redBias = ", pr_0.redBias)
      print("pr_0.blueBias = ", pr_0.blueBias)
      print("pr_0.greenBias = ", pr_0.greenBias)
      self.assertIsNotNone(pr_0.redBias)
      self.assertIsNotNone(pr_0.greenBias)
      self.assertIsNotNone(pr_0.blueBias)
      self.assertIsNotNone(pr_0.channelScale)
      self.assertEqual(pr_0.channelScale, 1.0)
      self.assertEqual(pr_0.redBias, 110.0)
      self.assertEqual(pr_0.blueBias, 117.0)
      self.assertEqual(pr_0.greenBias, 120.0)
  
      # Configuration 2: isbgr = False
      spec = keras.convert(
          model,
          input_names,
          output_names,
          image_input_names=["input"],
          red_bias=110.0,
          blue_bias=117.0,
          green_bias=120.0,
          is_bgr=False,
          image_scale=1.0,
      ).get_spec()
      self.assertIsNotNone(spec)
  
      # Test the model class
      self.assertIsNotNone(spec.description)
      self.assertTrue(spec.HasField("neuralNetwork"))
      self.assertEquals(
          spec.description.input[0].type.WhichOneof("Type"), "imageType"
      )
      self.assertEquals(
          spec.description.input[0].type.imageType.colorSpace,
          FeatureTypes_pb2.ImageFeatureType.ColorSpace.Value("RGB"),
      )
  
      # Test the layer parameters.
      preprocessing = spec.neuralNetwork.preprocessing[0]
      self.assertTrue(preprocessing.HasField("scaler"))
      pr_0 = preprocessing.scaler
      self.assertIsNotNone(pr_0.redBias)
      self.assertIsNotNone(pr_0.greenBias)
      self.assertIsNotNone(pr_0.blueBias)
      self.assertIsNotNone(pr_0.channelScale)
      self.assertEqual(pr_0.channelScale, 1.0)
      self.assertEqual(pr_0.redBias, 110.0)
      self.assertEqual(pr_0.blueBias, 117.0)
      self.assertEqual(pr_0.greenBias, 120.0)
  
      # Configuration 3: Defaults
      spec = keras.convert(
          model,
          input_names,
          output_names,
          image_input_names=["input"],
          is_bgr=False,
          image_scale=1.0,
      ).get_spec()
      self.assertIsNotNone(spec)
  
      # Test the model class
      self.assertIsNotNone(spec.description)
      self.assertTrue(spec.HasField("neuralNetwork"))
      self.assertEquals(
          spec.description.input[0].type.WhichOneof("Type"), "imageType"
      )
      self.assertEquals(
          spec.description.input[0].type.imageType.colorSpace,
          FeatureTypes_pb2.ImageFeatureType.ColorSpace.Value("RGB"),
      )
  
      # Test the layer parameters.
      preprocessing = spec.neuralNetwork.preprocessing[0]
      self.assertTrue(preprocessing.HasField("scaler"))
      pr_0 = preprocessing.scaler
      self.assertIsNotNone(pr_0.redBias)
      self.assertIsNotNone(pr_0.greenBias)
      self.assertIsNotNone(pr_0.blueBias)
      self.assertIsNotNone(pr_0.channelScale)
      self.assertEqual(pr_0.channelScale, 1.0)
      self.assertEqual(pr_0.redBias, 0.0)
      self.assertEqual(pr_0.blueBias, 0.0)
      self.assertEqual(pr_0.greenBias, 0.0)
  
imports: import unittest
  from coremltools._deps import _HAS_KERAS2_TF
  from coremltools.proto import Model_pb2
  from coremltools.proto import FeatureTypes_pb2
  from coremltools.proto import NeuralNetwork_pb2
  import pytest
label_desc: Use image node_id 24 for calling the KerasSingleLayerTest obj's underlying member method code with example usage: obj.test_image_processing() without return types