code: def test_image_dataset_from_directory_binary(self):
      directory = self._prepare_directory(num_classes=2)
      dataset = image_dataset_utils.image_dataset_from_directory(
          directory, batch_size=8, image_size=(18, 18), label_mode="int"
      )
      if backend.config.image_data_format() == "channels_last":
          output_shape = [8, 18, 18, 3]
      else:
          output_shape = [8, 3, 18, 18]
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, output_shape)
      self.assertEqual(batch[0].dtype.name, "float32")
      self.assertEqual(batch[1].shape, (8,))
      self.assertEqual(batch[1].dtype.name, "int32")
  
      dataset = image_dataset_utils.image_dataset_from_directory(
          directory,
          batch_size=8,
          image_size=(18, 18),
          label_mode="binary",
      )
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, output_shape)
      self.assertEqual(batch[0].dtype.name, "float32")
      self.assertEqual(batch[1].shape, (8, 1))
      self.assertEqual(batch[1].dtype.name, "float32")
  
      dataset = image_dataset_utils.image_dataset_from_directory(
          directory,
          batch_size=8,
          image_size=(18, 18),
          label_mode="categorical",
      )
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, output_shape)
      self.assertEqual(batch[0].dtype.name, "float32")
      self.assertEqual(batch[1].shape, (8, 2))
      self.assertEqual(batch[1].dtype.name, "float32")
  
imports: import os
  import numpy
  from keras import backend
  from keras import testing
  from keras.utils import image_dataset_utils
  from keras.utils import image_utils
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 4 for calling the ImageDatasetFromDirectoryTest obj's underlying member method code with example usage: obj.test_image_dataset_from_directory_binary() without return types