b58d873bc4344117bf8a2b42651e9acb5aeddb4e,predict.py,,main,#,30

Before Change


    parser = argparse.ArgumentParser()
    parser.add_argument("--class_dataset", default="CziDataset", help="Dataset class")
    parser.add_argument("--gpu_ids", type=int, default=0, help="GPU ID")
    parser.add_argument("--model_module", default="fnet_model", help="name of the model module")
    parser.add_argument("--n_images", type=int, default=16, help="max number of images to test")
    parser.add_argument("--path_dataset_csv", type=str, help="path to csv for constructing Dataset")
    parser.add_argument("--path_model_dir", help="path to model directory")
    parser.add_argument("--path_save_dir", default="results", help="path to output directory")

After Change


    print(model)
    dataloader = get_dataloader(opts)
    entries = []
    for i, (signal, target) in enumerate(dataloader):
        prediction = model.predict(signal)
        path_tiff_dir = os.path.join(opts.path_save_dir, "{:02d}".format(i))
        if not os.path.exists(path_tiff_dir):
            os.makedirs(path_tiff_dir)
        path_tiff_s = os.path.join(path_tiff_dir, "signal.tiff")
        path_tiff_t = os.path.join(path_tiff_dir, "target.tiff")
        path_tiff_p = os.path.join(path_tiff_dir, "prediction.tiff")
        tifffile.imsave(path_tiff_s, signal.numpy()[0, ])
        print("saved:", path_tiff_s)
        tifffile.imsave(path_tiff_t, target.numpy()[0, ])
        print("saved:", path_tiff_t)
        tifffile.imsave(path_tiff_p, prediction.numpy()[0, ])
        print("saved:", path_tiff_p)
        entries.append({
            "path_signal": path_tiff_s,
            "path_target": path_tiff_t,
            "path_prediction": path_tiff_p,
        })
        if i >= opts.n_images:
            break
    with open(os.path.join(opts.path_save_dir, "predict_options.json"), "w") as fo:
        json.dump(vars(opts), fo, indent=4, sort_keys=True)
    pd.DataFrame(entries).to_csv(os.path.join(opts.path_save_dir, "predictions.csv"))
        
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: AllenCellModeling/pytorch_fnet
Commit Name: b58d873bc4344117bf8a2b42651e9acb5aeddb4e
Time: 2018-01-22
Author: chek.o@outlook.com
File Name: predict.py
Class Name:
Method Name: main


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: ac7bb33dd978e2bf6ecb0cf055dd6bf6c9c1ea05
Time: 2019-04-19
Author: eriklindernoren@live.se
File Name: train.py
Class Name:
Method Name:


Project Name: batra-mlp-lab/visdial-challenge-starter-pytorch
Commit Name: 61421e8d341312e02dff23b46acde4261808dab3
Time: 2018-07-06
Author: karandesai281196@gmail.com
File Name: train.py
Class Name:
Method Name: