def obj_box_coords_rescale(coords=None, shape=None):
if coords is None:<EOL><INDENT>coords = []<EOL><DEDENT>if shape is None:<EOL><INDENT>shape = [<NUM_LIT:100>, <NUM_LIT:200>]<EOL><DEDENT>imh, imw = shape[<NUM_LIT:0>], shape[<NUM_LIT:1>]<EOL>imh = imh * <NUM_LIT:1.0>  <EOL>imw = imw * <NUM_LIT:1.0><EOL>coords_new = list()<EOL>for coord in coords:<EOL><INDENT>if len(coord) != <NUM_LIT:4>:<EOL><INDENT>raise AssertionError("<STR_LIT>")<EOL><DEDENT>x = coord[<NUM_LIT:0>] / imw<EOL>y = coord[<NUM_LIT:1>] / imh<EOL>w = coord[<NUM_LIT:2>] / imw<EOL>h = coord[<NUM_LIT:3>] / imh<EOL>coords_new.append([x, y, w, h])<EOL><DEDENT>return coords_new<EOL>
Scale down a list of coordinates from pixel unit to the ratio of image size i.e. in the range of [0, 1].

    Parameters
    ------------
    coords : list of list of 4 ints or None
        For coordinates of more than one images .e.g.[[x, y, w, h], [x, y, w, h], ...].
    shape : list of 2 int or None
        【height, width].

    Returns
    -------
    list of list of 4 numbers
        A list of new bounding boxes.


    Examples
    ---------
    >>> coords = obj_box_coords_rescale(coords=[[30, 40, 50, 50], [10, 10, 20, 20]], shape=[100, 100])
    >>> print(coords)
      [[0.3, 0.4, 0.5, 0.5], [0.1, 0.1, 0.2, 0.2]]
    >>> coords = obj_box_coords_rescale(coords=[[30, 40, 50, 50]], shape=[50, 100])
    >>> print(coords)
      [[0.3, 0.8, 0.5, 1.0]]
    >>> coords = obj_box_coords_rescale(coords=[[30, 40, 50, 50]], shape=[100, 200])
    >>> print(coords)
      [[0.15, 0.4, 0.25, 0.5]]

    Returns
    -------
    list of 4 numbers
        New coordinates.