import copy


def format_det_object_dict(det_obj_dict):
    """ convert str to appropriate data type
    :param det_obj_dict: object gotten from origin xml file
    :return: a formatted object dict.
    """
    det_obj_dict = copy.deepcopy(det_obj_dict)
    det_obj_dict['truncated'] = bool(int(det_obj_dict['truncated']))
    det_obj_dict['difficult'] = bool(int(det_obj_dict['difficult']))
    det_obj_dict['bndbox']['xmin'] = int(float(det_obj_dict['bndbox']['xmin']))
    det_obj_dict['bndbox']['ymin'] = int(float(det_obj_dict['bndbox']['ymin']))
    det_obj_dict['bndbox']['xmax'] = int(float(det_obj_dict['bndbox']['xmax']))
    det_obj_dict['bndbox']['ymax'] = int(float(det_obj_dict['bndbox']['ymax']))
    return det_obj_dict