def updateDataSet(self,data): datasetIns = datasetsBean.objects(dsId=data['dsId']) print(data['updateClolumn']) datasetIns.update(**data['updateClolumn']) return resultPackerUtils.update_success()
def updateDetectModel(self, data): detecModeltIns = detectModelBean.objects(dmId=data['dmId']) print(data['updateClolumn']) detecModeltIns.update(**data['updateClolumn']) return resultPackerUtils.update_success()
def delImageItem(self,ditId): imageItem = dataImageItem.objects(ditId=ditId) imageItem.update(state=ConstantUtils.DATA_STATUS_DELETED) #更新数据集图片数量和标注进度 print(imageItem[0]["dsId"]) self.updateDataSetStatisData(imageItem[0]["dsId"]) return resultPackerUtils.update_success()
def delClsImgItem(self, queryData): classImageItem = classifyImageItem.objects( clsimgid=queryData['clsimgid'], state=ConstantUtils.DATA_STATUS_ACTIVE).first() classImageItem.update(state=ConstantUtils.DATA_STATUS_DELETED) self.updateDataSetStatisData(classImageItem.dsId) return resultPackerUtils.update_success()
def delDetectService(self, jsonData): detectServiceIns = detectServiceBean.objects(dtsid=jsonData['dtsid']) #释放模型资源 yoloDetectServiceImpl.releaseYoloDetectService( detectServiceIns["dtsServiceKey"]) detectServiceIns.update(state=ConstantUtils.DATA_STATUS_DELETED) return resultPackerUtils.update_success()
def upClassifyImageItem(self, data): classifyImageData = classifyImageItem.objects( clsimgid=data["clsimgid"], state=ConstantUtils.DATA_STATUS_ACTIVE).first() classifyImageData.update(classifyLabel=data["classifyLabel"], isLabeled=1, update_date=datetime.now) # 更新标注进度 self.updateDataSetStatisData(data["dsId"]) return resultPackerUtils.update_success()
def changeDtsSwitch(self, jsonData): detectServiceIns = detectServiceBean.objects( dtsid=jsonData['dtsid'], state=ConstantUtils.DATA_STATUS_ACTIVE)[0] if jsonData['dtsSwitch'] == ConstantUtils.SERVICE_SWITCH_ON: yoloDetectServiceImpl.launchYoloDetectService( sessionId=detectServiceIns["dtsServiceKey"], dmtvid=detectServiceIns["dmtvId"]) else: yoloDetectServiceImpl.releaseYoloDetectThread( detectServiceIns["dtsServiceKey"]) #更改数据库状态 detectServiceIns.update(dtsSwitch=jsonData['dtsSwitch']) return resultPackerUtils.update_success()
def updateDetectService(self, jsonData): detectServiceIns = detectServiceBean.objects( dtsid=jsonData['dtsid'], state=ConstantUtils.DATA_STATUS_ACTIVE) updateMap = jsonData['updateClolumn'] updateMap["dmBean"] = detectModelBean.objects( dmId=jsonData["updateClolumn"]['dmId'], state=ConstantUtils.DATA_STATUS_ACTIVE)[0] updateMap['dmtvBean'] = detectModelTrainVersion.objects( dmtvid=jsonData["updateClolumn"]["dmtvId"], state=ConstantUtils.DATA_STATUS_ACTIVE)[0] detectServiceIns.update(**jsonData['updateClolumn']) #加载或关闭模型 self.changeDtsSwitch(jsonData) return resultPackerUtils.update_success()
def upImageItemRecLabels(self, data): dataImage = dataImageItem.objects(ditId=data["ditId"]).first() jsons = data["recLabelList"] jsons=imageUtils.addYOLOCorrdinate(jsons) labelIdList = [] recLabelList = [] for item in jsons: dlid = item['dlid'] if labelIdList.__contains__(dlid) == False: labelIdList.append(dlid) recLabelList.append(rectangleLabelBean.convertToBean(item)) dataImage.update(recLabelList=recLabelList, labelIdList=labelIdList,isLabeled=1) self.updateDataSetStatisData(data['dsId']) return resultPackerUtils.update_success()
def delDetectModelDetail(self, dmId): detectModelItem = detectModelBean.objects(dmId=dmId) detectModelItem.update(state=ConstantUtils.DATA_STATUS_DELETED) return resultPackerUtils.update_success()
def loginOut(self): if session.keys().__contains__("userId"): session.pop("userId") return resultPackerUtils.update_success()
def delDataSet(self,dsId): detectsetItem = datasetsBean.objects(dsId=dsId) detectsetItem.update(state=ConstantUtils.DATA_STATUS_DELETED) return resultPackerUtils.update_success()
def delDMVersion(self, queryData): modelVersion = detectModelTrainVersion.objects( dmtvid=queryData['dmtvid']) modelVersion.update(state=ConstantUtils.DATA_STATUS_DELETED) return resultPackerUtils.update_success()