class_docstr: 🤗 Constructor for the image classifier trainer
class_docstr_tok: ["\ud83e\udd17","Constructor","for","the","image","classifier","trainer"]
code: def testing(self, img, expected):
      image_array = Image.open(img)
      inputs = self.feature_extractor(
          images=image_array, return_tensors="pt"
      ).to(self.device)
      outputs = self.model(**inputs)
      preds = outputs.logits.softmax(1).argmax(1).tolist()[0]
      print(
          "Predicted class: ",
          self.ids2labels[str(preds)],
          "(",
          str(preds),
          " - ",
          self.ids2labels[str(expected)],
          ") ",
          str(preds == expected),
      )
      return preds
  
file_path: HugsVision/build/lib/hugsvision/nnet/VisionClassifierTrainer.py
imports: import os
  from datetime import datetime
  import torch
  from sklearn import metrics
  from sklearn.metrics import precision_recall_fscore_support
  from transformers import Trainer
  from transformers.training_args import TrainingArguments
  from transformers.feature_extraction_utils import FeatureExtractionMixin
  from tqdm import tqdm
  from PIL import Image
  from hugsvision.dataio.ImageClassificationCollator import ImageClassificationCollator
label_desc: Use image node_id 6 for calling the VisionClassifierTrainer obj's underlying member method code with example usage: obj.testing(img, expected) and returns: preds