code: def main(args):
      print(args)
  
      model = obj_detection.__dict__[args.arch](
          pretrained=True, num_classes=5
      ).eval()
      # GPU
      if isinstance(args.device, int):
          if not torch.cuda.is_available():
              raise AssertionError(
                  "PyTorch cannot access your GPU. Please investigate!"
              )
          if args.device >= torch.cuda.device_count():
              raise ValueError("Invalid device index")
      # Silent default switch to GPU if available
      elif torch.cuda.is_available():
          args.device = 0
      else:
          logging.warning(
              "No accessible GPU, target device set to CPU."
          )
      img = read_img_as_tensor(args.img_path).unsqueeze(0)
      if torch.cuda.is_available():
          torch.cuda.set_device(args.device)
          model = model.cuda()
          img = img.cuda()
  
      pred = model(img)
      labels = pred[0]["labels"].detach().cpu().numpy()
      labels = labels.round().astype(int)
      boxes = pred[0]["boxes"].detach().cpu().numpy()
      boxes = boxes.round().astype(int)
      img = img.cpu().permute(0, 2, 3, 1).numpy()[0].copy()
      plot_predictions(img, boxes, labels)
  
file_path: doctr/scripts/detect_artefacts.py
imports: import os
  import argparse
  import logging
  import cv2
  import matplotlib.pyplot
  import torch
  from doctr.io.image import read_img_as_tensor
  from doctr.models import obj_detection
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types