def getAnnotation(annotations_type, annotations_id, dataset_id, instance_id): annotations_type = AnnotationsTypes[annotations_type] annotation = annotations_db_tools.get_annotation(session, annotations_type, annotations_id, dataset_id, instance_id) if annotation is None: return jsonify({}) else: return jsonify({'label': annotation[0], 'family': annotation[1]})
def check_new_annotations_with_db(self, exp): for instance_id in self.instances.annotations.get_unlabeled_ids(): annotations_conf = exp.exp_conf.annotations_conf annotations_type = annotations_conf.annotations_type annotations_id = annotations_conf.annotations_id dataset_id = exp.exp_conf.dataset_conf.dataset_id annotation = annotations_db_tools.get_annotation( exp.session, annotations_type, annotations_id, dataset_id, instance_id) if annotation is not None: DB_label, DB_family = annotation self.update(instance_id, DB_label, DB_family)
def get_manual_annotation(self, iteration): annotations_conf = iteration.exp.exp_conf.annotations_conf annotations_type = annotations_conf.annotations_type annotations_id = annotations_conf.annotations_id dataset_id = iteration.exp.exp_conf.dataset_conf.dataset_id annotation = annotations_db_tools.get_annotation( iteration.exp.session, annotations_type, annotations_id, dataset_id, self.instance_id) if annotation is None: iteration.conf.logger.info('Instance %s has not been annotated.' % (str(self.instance_id))) else: label, family = annotation self.update_datasets(iteration, label, family)
def check_annotations_with_db(self, exp): for instance_id in self.instances.annotations.get_annotated_ids(): label = self.instances.annotations.get_label(instance_id) family = self.instances.annotations.get_family(instance_id) annotations_conf = exp.exp_conf.annotations_conf annotations_type = annotations_conf.annotations_type annotations_id = annotations_conf.annotations_id dataset_id = exp.exp_conf.dataset_conf.dataset_id annotation = annotations_db_tools.get_annotation( exp.session, annotations_type, annotations_id, dataset_id, instance_id) if annotation is None: # The instance is not annotated anymore self.update(instance_id, None, None) else: DB_label, DB_family = annotation if DB_label != label or DB_family != family: self.update(instance_id, DB_label, DB_family)