class_docstr: A common LightningModule implementation of a image classifier.
class_docstr_tok: ["A","common","LightningModule","implementation","of","a","image","classifier","."]
docstr: Create a ImageClassifier for common image classifier task.
  
  :param backbone: a backbone network of this ImageClassifer
  :param num_classes: the number of classification classes
  :param head: the head network on top of the backone network
  :param criterion: criterion for the classifier, default to CrossEntropyLoss
docstr_tok: ["Create","a","ImageClassifier","for","common","image","classifier","task",".",":","param","backbone",":","a","backbone","network","of","this","ImageClassifer",":","param","num_classes",":","the","number","of","classification","classes",":","param","head",":","the","head","network","on","top","of","the","backone","network",":","param","criterion",":","criterion","for","the","classifier",",","default","to","CrossEntropyLoss"]
code: def __init__(
      self,
      backbone: BackboneModule,
      num_classes: int,
      head: nn.Module = None,
      criterion: nn.Module = None,
  ):
      """
      Create a ImageClassifier for common image classifier task.
  
      :param backbone: a backbone network of this ImageClassifer
      :param num_classes: the number of classification classes
      :param head: the head network on top of the backone network
      :param criterion: criterion for the classifier, default to CrossEntropyLoss
      """
      super().__init__()
  
      if head is None:
          output_size = backbone.get_output_size()
          head = nn.Linear(output_size, num_classes)
      self.model = torch.nn.Sequential(backbone, head)
      if criterion is None:
          criterion = torch.nn.CrossEntropyLoss()
      self.criterion = criterion
  
file_path: BigDL/python/nano/src/bigdl/nano/pytorch/vision/models/classifier.py
imports: from typing import Callable
  import pytorch_lightning
  import torch
  import torch.nn
  from ._utils import BackboneModule
label_desc: Use image node_id 1 to create a new ImageClassifier object from inherited base classes: pl with example: obj = ImageClassifier(backbone, num_classes, head, criterion)