src/SealDetectionRCNN/data/seals_dataset.py [92:131]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            for i in range(len(bbox_coords)):
                if bbox_labels[i] not in self.class_names:
                    self.class_names.append(bbox_labels[i])
                bb = bbox_coords[i]
                if np.all(bb >= 0) and bb[0] <= width and bb[2] <= width and bb[1] <= height and bb[3] <= height and bb[0] < bb[2] and bb[1] < bb[3]:
                    # In this framework, we need ('ymin', 'xmin', 'ymax', 'xmax') format
                    self.bboxes[image_id].append([bb[1],bb[0],bb[3],bb[2]])
                    self.labels[image_id].append(self.class_names.index(bbox_labels[i]))
            if len(self.bboxes[image_id]) == 0:
                empty_images.append(image_id)
        for empty_image_id in empty_images[::-1]:
            print("Deleting image {} as all bounding boxes are outside".format(empty_image_id) + \
                     "of the image or no bounding boxes are provided")
            del self.impaths[empty_image_id]
            del self.image_ids[empty_image_id]
            del self.bboxes[empty_image_id]
            del self.labels[empty_image_id]
        
        self.classes = list(range(len(self.class_names)))
        # print out some stats
        print("The dataset has {} images containing {} classes".format(
                  len(self.image_ids),
                  len(self.classes)))
        os.chdir(old_dir)
        
        # To make sure we loaded the bboxes correctly:        
        self.validate_bboxes()
        print("All checks passed")
            

    def __len__(self):
        return len(self.image_ids)
        
    def validate_bboxes(self):
        import traceback
        import sys
        from tqdm import tqdm
        try:
            # For each image in the data set...
            for idx in tqdm(range(len(self.image_ids))):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/SealDetectionRCNN/data/vott_dataset.py [87:126]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            for i in range(len(bbox_coords)):
                if bbox_labels[i] not in self.class_names:
                    self.class_names.append(bbox_labels[i])
                bb = bbox_coords[i]
                if np.all(bb >= 0) and bb[0] <= width and bb[2] <= width and bb[1] <= height and bb[3] <= height and bb[0] < bb[2] and bb[1] < bb[3]:
                    # In this framework, we need ('ymin', 'xmin', 'ymax', 'xmax') format
                    self.bboxes[image_id].append([bb[1],bb[0],bb[3],bb[2]])
                    self.labels[image_id].append(self.class_names.index(bbox_labels[i]))
            if len(self.bboxes[image_id]) == 0:
                empty_images.append(image_id)
        for empty_image_id in empty_images[::-1]:
            print("Deleting image {} as all bounding boxes are outside".format(empty_image_id) + \
                     "of the image or no bounding boxes are provided")
            del self.impaths[empty_image_id]
            del self.image_ids[empty_image_id]
            del self.bboxes[empty_image_id]
            del self.labels[empty_image_id]
        
        self.classes = list(range(len(self.class_names)))
        # print out some stats
        print("The dataset has {} images containing {} classes".format(
                  len(self.image_ids),
                  len(self.classes)))
        os.chdir(old_dir)
        
        # To make sure we loaded the bboxes correctly:        
        self.validate_bboxes()
        print("All checks passed")
            

    def __len__(self):
        return len(self.image_ids)
        
    def validate_bboxes(self):
        import traceback
        import sys
        from tqdm import tqdm
        try:
            # For each image in the data set...
            for idx in tqdm(range(len(self.image_ids))):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



