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

Before Change



    // Delete the temporary data created
    all_images = glob.glob(os.path.join(image_dest_folder, "*.jpg"))
    for im in all_images:
        os.remove(im)

    os.rmdir(image_dest_folder)


if __name__ == "__main__":

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: 4

Non-data size: 6

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_image_resizing_num_channel_handling


Project Name: lene/nn-wtf
Commit Name: b06553463a869bcc7d8fd502c5ba284c96148fd4
Time: 2016-02-17
Author: lene.preuss@gmail.com
File Name: main.py
Class Name:
Method Name: run_training


Project Name: OpenNMT/OpenNMT-py
Commit Name: 8a70c277c355fe734a01fe58baafdc2dc5164205
Time: 2016-12-29
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: eval


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