Beispiel #1
0
def processFolder(datasetPath, binaryRootPath):
    """Call your executable for all sequences in all categories."""
    stats = Stats(datasetPath)  #STATS
    for category in getDirectories(datasetPath):
        categoryPath = os.path.join(datasetPath, category)

        if isValidVideoFolder(categoryPath):
            stats.addCategories(category)  #STATS

            for video in getDirectories(categoryPath):
                videoPath = categoryPath

                if video != "FramesRGB" and video != "FramesT" and video != "groundtruthRgb" and video != "groundtruthT":
                    binaryPath = os.path.join(binaryRootPath, category, video)
                    if isValidResultsFolder(binaryPath):
                        confusionMatrix = compareWithGroungtruth(
                            videoPath, os.path.join(binaryPath, 'MoG'))
                        stats.update(category, video + '/MoG', confusionMatrix)
                        confusionMatrix = compareWithGroungtruth(
                            videoPath, os.path.join(binaryPath, 'SubSENSE'))
                        stats.update(category, video + '/SubSENSE',
                                     confusionMatrix)

            stats.writeCategoryResult(category)
    stats.writeOverallResults()
def processFolder(datasetPath, binaryRootPath):
    """Call your executable for all sequences in all categories."""
    stats = Stats(datasetPath)  #STATS
    for category in getDirectories(datasetPath):
        stats.addCategories(category)  #STATS

        categoryPath = os.path.join(datasetPath, category)
        for video in getDirectories(categoryPath):
            videoPath = os.path.join(categoryPath, video)
            binaryPath = os.path.join(binaryRootPath, category, video)
            if isValidVideoFolder(videoPath):
                confusionMatrix = compareWithGroungtruth(videoPath, binaryPath)
                stats.update(category, video, confusionMatrix)

        stats.writeCategoryResult(category)
    stats.writeOverallResults()
def processFolder(datasetPath, binaryRootPath):
    """Call your executable for all sequences in all categories."""
    stats = Stats(datasetPath)  #STATS
    f = open(datasetPath + '\\' +  'fscore.txt', 'w')
    for category in getDirectories(datasetPath):
        stats.addCategories(category)  #STATS
        
        categoryPath = os.path.join(datasetPath, category)
        for video in getDirectories(categoryPath):
            videoPath = os.path.join(categoryPath, video)
            binaryPath = os.path.join(binaryRootPath, category, video)
            if isValidVideoFolder(videoPath):
                confusionMatrix = compareWithGroungtruth(videoPath, binaryPath)
                stats.update(category, video, confusionMatrix)
                alpha = 0.000001
                fscore = (2.0 * confusionMatrix[0])/ (((2.0 * confusionMatrix[0]) + confusionMatrix[1] + confusionMatrix[2]) + alpha)
                f.write(video + ' : ' + str(fscore) + '\n')
            else:
                print ('Invalid folder : ' + videoPath)
        stats.writeCategoryResult(category)
    stats.writeOverallResults()
    f.close()