Exemple #1
0
def test_example_classification_config_yaml():
    """
    Test that export config and meta yaml from example classification config python.
    """

    config_file = os.path.join("configs", "example", "classification.py")

    config = _load_py(config_file)

    config_yaml = os.path.join("configs", "example", "classification.yaml")

    config_meta = os.path.join("configs", "example",
                               "classification_meta.yaml")

    environment.init("test_example_classification_config_yaml")
    saved_config, saved_meta = save_yaml(environment.EXPERIMENT_DIR, config)

    print(saved_meta)
    with open(config_yaml) as f:
        expected = f.read()
    with open(saved_config) as f:
        data = f.read()
        assert expected == data

    with open(config_meta) as f:
        expected = f.read()
    with open(saved_meta) as f:
        data = f.read()
        assert expected == data
Exemple #2
0
def test_convert_weight_from_darknet_configs():
    """Test that all config files in `configs/convert_weight_from_darknet` dir include requirement keys."""
    dir_path = os.path.join("configs", "convert_weight_from_darknet")

    for config_file in glob.glob(os.path.join(dir_path, "**", "*.py"),
                                 recursive=True):
        config = _load_py(config_file)
        check_config(config, "inference")
Exemple #3
0
def test_core_configs():
    """Test that all config files in `configs/core` dir include requirement keys."""
    dir_path = os.path.join("configs", "core")

    for config_file in glob.glob(os.path.join(dir_path, "**", "*.py"),
                                 recursive=True):
        config = _load_py(config_file)
        check_config(config, "training")
        check_config(config, "inference")
Exemple #4
0
def test_example_config():
    """Test that example config python file include requirement keys."""

    dir_path = os.path.join("configs", "example")

    for config_file in glob.glob(os.path.join(dir_path, "**", "*.py"),
                                 recursive=True):
        config = _load_py(config_file)
        check_config(config, "training")
        check_config(config, "inference")