本文整理汇总了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")
示例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))