コード例 #1
0
def run_test(path_model, path_csv, path_output):
    model_name = 'SENET154'
    batch_size = 16
    img_size = 256
    crop_size = 224
    target_mean = np.array([0.485, 0.456, 0.406])
    target_std = np.array([0.229, 0.224, 0.225])

    data_transform = DataTransform(no_bg=True, pad=True)
    data_transform_valid = data_transform.get_test(img_size=img_size,
                                                   crop_size=crop_size,
                                                   target_mean=target_mean,
                                                   target_std=target_std,
                                                   positions=[0, 2, 9])

    device = torch.device("cuda:0")

    output_lst = predict.predict(path_csv=path_csv,
                                 path_model=path_model,
                                 model_name=model_name,
                                 batch_size=batch_size,
                                 device=device,
                                 transform=data_transform_valid)

    pandas.DataFrame(output_lst).to_csv(path_output, header=False, index=False)
コード例 #2
0
def run_test(path_model, path_csv, path_output):
    model_name = 'DENSENET161-LARGE3'
    batch_size = 16
    img_size = 366
    crop_size = 320
    target_mean = 0.456
    target_std = 0.225

    data_transform = DataTransform(no_bg=True, pad=True)
    data_transform_valid = data_transform.get_test(img_size=img_size,
                                                   crop_size=crop_size,
                                                   target_mean=target_mean,
                                                   target_std=target_std,
                                                   positions=[6, 3, 4])

    device = torch.device("cuda:0")

    output_lst = predict.predict(path_csv=path_csv,
                                 path_model=path_model,
                                 model_name=model_name,
                                 batch_size=batch_size,
                                 device=device,
                                 transform=data_transform_valid)

    pandas.DataFrame(output_lst).to_csv(path_output, header=False, index=False)
コード例 #3
0
def run_test(path_model, path_csv, path_output):
    model_name = 'VGG16-BN'
    batch_size = 16
    img_size = 256
    crop_size = 224
    target_mean = 0.0
    target_std = 1.0

    data_transform = DataTransform(no_bg=True, pad=True)
    data_transform_valid = data_transform.get_test(img_size=img_size,
                                                   crop_size=crop_size,
                                                   target_mean=target_mean,
                                                   target_std=target_std,
                                                   positions=[5, 6, 4])

    device = torch.device("cuda:0")

    output_lst = predict.predict(path_csv=path_csv,
                                 path_model=path_model,
                                 model_name=model_name,
                                 batch_size=batch_size,
                                 device=device,
                                 transform=data_transform_valid)

    pandas.DataFrame(output_lst).to_csv(path_output, header=False, index=False)
コード例 #4
0
def run_test(path_model, path_csv, path_output):
    model_name = 'DUALPATHNET107_5k'
    batch_size = 16
    img_size = 256
    crop_size = 224
    target_mean = np.array([124 / 255, 117 / 255, 104 / 255])
    target_std = 1 / (.0167 * 255)

    data_transform = DataTransform(no_bg=True, pad=True)
    data_transform_valid = data_transform.get_test(img_size=img_size, crop_size=crop_size, target_mean=target_mean,
                                                   target_std=target_std, positions=[0, 1, 8])

    device = torch.device("cuda:0")

    output_lst = predict.predict(
        path_csv=path_csv,
        path_model=path_model,
        model_name=model_name,
        batch_size=batch_size,
        device=device,
        transform=data_transform_valid
    )

    pandas.DataFrame(output_lst).to_csv(path_output, header=False, index=False)
コード例 #5
0
ファイル: run_test_129.py プロジェクト: gonglinyuan/MURA
def run_test(path_model, path_csv, path_output):
    model_name = 'INCEPTIONV4-LARGE'
    batch_size = 16
    img_size = 378
    crop_size = 331
    target_mean = 0.5
    target_std = 0.5

    data_transform = DataTransform(no_bg=True, pad=True)
    data_transform_valid = data_transform.get_test(img_size=img_size, crop_size=crop_size, target_mean=target_mean,
                                                   target_std=target_std, positions=[1, 2, 9])

    device = torch.device("cuda:0")

    output_lst = predict.predict(
        path_csv=path_csv,
        path_model=path_model,
        model_name=model_name,
        batch_size=batch_size,
        device=device,
        transform=data_transform_valid
    )

    pandas.DataFrame(output_lst).to_csv(path_output, header=False, index=False)