Open joefutrelle opened 2 years ago
Script fragment for parsing the CNN JSON format.
def process_json(path):
try:
with open(path) as fin:
j = json.load(fin)
class_labels = j['class_labels']
output_classes = j['output_classes']
output_scores = j['output_scores']
input_images = j['input_images']
for i, image_id in enumerate(input_images):
output_class = output_classes[i]
output_class_label = class_labels[output_class]
image_path = { left as an exercise to the reader }
score = output_scores[i][output_class]
print(f'{image_id},{image_path},{output_class_label},{score:.3f}')
except IOError:
print('IO error!')
Work going on here https://github.com/WHOIGit/photic/tree/importlabeledrois