code: def batch_detect(net, img_batch, device):
      """
      Inputs:
          - img_batch: a torch.Tensor of shape (Batch size, Channels, Height, Width)
      """
  
      if "cuda" in device:
          torch.backends.cudnn.benchmark = True
  
      batch_size = img_batch.size(0)
      img_batch = img_batch.to(device, dtype=torch.float32)
  
      img_batch = img_batch.flip(-3)  # RGB to BGR
      img_batch = img_batch - torch.tensor(
          [104.0, 117.0, 123.0], device=device
      ).view(1, 3, 1, 1)
  
      with torch.no_grad():
          olist = net(img_batch)  # patched uint8_t overflow error
  
      for i in range(len(olist) // 2):
          olist[i * 2] = F.softmax(olist[i * 2], dim=1)
  
      olist = [oelem.data.cpu().numpy() for oelem in olist]
  
      bboxlists = get_predictions(olist, batch_size)
      return bboxlists
  
file_path: face-alignment/face_alignment/detection/sfd/detect.py
imports: import torch
  import torch.nn.functional
  import cv2
  import numpy
  from .bbox import *
label_desc: Use image node_id 2 for calling a global function with example usage: batch_detect(net, img_batch, device) and returns: bboxlists