I'm a student in data science and object classification / detection. I have a file xlsx containing the following columns:
- Name image;
- Class Label;
- Region count (nth polygon identified in the image);
- polygon coordinates (all_x_points, all_y_points);
- Color polygon
I converted this xlsx file in json list but Mask R CNN needs a json dictionary for the annotations. I tried this code to convert json file in json dict:
def Convert(a):
it = iter(a)
res_dct = dict(zip(it, it))
return res_dct
# Driver code
list = json.load(open("file.json"))
print(Convert(lst))
Code error: unhashable type: 'dict'
So, I tried with csv file (after the convertion from xlsx file):
from csv import DictReader
import json
fieldnames = ('Name_image', 'Class_Label', 'Region_count', polygon_coordinates, 'coordinates', 'Color_polygon')
with open('/content/test_set.csv', 'r') as fd:
data = list(DictReader(fd, fieldnames))
with open('Annotations_train.json', 'w') as fd:
json.dump(data, fd)
The output is complety wrong because the columns are not linked with the right data.
Previously, for learning, I trained the Mask R CNN with customized VGG Image Annotation on another image dataset and all worked perfectly.
However for this assignment I have only this xlsx annotations (1. Name image; 2. Class Label; 3. Region count; 4. polygon coordinates (all_x_points, all_y_points); 5. Color polygon and I can't change them).
What is the best methodological approach for training Mask R CNN with my xlsx annotations?