class_docstr: Segmentation layers.
  
  Use sigmoid and binary crossentropy for binary element segmentation.
  Use softmax and categorical crossentropy for multi-class
  (more than 2) segmentation. Use Accuracy as metrics by default.
  
  The targets passing to the head would have to be tf.data.Dataset,
  np.ndarray, pd.DataFrame or pd.Series. It can be raw labels, one-hot encoded
  if more than two classes, or binary encoded for binary element segmentation.
  
  The raw labels will be encoded to 0s and 1s if two classes were found, or
  one-hot encoded if more than two classes were found.
  One pixel only corresponds to one label.
  
  # Arguments
      num_classes: Int. Defaults to None. If None, it will be inferred from
          the data.
      loss: A Keras loss function. Defaults to use `binary_crossentropy` or
          `categorical_crossentropy` based on the number of classes.
      metrics: A list of Keras metrics. Defaults to use 'accuracy'.
      dropout: Float. The dropout rate for the layers.
          If left unspecified, it will be tuned automatically.
class_docstr_tok: ["Segmentation","layers",".","Use","sigmoid","and","binary","crossentropy","for","binary","element","segmentation",".","Use","softmax","and","categorical","crossentropy","for","multi-class","(","more","than","2",")","segmentation",".","Use","Accuracy","as","metrics","by","default",".","The","targets","passing","to","the","head","would","have","to","be","tf.data.Dataset",",","np.ndarray",",","pd.DataFrame","or","pd.Series",".","It","can","be","raw","labels",",","one-hot","encoded","if","more","than","two","classes",",","or","binary","encoded","for","binary","element","segmentation",".","The","raw","labels","will","be","encoded","to","0s","and","1s","if","two","classes","were","found",",","or","one-hot","encoded","if","more","than","two","classes","were","found",".","One","pixel","only","corresponds","to","one","label",".","#","Arguments","num_classes",":","Int",".","Defaults","to","None",".","If","None",",","it","will","be","inferred","from","the","data",".","loss",":","A","Keras","loss","function",".","Defaults","to","use","`","binary_crossentropy","`","or","`","categorical_crossentropy","`","based","on","the","number","of","classes",".","metrics",":","A","list","of","Keras","metrics",".","Defaults","to","use","'accuracy","'",".","dropout",":","Float",".","The","dropout","rate","for","the","layers",".","If","left","unspecified",",","it","will","be","tuned","automatically","."]
code: def __init__(
      self,
      num_classes: Optional[int] = None,
      loss: Optional[types.LossType] = None,
      metrics: Optional[types.MetricsType] = None,
      dropout: Optional[float] = None,
      **kwargs,
  ):
      super().__init__(
          loss=loss,
          metrics=metrics,
          num_classes=num_classes,
          dropout=dropout,
          **kwargs,
      )
  
imports: from typing import Optional
  import tensorflow
  from tensorflow import keras
  from tensorflow import nest
  from tensorflow.keras import activations
  from tensorflow.keras import layers
  from tensorflow.keras import losses
  from autokeras import adapters
  from autokeras import analysers
  from autokeras import hyper_preprocessors
  from autokeras import preprocessors
  from autokeras.blocks import reduction
  from autokeras.engine import head
  from autokeras.utils import types
  from autokeras.utils import utils
label_desc: Use image node_id 1 to create a new SegmentationHead object from inherited base classes: ClassificationHead with example: obj = SegmentationHead(num_classes, loss, metrics, dropout)