Esempio n. 1
0
                ], [np.mean(image_std[-3:]).tolist()]


if __name__ == '__main__':
    # train on the GPU or on the CPU, if a GPU is not available
    device = torch.device(
        'cuda') if torch.cuda.is_available() else torch.device('cpu')
    device = torch.device('cuda:0')

    # our dataset has three classes only - background, non-damaged, and damaged
    num_classes = 2

    input_c = 1
    # use our dataset and defined transformations
    dataset = Dataset("./datasets/iros/bishop/aug/",
                      transforms=get_transform(train=True),
                      include_name=False,
                      input_channel=input_c)
    ##dataset_test = Dataset("./datasets/Rock/data_test/", transforms=get_transform(train=False), include_name=False, input_channel=input_c)
    #dataset_test = Dataset("./datasets/Rock_test/mult/", transforms=get_transform(train=False), include_name=False, input_channel=input_c)
    dataset_test = Dataset("./datasets/iros/bishop_test/mult_masks/",
                           transforms=get_transform(train=False),
                           include_name=False,
                           input_channel=input_c)
    # image_mean, image_std, _, _ = dataset.imageStat()
    image_mean = [
        0.2635908247051704, 0.2565450032962188, 0.24311759802366928,
        0.3007502338171828, 0.35368477144149774, 0.35639093071269307,
        0.5402165474345183, 0.24508291731782375
    ]
    image_std = [
        0.14736204788409055, 0.13722317885795837, 0.12990199087409235,
Esempio n. 2
0
    elif input_channel == 'dem':
        return image_mean[-3:], image_std[-3:]


if __name__ == '__main__':
    # train on the GPU or on the CPU, if a GPU is not available
    device = torch.device(
        'cuda') if torch.cuda.is_available() else torch.device('cpu')
    device = torch.device('cuda:1')

    # our dataset has three classes only - background, non-damaged, and damaged
    num_classes = 2

    input_c = 3
    dataset_test = Dataset("./datasets/Rock/mult_10/",
                           transforms=get_transform(train=False),
                           include_name=True,
                           input_channel=input_c)
    # dataset = Dataset("./datasets/Rock_test/mult/", transforms=get_transform(train=True), input_channel=8)
    # image_mean, image_std, _, _ = dataset.imageStat()
    image_mean = [
        0.23924888725523394, 0.2180423480395164, 0.2118836715688813,
        0.26721142156890876, 0.32996910784324385, 0.1461123186277879,
        0.5308107499991753, 0.28652559313771186
    ]
    image_std = [
        0.1459739643338365, 0.1311105424825076, 0.12715888419418298,
        0.149469170605332, 0.15553466224696225, 0.10533129832132752,
        0.24088403135495345, 0.24318892151508417
    ]
    image_mean, image_std = get_mean_std(input_c, image_mean, image_std)