本文整理匯總了Python中db.DB.getImage方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.getImage方法的具體用法?Python DB.getImage怎麽用?Python DB.getImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類db.DB
的用法示例。
在下文中一共展示了DB.getImage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getuuid
# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
def getuuid(self, projectId, imageId, guid):
data = {}
project = DB.getProject( projectId )
task = DB.getImage( projectId, imageId )
expiration = project.syncTime*4
if task.annotationLockId == guid:
data['uuid'] = DB.lockImage( projectId, imageId )
now = datetime.now()
annotationTime = datetime.strptime(task.annotationTime, '%Y-%m-%d %H:%M:%S')
diff = now - annotationTime
print 'diff: ', diff.total_seconds()
elif task.annotationStatus == 1:
now = datetime.now()
annotationTime = datetime.strptime(task.annotationTime, '%Y-%m-%d %H:%M:%S')
diff = now - annotationTime
diff = diff.total_seconds()
print 'time diff:', diff
if diff > expiration:
data['uuid'] = DB.lockImage( projectId, imageId )
else:
data['uuid'] = DB.lockImage( projectId, imageId )
return Utility.compress(json.dumps( data ))
示例2: getstatus
# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
def getstatus(self, imageId, projectId, guid, segTime):
# make sure this image prioritize for segmentation
DB.requestSegmentation( projectId, imageId )
task = DB.getImage(projectId, imageId);
data = {}
data['image'] = task.toJson()
data['project'] = DB.getProject(projectId).toJson()
data['has_new_segmentation'] = self.has_new_segmentation(imageId, projectId, segTime)
return Utility.compress(json.dumps( data ))
示例3: has_new_segmentation
# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
def has_new_segmentation(self, imageId, projectId, segTime):
# if no new segmentation, just return nothing
if segTime is None or segTime == 'undefined':
return True
task = DB.getImage(projectId, imageId)
taskSegTime = time.strptime(task.segmentationTime, '%Y-%m-%d %H:%M:%S')
segTime = segTime.replace("%20", " ")
segTime = time.strptime(segTime, '%Y-%m-%d %H:%M:%S')
if segTime == taskSegTime:
return False
return True