pczhang93 / coordinate_mapping_for_image_augmentor

Generating new polygon annotation files in VIA format by coordinate mapping.
MIT License
4 stars 0 forks source link

Multiple polygonal annotations #1

Open FloBr49 opened 3 years ago

FloBr49 commented 3 years ago

Hi, is it possible using this code for images with multiple polygonal regions/annotations? You can find the JSON file I want to use attached.

This is the error i get when trying to run the program:

(TEST2) C:\Users\flori\Documents\coordinate_mapping_for_image_augmentor-master\coordinate_mapping_for_image_augmentor-master>python coordinates_mapping.py Augmentation_TEST TEST_JSON.json 12 IMG_20201123_152424_397.jpg IMG_20201123_152424_397flipv.jpg IMG_20201123_152424_397.jpg 1134327 IMG_20201123_152424_397flipv {'shape_attributes': {'name': 'polyline', 'all_points_x': [851, 889, 914, 947, 975, 1009, 1035, 1042, 1056, 1082, 1089, 1113, 1170, 1170, 1180, 1179, 1104, 1104, 1098, 1070, 1054, 1060, 1057, 1043, 1007, 991, 991, 986, 982, 955, 943, 942, 915, 857, 854, 864, 872, 870, 852, 855, 871, 850], 'all_points_y': [202, 203, 204, 208, 208, 210, 226, 224, 227, 229, 220, 223, 254, 263, 274, 281, 279, 297, 303, 289, 287, 342, 356, 369, 372, 360, 342, 336, 325, 328, 319, 311, 312, 286, 273, 269, 265, 259, 258, 218, 219, 202]}, 'region_attributes': {'name': 'Connector'}} Traceback (most recent call last): File "coordinates_mapping.py", line 242, in main(images_folder_name, json_name) File "coordinates_mapping.py", line 196, in main _x = regions[i]['shape_attributes']['all_points_x'] TypeError: list indices must be integers or slices, not dict

Thank you in advance. TEST_JSON.zip

FloBr49 commented 3 years ago

@pczhang93 do you have a solution for my problem? I need it for my thesis and i´m kinda desperate. I would be very glad if you could help me out. Thanks