def TestDatasets3():
    print('[INFO] -------------------------------------------------')
    print('[INFO] set datasets')
    _, test_lips, _, test_tongue, _, test_label = load_dataset()
    test_lips = test_lips[800:1200+i-1,:,:,:]
    test_tongue = test_tongue[800:1200+i-1,:,:,:]
    test_label = test_label[800:1200,:]
    # print(test_lips.shape, test_tongue.shape, test_label.shape)

    # #preprocessing
    test_lips = match_image_label(test_lips)
    test_tongue = match_image_label(test_tongue)

    #to torch.tensor
    test_lips = torch.from_numpy(test_lips).float()
    test_tongue = torch.from_numpy(test_tongue).float()
    test_label = torch.from_numpy(test_label).float()

    #change dimension (x,64,64,1) --> (x,1,64,64)
    test_lips = test_lips.permute(0,3,1,2)
    test_tongue = test_tongue.permute(0,3,1,2)

    #两通道
    test_datasets3 = TensorDataset(test_lips, test_tongue, test_label)
    test_loader3 = DataLoader(dataset=test_datasets3, batch_size=BATCH_SIZE, shuffle=False)

    return test_datasets3, test_loader3
Example #2
0
def TestDatasets2():
    print('[INFO] -------------------------------------------------')
    print('[INFO] set datasets')
    # _, test_lips, _, test_tongue, _, test_label = load_dataset()
    test_lips = np.load('../data/new_database/ssnv_train_lips.npy')
    test_tongue = np.load('../data/new_database/ssnv_train_tongue.npy')
    test_lips = test_lips[400:800+i-1,:,:,:]
    test_tongue = test_tongue[400:800+i-1,:,:,:]

    # #preprocessing
    test_lips = match_image_label(test_lips)
    test_tongue = match_image_label(test_tongue)
    
    #to torch.tensor
    test_lips = torch.from_numpy(test_lips).float()
    test_tongue = torch.from_numpy(test_tongue).float()

    #change dimension (x,64,64,1) --> (x,1,64,64)
    test_lips = test_lips.permute(0,3,1,2)
    test_tongue = test_tongue.permute(0,3,1,2)

    #两通道
    test_datasets2 = TensorDataset(test_lips, test_tongue)
    test_loader2 = DataLoader(dataset=test_datasets2, batch_size=BATCH_SIZE, shuffle=False)

    return test_datasets2, test_loader2