def jsonify(frame,  img_width_margin, img_height_margin, img_width, img_height):
    """
    Converts the pixel coordinates into new coordinates where the x and y coordinates
    recalculated relative to images top-left taken as 0,0 and images bottom-right
    taken as 1,1, also height and width are now the ratio of the image's height/width
    and frame's height/width

    Parameters
    ----------
    frame : Frame
        Frame object to jsonify
    img_width_margin : int
        Margin of image to center in window.
    img_height_margin : int
        Margin of image to center in window.
    img_width : int
        Width of the current image.
    img_height : int
        Height of the current image.

    Returns
    -------
    List of floats
        A list where the attributes of the frame converted into a list of floats according to the given description.

    """
    return [(frame.x - img_width_margin)/img_width, (frame.y - img_height_margin)/img_height, frame.width/img_width, frame.height/img_height, frame.label]