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


Python Experiment.test方法代码示例

本文整理汇总了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')
开发者ID:kkansky,项目名称:and_or_images,代码行数:28,代码来源:kmeans_compression.py

示例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")
开发者ID:kkansky,项目名称:and_or_images,代码行数:22,代码来源:window_grid.py

示例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()
开发者ID:mrastegari,项目名称:Basic_Image_Classification,代码行数:25,代码来源:main.py

示例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
开发者ID:chloebt,项目名称:attelo,代码行数:26,代码来源:exp_suite.py

示例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)
开发者ID:kkansky,项目名称:and_or_images,代码行数:6,代码来源:grid_particle_learning.py


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