class_docstr: Set gt boxes and gt labels for train.
  
  Args:
      attrbox(Callable): Method for get detection attributes for images.
      category_to_id_map(dict): Mapping relations of category and id for images.
      img(dict): Input for detection model.
  
  Returns:
      img(dict): Set specific value on the attributes of 'gt boxes' and 'gt labels' for input.
class_docstr_tok: ["Set","gt","boxes","and","gt","labels","for","train",".","Args",":","attrbox","(","Callable",")",":","Method","for","get","detection","attributes","for","images",".","category_to_id_map","(","dict",")",":","Mapping","relations","of","category","and","id","for","images",".","img","(","dict",")",":","Input","for","detection","model",".","Returns",":","img","(","dict",")",":","Set","specific","value","on","the","attributes","of","'gt","boxes","'","and","'gt","labels","'","for","input","."]
docstr: Convert COCO annotations box with format [x1, y1, w, h] to
  center mode [center_x, center_y, w, h] and divide image width
  and height to get relative value in range[0, 1]
docstr_tok: ["Convert","COCO","annotations","box","with","format","[","x1",",","y1",",","w",",","h","]","to","center","mode","[","center_x",",","center_y",",","w",",","h","]","and","divide","image","width","and","height","to","get","relative","value","in","range","[","0",",","1","]"]
code: def box_to_center_relative(
      self, box: list, img_height: int, img_width: int
  ) -> np.ndarray:
      """
      Convert COCO annotations box with format [x1, y1, w, h] to
      center mode [center_x, center_y, w, h] and divide image width
      and height to get relative value in range[0, 1]
      """
      assert len(box) == 4, "box should be a len(4) list or tuple"
      x, y, w, h = box
  
      x1 = max(x, 0)
      x2 = min(x + w - 1, img_width - 1)
      y1 = max(y, 0)
      y2 = min(y + h - 1, img_height - 1)
  
      x = (x1 + x2) / 2 / img_width
      y = (y1 + y2) / 2 / img_height
      w = (x2 - x1) / img_width
      h = (y2 - y1) / img_height
  
      return np.array([x, y, w, h])
  
imports: import os
  import copy
  from typing import Callable
  import paddle
  import numpy
  from paddlehub.env import DATA_HOME
  from pycocotools.coco import COCO
label_desc: Use image node_id 2 for calling the GTAnotations obj's underlying member method code with example usage: obj.box_to_center_relative(box, img_height, img_width) and returns: np