from helpers.AnnotationLocationLoader import AnnotationLocationLoader ''' This script is able to load the annotations for each part of the dataset separately and report a few stats about them. ''' def get_stats(annotation_loader): bilder = annotation_loader.get_all_annotated_images() bilder_count = len(annotation_loader.get_all_available_images()) bilder_mit_annotation = 0 summe_der_annotationen = 0 for image in bilder: annot_per_image = len(annotation_loader.get_annotations(image, ['Caries'])) summe_der_annotationen += annot_per_image if annot_per_image > 0: bilder_mit_annotation += 1 print("Anzahl Bilder: {}".format(bilder_count)) print("Bilder mit Caries Annotationen: {}".format(bilder_mit_annotation)) print("Summe der Annotationen: {}".format(summe_der_annotationen)) print() if __name__ == '__main__': print('Test') annotLoader_test = AnnotationLocationLoader(annotation_file='input/caries_dataset_annotation.json', images_base_folder='input/test_data', mouth_annotations_folder='input/mouth_annotations') get_stats(annotLoader_test) print('Training') annotLoader_train = AnnotationLocationLoader(annotation_file='input/caries_dataset_annotation.json', images_base_folder='input/training_data', mouth_annotations_folder='input/mouth_annotations') get_stats(annotLoader_train) print('Evaluation') annotLoader_eval = AnnotationLocationLoader(annotation_file='input/caries_dataset_annotation.json', images_base_folder='input/evaluation_data', mouth_annotations_folder='input/mouth_annotations') get_stats(annotLoader_eval)