| 1234567891011121314151617181920212223 |
- from app.utils.arean_anylize_draw import DefectProcessor, to_json_serializable
- import json
- if __name__ == '__main__':
- json_path = r"C:\Code\ML\Project\CheckCardBoxAndDefectServer\temp\corner_no_reflect\00006_250805_pokemon_0001_bottom_grid_r0_c5.json"
- with open(json_path, 'r', encoding='utf-8') as f:
- labelme_data = json.load(f)
- processor = DefectProcessor(pixel_resolution=24.54)
- result = processor.analyze_from_json(labelme_data)
- print(result)
- print(type(result))
- # with open('result.json', 'w', encoding='utf-8') as f:
- # f.write(result_json)
- # result_json = to_json_serializable(result.to_dict())
- # print(result_json)
- # print(json.loads(result_json))
- # with open('result.json', 'w', encoding='utf-8') as f:
- # json.dump(result_json, f, ensure_ascii=False, indent=2)
|