diff --git a/evaluation.py b/evaluation.py index 779c640..1ce7636 100644 --- a/evaluation.py +++ b/evaluation.py @@ -25,7 +25,7 @@ def __init__(self,path): def load_gt(self): self.gt = json.load(open(self._gt_file,'r')) - val_files = json.loads(self.config['x-validation']['valid']) + val_files = json.loads(self.config['x-validation']['value']['valid']) for key, value in self.gt.items(): if key in val_files: self.val_gt.update({key:value}) @@ -103,11 +103,12 @@ def score(self, val=True, det=0.5): def save(self): with open(self._output_file, "w") as f: - f.write(json.dumps(self._metrics)) + f.write(json.dumps(self._metrics)) + def evaluate(self): self.load_predictions() thresh = self.find_threshold() - self.score(val=False, det=thresh) + self.score(val=True, det=thresh) self._aggregate_results['det_threshold'] = thresh self.save() diff --git a/inference.py b/inference.py index de7ac16..4c78a3e 100644 --- a/inference.py +++ b/inference.py @@ -168,7 +168,8 @@ def __init__(self, path): self.nms_thresh = 0.4 self.database = Database() - self.database.open(Path("databases/MultiDomainMitoticFigureDataset.sqlite")) + self.database.open(Path("databases/MIDOG++.sqlite")) # databases/MIDOG++.sqlite + self.uids = dict(self.database.execute('SELECT filename,uid from Slides').fetchall()) self.gts = {} @@ -183,7 +184,7 @@ def __init__(self, path): print("Successfully loaded model.") def move_validation_slides(self, test): - for slide in json.loads(self.config['x-validation']['valid']): + for slide in json.loads(self.config['x-validation']['value']['valid']): if test: os.rename(os.path.join(self.config['files']['value']['image_path'], slide), os.path.join(self._input_path, slide))