コード例 #1
0
 def test_detect(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     image = Image()
     image_container = ImageContainer(image)
     detections = detector.detect(image_container)
     nose.tools.ok_(detections is not None, "Unexpected empty detections")
     nose.tools.assert_equal(len(detections), 1)
コード例 #2
0
 def test_detect(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     image = Image()
     image_container = ImageContainer(image)
     detections = detector.detect(image_container)
     nose.tools.ok_(detections is not None,
                    "Unexpected empty detections" )
     nose.tools.assert_equal(len(detections), 1)
コード例 #3
0
 def test_config(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     # Verify that 6 config values are present in example_detector
     nose.tools.assert_equal(len(detector.get_configuration()), 6)
     test_cfg = _dummy_detector_cfg()
     # Verify that the detector has different configuration before setting to test
     nose.tools.assert_not_equal(detector.check_configuration(test_cfg), False)
     detector.set_configuration(test_cfg)
     # Verify that the config value is being set properly
     nose.tools.assert_equal(detector.check_configuration(test_cfg), True)
コード例 #4
0
 def test_config(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     # Verify that 6 config values are present in example_detector
     nose.tools.assert_equal(len(detector.get_configuration()), 6)
     test_cfg = _dummy_detector_cfg()
     # Verify that the detector has different configuration before setting to test
     nose.tools.assert_not_equal(detector.check_configuration(test_cfg),
                                 False)
     detector.set_configuration(test_cfg)
     # Verify that the config value is being set properly
     nose.tools.assert_equal(detector.check_configuration(test_cfg), True)
コード例 #5
0
    def test_nested_config(self):
        modules.load_known_modules()
        detector = ImageObjectDetector.create("SimpleImageObjectDetector")
        nested_cfg = config.empty_config()
        ImageObjectDetector.get_nested_algo_configuration(
            "detector", nested_cfg, detector)
        # Verify that test cfg is set to configuration inside detector
        # nested configuration uses the name of a detector as an additional configuration
        # key thus it is checked against 7 rather than 6
        #nose.tools.assert_equal(len(nested_cfg), 7)

        #test_cfg = _dummy_detector_cfg()
        #test_cfg.set_value("example_detector:type", "example_detector")
        #ImageObjectDetector.set_nested_algo_configuration( "example_detector",
        #                                    test_cfg,
        #                                    detector )
        nose.tools.assert_equal(
            ImageObjectDetector.check_nested_algo_configuration(
                "detector", nested_cfg), True)
コード例 #6
0
    def test_nested_config(self):
        modules.load_known_modules()
        detector = ImageObjectDetector.create("SimpleImageObjectDetector")
        nested_cfg = config.empty_config()
        ImageObjectDetector.get_nested_algo_configuration( "detector",
                                                            nested_cfg,
                                                            detector )
        # Verify that test cfg is set to configuration inside detector
        # nested configuration uses the name of a detector as an additional configuration
        # key thus it is checked against 7 rather than 6
        #nose.tools.assert_equal(len(nested_cfg), 7)

        #test_cfg = _dummy_detector_cfg()
        #test_cfg.set_value("example_detector:type", "example_detector")
        #ImageObjectDetector.set_nested_algo_configuration( "example_detector",
        #                                    test_cfg,
        #                                    detector )
        nose.tools.assert_equal(ImageObjectDetector.check_nested_algo_configuration(
                                                            "detector",
                                                            nested_cfg), True)
コード例 #7
0
 def test_bad_detect(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     detector.detect("Image")
コード例 #8
0
 def test_bad_create(self):
     # Should fail to create an algorithm without a factory
     ImageObjectDetector.create("")
コード例 #9
0
 def test_bad_detect(self):
     modules.load_known_modules()
     detector = ImageObjectDetector.create("example_detector")
     detector.detect("Image")
コード例 #10
0
 def test_bad_create(self):
     # Should fail to create an algorithm without a factory
     ImageObjectDetector.create("")