本文整理汇总了Python中experiment.Experiment.test方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.test方法的具体用法?Python Experiment.test怎么用?Python Experiment.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类experiment.Experiment
的用法示例。
在下文中一共展示了Experiment.test方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import test [as 别名]
def test(self):
""" Test that every image is correctly recognized. """
Experiment.test(self)
start = time.time()
num_confused = 0.0
classifier = self.network.get_classifier()
i = 0
while self.image_iterator.has_next():
image, category, img_idx = self.image_iterator.next()
recognized = self.network.do_inference(numpy.array(image), category)
if not recognized:
active_cats = classifier.get_winning_category()
#print colored("Failed: " + category + " recognized as "+active_cats, 'red')
num_confused += 1
i += 1
if i % self.PRINT_INCR == 0: print "Iter:", i
confusion_rate = num_confused / float(i)
elapsed = (time.time() - start)
print "Testing time:", elapsed
print "Time per category:", (elapsed / i)
print colored("Testing complete", "green")
print colored("\nConfusion rate: " + str(confusion_rate), 'cyan')
示例2: test
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import test [as 别名]
def test(self):
""" Test that every image is correctly recognized. """
Experiment.test(self)
start = time.time()
classifier = self.network.get_classifier()
i = 0
while self.image_iterator.has_next():
image, category = self.image_iterator.next()
recognized = self.network.do_inference(numpy.array(image), category)
if not recognized:
active_cats = classifier.get_active_categories()
print colored("Failed: " + category + " recognized as "+repr(active_cats), 'red')
i += 1
if i % self.PRINT_INCR == 0: print "Iter:", i
elapsed = (time.time() - start)
print "Testing time:", elapsed
print "Time per category:", (elapsed / i)
print colored("Testing complete", "green")
示例3: main
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import test [as 别名]
def main():
""" This is the main entry point for training and testing your classifier. """
classifier = Classifier()
experiment = Experiment(classifier)
experiment.train('training')
# Sanity check. Should get 100% on the training images.
report = experiment.test('training')
report.print_summary()
Pdb.set_trace()
test_datasets = 'translations rotations scales noise occlusion distortion blurry_checkers'
final_report = ClassificationReport("All Datasets")
# Print the classification results of each test
for dataset in test_datasets.split():
report = experiment.test('testing/' + dataset)
report.print_summary()
#report.print_errors() # Uncomment this to print the error images for debugging.
final_report.extend(report)
final_report.print_summary()
示例4: MySuite
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import test [as 别名]
class MySuite(PyExperimentSuite):
def reset(self, params, rep):
train_dir = params['train_dir']
test_dir = params['test_dir']
model_type = params["model"]
update = params["update"]
avg = params["avg"]
C = params["aggressiveness"] # only for PA
self._exp = Experiment(train_dir,
test_dir,
model_type=model_type,
update=update,
avg=avg,
C=C)
# settings for training
self._epochs = params["epochs"]
return
def iterate(self, params, rep, n):
self._exp.train( self._epochs )
res = self._exp.test()
return res
示例5: test
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import test [as 别名]
def test(self):
""" This tests what percentage of the images that were learned are
correctly recognized. """
Experiment.test(self)