Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 831 Bytes

xml2json.md

File metadata and controls

29 lines (22 loc) · 831 Bytes

This function is used to convert xmls to jsons.

This function just supports labelImg and LabelImgTool.

How to use.

    import os
    from convertmask.utils.xml2json.xml2json import getPolygon, x2jConvert, x2jConvert_pascal

    BASE_DIR = os.path.abspath(os.path.dirname(os.getcwd())) + os.sep + 'static'

    if __name__ == "__main__":
        x2jConvert(BASE_DIR + os.sep + 'bbox_label.xml',
                BASE_DIR + os.sep + 'bbox_label.jpg')

        x2jConvert_pascal(BASE_DIR + os.sep + 'bbox_label.xml',
                        BASE_DIR + os.sep + 'bbox_label.jpg')