本文整理汇总了Python中common.Common.parseAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Python Common.parseAnnotations方法的具体用法?Python Common.parseAnnotations怎么用?Python Common.parseAnnotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.parseAnnotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showAnnots
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import parseAnnotations [as 别名]
def showAnnots():
cfg = main.getConfigs()
videos, videoRange = main.prepareVideosList(cfg)
videoName = videos[videoRange[0]][1]
annotFilename = os.path.splitext(videoName)[0]+".tag"
if not os.path.isfile(annotFilename):
return
annotsl, annots = Cmn.parseAnnotations(file(annotFilename), None, "farne")
print annots[2]
return
示例2: processOutputs
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import parseAnnotations [as 别名]
def processOutputs(cfg, videos, videoRange, actions, settings):
#videoRange = videoRange[:1]
if "writeOverallReport" in actions:
reportLoc = cfg["othr"]["outputsPref"][1:] + ("/overall_%s.tsv" % cfg["method"])
reportFileName = VideoQueue.initOverallReport(cfg, cfg["othr"]["codeDirectory"] + "/"+ reportLoc)
reportFileNameT1 = VideoQueue.initOverallReportTable1(cfg)
for vi in videoRange:
videoDescription, videoName = videos[vi]
print vi, videoDescription, videoName
outputFileName = VideoQueue.prepareOutputFileName(cfg["othr"]["codeDirectory"], cfg["othr"]["outputsPref"], videoName)
try:
varsDict = VideoQueue.readOutputsToVariables(cfg, outputFileName)
except IOError, e:
print "breaking"
print traceback.format_exc()
break
if "postProcessLogLine" in actions or "displayDetectionCoverage" in actions or "writeOverallReport" in actions or "displayPupilDisplacement" in actions or "postProcessTracking" in actions:
#if cfg["method"] == "farneback":
annotFilename = "%s.tag" % os.path.splitext(videoName)[0].replace("/eyeMon", "")
annotFilenameL = "%s.txt" % os.path.splitext(videoName)[0].replace("/eyeMon", "")
annotFilename1 = "%s.v1" % os.path.splitext(videoName)[0].replace("/eyeMon", "")
if os.path.isfile(annotFilename):
annotsl, annots = Cmn.parseAnnotations(file(annotFilename), None, "farne")
if os.path.isfile(annotFilenameL):
videoLen = float(file(annotFilenameL, "rb").read().strip().split("\n")[-1].split(" ")[1])
annots[-1]["length"] = videoLen
else:
annots[-1]["length"] = -1
elif os.path.isfile(annotFilename1):
annotsl, annots = Cmn.parseAnnotationsMy(file(annotFilename1), None, "farne")
if "poli1person10" in annotFilename1:
annots[-1]["glasses"] = True
else:
annots[-1]["glasses"] = False
if os.path.isfile(annotFilenameL):
videoLenS = float(file(annotFilenameL, "rb").read().strip().split("\n")[0].split(" ")[1])
videoLenE = float(file(annotFilenameL, "rb").read().strip().split("\n")[-1].split(" ")[1])
annots[-1]["length"] = (videoLenE-videoLenS)
else:
annots[-1]["length"] = -1
if "displayDetectionCoverage" in actions:
if cfg["method"] == "farneback":
dc = Cmn.detectionCoverageF(annotsl, varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"])
Cmn.displayDetectionCoverageF1(dc, annotsl)
pass
#Cmn.displayDetectionCoverage(varsDict["l"], varsDict["r"], varsDict["o"])
elif cfg["method"] == "templ":
pass
elif cfg["method"] == "blackpixels":
pass
if "signalProcessing" in actions:
#print repr(varsDict["tCors"])
print repr([x["fn"] for x in varsDict["tCors"]])
print
print
print repr([x["lcor"] for x in varsDict["tCors"]])
print
print
print repr([x["rcor"] for x in varsDict["tCors"]])
pass
if "writeOverallReport" in actions:
dc = Cmn.detectionCoverageF(annotsl, varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"])
ppd = Farne.processPupilDisplacement(varsDict["tracking"], dc, annotsl, annots)
VideoQueue.writeOverallReport(reportFileName, videoDescription, videoName, vi, annotsl, annots, varsDict, ppd)
VideoQueue.writeOverallReportTable1(reportFileNameT1, videoDescription, videoName, vi, annotsl, annots, varsDict, ppd)
if "postProcessLogLine" in actions:
if cfg["method"] == "farneback":
if 'annotsl' in locals():
dc = Cmn.detectionCoverageF(annotsl, varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"])
else:
dc = None
Farne.postProcessLogLine(
varsDict["fFlows"], varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"], True, dc, varsDict["tracking"],
videoName, settings['pltSettings']
)
elif cfg["method"] == "templ":
Templ.postProcessLogLine(
varsDict["tCors"], varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"], True,
videoName, settings['pltSettings']
)
elif cfg["method"] == "blackpixels":
Blackpixels.postProcessLogLine(
varsDict["bPixes"], varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"], True,
videoName, settings['pltSettings']
)
if "displayPupilDisplacement" in actions:
if cfg["method"] == "farneback":
dc = Cmn.detectionCoverageF(annotsl, varsDict["lBlinks"], varsDict["rBlinks"], varsDict["jBlinks"])
ppd = Farne.processPupilDisplacement(varsDict["tracking"], dc, annotsl, annots)
Farne.displayPupilDisplacement(ppd)