def createProjectDataset(self): self.project_id = db_tables.checkProject(self.session, self.project) if self.project_id is None: self.project_id = db_tables.addProject(self.session, self.project) self.dataset_id = db_tables.checkDataset( self.session, self.project_id, self.dataset) if self.dataset_id is None: self.dataset_id = db_tables.addDataset( self.session, self.project_id, self.dataset)
def isLoaded(self): self.project_id = db_tables.checkProject(self.session, self.project) if self.project_id is None: return False self.dataset_id = db_tables.checkDataset( self.session, self.project_id, self.dataset) if self.dataset_id is None: return False return True
def getExperiments(session, project, dataset, exp_kind=None): project_id = db_tables.checkProject(session, project) dataset_id = db_tables.checkDataset(session, project_id, dataset) query = session.query(ExperimentsAlchemy) query = query.filter(ExperimentsAlchemy.dataset_id == dataset_id) if exp_kind is not None: query = query.filter(ExperimentsAlchemy.kind == exp_kind) query = query.filter(ExperimentsAlchemy.parent == None) experiments = {} for exp in query.all(): if exp.name not in list(experiments.keys()): experiments[exp.name] = [] experiments[exp.name].append(exp.id) return experiments
def getAllExperiments(session, project, dataset, exp_kind=None): project_id = db_tables.checkProject(session, project) dataset_id = db_tables.checkDataset(session, project_id, dataset) all_kinds = getExperimentKinds(session, dataset_id) experiments = {} for kind in all_kinds: experiments[kind] = [] query = session.query(ExperimentsAlchemy) query = query.filter(ExperimentsAlchemy.dataset_id == dataset_id) query = query.filter(ExperimentsAlchemy.kind == kind) query = query.filter(ExperimentsAlchemy.parent == None) for exp in query.all(): e = {'name': exp.name, 'id': exp.id} experiments[kind].append(e) if len(experiments[kind]) == 0: del experiments[kind] return experiments
def loadInDatabase(self, logger): self.project_id = db_tables.checkProject(self.session, self.project) if self.project_id is None: self.project_id = db_tables.addProject(self.session, self.project) self.dataset_id = db_tables.checkDataset(self.session, self.project_id, self.dataset) self.computeHashes() if self.dataset_id is None: self.dataset_id = db_tables.addDataset(self.session, self.project_id, self.dataset, self.idents_hash, self.ground_truth_hash) self.loadIdents(logger) if self.annotations_filename is not None: self.loadGroundTruth(logger) else: idents_hash, ground_truth_hash = db_tables.getDatasetHashes( self.session, self.project_id, self.dataset_id) self.checkHashes(idents_hash, ground_truth_hash) if self.annotations_filename is not None: if ground_truth_hash is None: self.loadGroundTruth(logger)
def _setDatasetId(self): project_id = db_tables.checkProject(self.session, self.project) dataset_id = db_tables.checkDataset(self.session, project_id, self.dataset) return dataset_id