当前位置: 首页>>代码示例>>Python>>正文


Python Common.parseAnnotationsMy方法代码示例

本文整理汇总了Python中common.Common.parseAnnotationsMy方法的典型用法代码示例。如果您正苦于以下问题:Python Common.parseAnnotationsMy方法的具体用法?Python Common.parseAnnotationsMy怎么用?Python Common.parseAnnotationsMy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.Common的用法示例。


在下文中一共展示了Common.parseAnnotationsMy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processOutputs

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import parseAnnotationsMy [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)
开发者ID:predkambrij,项目名称:eyeMonTester,代码行数:96,代码来源:videoQueue.py


注:本文中的common.Common.parseAnnotationsMy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。