import copy


def rescale_with_ratios(info, width_ratio, height_ratio):
    """
    Rescale heatmaps sides given its info and ratios.

    :param info: dict, heatmaps info
    :param width_ratio: float, ratio by which width will be multiplied
    :param height_ratio: float, ratio by which height will be multiplied
    :return: dict, heatmaps info rescaled (copy)
    """
    info = copy.deepcopy(info)

    if width_ratio == 1 and height_ratio == 1:
        return info

    info['img_width'] = round(width_ratio * info['img_width'])
    info['img_height'] = round(height_ratio * info['img_height'])
    for cwh in info['cwh_list']:
        cwh['width'] = round(width_ratio * cwh['width'])
        cwh['height'] = round(height_ratio * cwh['height'])
        cwh['center'] = (cwh['center'][0] * width_ratio, cwh['center'][1] * height_ratio)
    return info