class_docstr: PyTorchImageDataset is a dataset class for training.
  
  Args:
      image_path (:obj:`str`):
          Path to the images for your dataset.
  
      label_file (:obj:`str`):
           Path to your label file. The label file should be a csv file. The columns in this file should be
           [image_name, category], 'image_name' is the path of your images, 'category' is the label of accordance
           image. For example: [image_name, dog] for one row. Note that the first row should be[image_name, category]
  
      data_transform (:obj:`Compose`):
          PyTorch transform of the input images.
class_docstr_tok: ["PyTorchImageDataset","is","a","dataset","class","for","training",".","Args",":","image_path","(",":","obj",":","`","str","`",")",":","Path","to","the","images","for","your","dataset",".","label_file","(",":","obj",":","`","str","`",")",":","Path","to","your","label","file",".","The","label","file","should","be","a","csv","file",".","The","columns","in","this","file","should","be","[","image_name",",","category","]",",","'image_name","'","is","the","path","of","your","images",",","'category","'","is","the","label","of","accordance","image",".","For","example",":","[","image_name",",","dog","]","for","one","row",".","Note","that","the","first","row","should","be","[","image_name",",","category","]","data_transform","(",":","obj",":","`","Compose","`",")",":","PyTorch","transform","of","the","input","images","."]
code: def __init__(
      self,
      image_path: str,
      label_file: str,
      data_transform: transforms.Compose = None,
  ):
      self.image_path = image_path
      self.label_file = label_file
      self.data_transform = data_transform
  
      df = pd.read_csv(self.label_file)
      image_names = Series.to_numpy(df["image_name"])
      for i in range(len(image_names)):
          if os.path.splitext(image_names[i])[1] == "":
              image_names[i] += ".jpg"
      images = image_names.tolist()
      self.images = [os.path.join(self.image_path, i) for i in images]
  
      categories = Series.to_numpy(df["category"])
      # Count the categories
      breed_set = set(categories)
      breed_list = list(breed_set)
      dic = {}
      for i in range(len(breed_list)):
          dic[breed_list[i]] = i
      self.labels = [dic[categories[i]] for i in range(len(categories))]
      self.num_classes = len(breed_list)
  
file_path: towhee/towhee/data/dataset/image_datasets.py
imports: import os
  from towhee.utils.thirdparty.pandas_utils import pandas
  import torch
  from pandas import Series
  from towhee.utils.pil_utils import PILImage
  from torch.utils.data import Dataset
  from torchvision import transforms
  from typing import Tuple
label_desc: Use image node_id 1 to create a new PyTorchImageDataset object from inherited base classes: Dataset with example: obj = PyTorchImageDataset(image_path, label_file, data_transform)