d6c1b86594ef9a97e9f503547ab6567f89508486,tests/integration_tests/test_experiment.py,,test_image_resizing_num_channel_handling,#Any#,401

Before Change


    
    // Image Inputs
    image_dest_folder = os.path.join(os.getcwd(), "generated_images")
    input_features_template = Template(
        "[{type: text, name: random_text, vocab_size: 100,"
        " max_len: 10, encoder: stacked_cnn}, {type: numerical,"
        " name: random_number}, "
        "{type: image, name: random_image, encoder: ${encoder}, preprocessing:"
        " {width: 8, in_memory: ${in_memory},"
        " height: 8, num_channels: 3},"
        " resnet_size: 8, fc_size: 32, destination_folder: ${folder}}]")

    // Resnet encoder
    input_features = input_features_template.substitute(
        encoder="resnet",
        folder=image_dest_folder,
        in_memory="true",
    )
    output_features = "[{type: binary, name: intent, reduce_input: sum}, " \
                      "{type: numerical, name: random_num_output}]"

    rel_path = generate_data(

After Change


    image_dest_folder = os.path.join(os.getcwd(), "generated_images")

    // Resnet encoder
    input_features = [
        image_feature(
            folder=image_dest_folder,
            encoder="resnet",
            preprocessing={
                "in_memory": True,
                "height": 8,
                "width": 8,
                "num_channels": 3
            },
            fc_size=8,
            num_filters=8
        ),
        text_feature(encoder="embed", min_len=1),
        numerical_feature()
    ]
    output_features = [binary_feature(), numerical_feature()]
    rel_path = generate_data(
        input_features, output_features, csv_filename, num_examples=50
    )

    df1 = read_csv(rel_path)

    input_features[0]["preprocessing"]["num_channels"] = 1
    rel_path = generate_data(
        input_features, output_features, csv_filename, num_examples=50
    )
    df2 = read_csv(rel_path)

    df = concatenate_df(df1, df2, None)
    df.to_csv(rel_path, index=False)

    // Here the user sepcifiies number of channels. Exception shouldn"t be thrown
    run_experiment(input_features, output_features, data_csv=rel_path)

    del input_features[0]["preprocessing"]["num_channels"]

    // User now doesn"t specify num channels. Should throw exception
    with pytest.raises(ValueError):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: uber/ludwig
Commit Name: d6c1b86594ef9a97e9f503547ab6567f89508486
Time: 2019-05-01
Author: smiryala@uber.com
File Name: tests/integration_tests/test_experiment.py
Class Name:
Method Name: test_image_resizing_num_channel_handling


Project Name: uber/ludwig
Commit Name: d6c1b86594ef9a97e9f503547ab6567f89508486
Time: 2019-05-01
Author: smiryala@uber.com
File Name: tests/integration_tests/test_experiment.py
Class Name:
Method Name: test_experiment_image_inputs


Project Name: uber/ludwig
Commit Name: d6c1b86594ef9a97e9f503547ab6567f89508486
Time: 2019-05-01
Author: smiryala@uber.com
File Name: tests/integration_tests/test_experiment.py
Class Name:
Method Name: test_image_resizing_num_channel_handling


Project Name: uber/ludwig
Commit Name: d6c1b86594ef9a97e9f503547ab6567f89508486
Time: 2019-05-01
Author: smiryala@uber.com
File Name: tests/integration_tests/test_experiment.py
Class Name:
Method Name: test_experiment_tied_weights