class_docstr: Task for image classification.
  
  Attributes:
      model:
          1. Model name
          2. Model name on Backprop's image-classification endpoint
          3. Model object that implements the image-classification task
      local (optional): Run locally. Defaults to False
      api_key (optional): Backprop API key for non-local inference
      device (optional): Device to run inference on. Defaults to "cuda" if available.
class_docstr_tok: ["Task","for","image","classification",".","Attributes",":","model",":","1",".","Model","name","2",".","Model","name","on","Backprop","'s","image-classification","endpoint","3",".","Model","object","that","implements","the","image-classification","task","local","(","optional",")",":","Run","locally",".","Defaults","to","False","api_key","(","optional",")",":","Backprop","API","key","for","non-local","inference","device","(","optional",")",":","Device","to","run","inference","on",".","Defaults","to","``","cuda","''","if","available","."]
docstr: Performs a training step for single-label classification and returns loss.
  
  Args:
      batch: Batch output from the dataloader
      batch_idx: Batch index.
docstr_tok: ["Performs","a","training","step","for","single-label","classification","and","returns","loss",".","Args",":","batch",":","Batch","output","from","the","dataloader","batch_idx",":","Batch","index","."]
code: def step_single_label(self, batch, batch_idx):
      """
      Performs a training step for single-label classification and returns loss.
  
      Args:
          batch: Batch output from the dataloader
          batch_idx: Batch index.
      """
      images, targets = batch
      outputs = self.model.training_step(images, task=TASK)
  
      loss = self.criterion(outputs, targets)
      return loss
  
imports: from typing import List, Tuple, Union
  from ..models import BaseModel
  from backprop.models import AutoModel
  from backprop.utils.datasets import SingleLabelImageClassificationDataset, MultiLabelImageClassificationDataset
  from .base import Task
  from PIL import Image
  from torch import nn
  import torch
  import numpy
  import base64
  import requests
  from io import BytesIO
  from backprop.utils.helpers import img_to_base64, path_to_img
label_desc: Use image node_id 4 for calling the ImageClassification obj's underlying member method code with example usage: obj.step_single_label(batch, batch_idx) and returns: loss