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


Python Constants.matchHistToName方法代码示例

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


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

示例1: run

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import matchHistToName [as 别名]
    def run(self):
        self.train()
        speciesFolders = cleanHiddenFiles(getFolderContents(self.path))
        for speciesName in speciesFolders:
            speciesFolder = getPath(self.path, speciesName) #folder for 1 species
            if os.path.isdir(speciesFolder):
                images = cleanHiddenFiles(getFolderContents(speciesFolder))
                for imageName in images:
                    try:
                        name = getPath(speciesFolder, imageName)
                        img = loadImage(name)
                        start = time.time()
                        #a mobile phone would request to process the image and get the species list
                        speciesImage = LeafImage(inputImg=img, disks=self.disks, circumferences=self.circumferences)
                        neighbours1, dist1 = self.runKnn(self.knn1, speciesImage.getHistogram(C.HIST_HCoS))
                        neighbours2, dist2 = self.runKnn(self.knn2, speciesImage.getHistogram(C.HIST_LBP_R1P8_R3P16_CONCAT))
                        histPath = C.matchHistToName(C.HIST_HCoS)
                        expectedLabel = Label(speciesName, histPath, speciesFolder)
                        kResults = self.getTopK(neighbours1, dist1, neighbours2, dist2, self.maxk, expectedLabel)
                        
                        end = time.time()
                        elapsed = end - start
                        self.log.write(name  + "\t" + str(elapsed))
                        aux = self.parseResults(kResults) + "\n"
                        print(name  + "\t" + str(elapsed))
                    except Exception as e:
                        print(e)
        self.log.toDisk("/Users/maeotaku/Documents/time_results_noisy.txt")
    

    
                    
开发者ID:maeotaku,项目名称:leaf_recognition_sdk,代码行数:30,代码来源:MobileSimulation.py

示例2: load

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import matchHistToName [as 别名]
 def load(self, ht, path, data, labels):
     speciesFolders = cleanHiddenFiles(getFolderContents(path))
     for speciesName in speciesFolders:
         speciesFolder = getPath(path, speciesName) #folder for 1 species
         if os.path.isdir(speciesFolder):
             folder = getPath(speciesFolder, C.matchHistToName(ht)) #go inside to the folder related to the type of histogram
             histogramsPaths = cleanHiddenFiles(getFolderContents(folder))
             for histPath in histogramsPaths:
                 try:
                     hist = loadObj(getPath(folder, histPath))
                     #print(hist, len(hist))
                     data.append(hist)
                     labels.append(Label(speciesName, histPath, speciesFolder))
                     del hist
                 except Exception as e:
                     print(str(e))
开发者ID:maeotaku,项目名称:MScThesis,代码行数:18,代码来源:DataSetBase.py


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