Beispiel #1
0
def test_pipeline_illegal_arguments():
    image_paths = glob("tests/test_images/*")
    output_paths = []
    with pytest.raises(ValueError):
        images_pipeline(
            image_paths,
            output_paths,
        )
Beispiel #2
0
def test_pipeline():
    """Testing execution of the complete pipeline."""
    image_paths = glob("tests/test_images/*")
    output_paths = [
        "tests/pipeline/{}.jpg".format("".join(
            os.path.basename(image_path).split(".")[:-1]))
        for image_path in image_paths
    ]
    images_pipeline(image_paths[:1], output_paths[:1], verbose=False, n_jobs=0)
    images_pipeline(image_paths, output_paths, save_steps=True, n_jobs=0)
"""
    Script that runs the preprocessing pipeline on input images.
"""
from covidxpert import images_pipeline

from glob import glob
import pandas as pd
import multiprocessing

if __name__ == "__main__":
    root = "/io/data"
    dataset_path = f'{root}/datasets/{{}}'
    output_path = f'{root}/processed/{{}}'
    error_path = f'{root}/error_pipeline/'
    width = 480
    initial_width = 1024
    df_index = pd.read_csv(
        f'{root}/datasets/normalized_index/df_all_common_cols.csv')
    img_path = [dataset_path.format(path) for path in df_index.img_path]
    out_path = [output_path.format(path) for path in df_index.img_path]

    images_pipeline(img_path,
                    out_path,
                    width=width,
                    initial_width=initial_width,
                    cache=True,
                    errors_path=error_path)