code: def write_line(img_path, im_shape, boxes, ids, idx):
      h, w, c = im_shape
      # for header, we use minimal length 2, plus width and height
      # with A: 4, B: 5, C: width, D: height
      A = 4
      B = 5
      C = w
      D = h
      # concat id and bboxes
      labels = np.hstack((ids.reshape(-1, 1), boxes)).astype("float")
      # normalized bboxes (recommanded)
      labels[:, (1, 3)] /= float(w)
      labels[:, (2, 4)] /= float(h)
      # flatten
      labels = labels.flatten().tolist()
      str_idx = [str(idx)]
      str_header = [str(x) for x in [A, B, C, D]]
      str_labels = [str(x) for x in labels]
      str_path = [img_path]
      line = (
          "\t".join(str_idx + str_header + str_labels + str_path) + "\n"
      )
      return line
  
file_path: gluon-cv/docs/tutorials/datasets/detection_custom.py
imports: import os, zipfile
  from gluoncv import utils
  import mxnet
  import numpy
  from matplotlib import pyplot
  from gluoncv.data import LstDetection
  import sys
  import subprocess
  from gluoncv.data import RecordFileDetection
  from gluoncv.data import VOCDetection
label_desc: Use image node_id 1 for calling a global function with example usage: write_line(img_path, im_shape, boxes, ids, idx) and returns: line