Beispiel #1
0
import sys
sys.path.insert(1, 'fmri_cnn')
import common

train_dataset = common.TimeseriesDataset("train_set_class.pkl")
len(train_dataset)
train_dataset[10]
Beispiel #2
0

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--data_folder',
        required=True,
        help='path to folder contaning all the data - train, validate and test'
    )
    parser.add_argument('--out_folder',
                        required=True,
                        help='path to folder where to save the model')
    args = parser.parse_args()

    train_dataset = common.TimeseriesDataset(
        os.path.join(args.data_folder, "train_set_class.pkl"))

    validate_dataset = common.TimeseriesDataset(
        os.path.join(args.data_folder, "validate_set_class.pkl"))

    train_loader = torch.utils.data.DataLoader(dataset=train_dataset,
                                               batch_size=batch_size,
                                               shuffle=True)

    validate_loader = torch.utils.data.DataLoader(dataset=validate_dataset,
                                                  batch_size=batch_size,
                                                  shuffle=False)

    #create object of the fMRI_CNN class
    fMRI_CNN = common.fMRI_CNN()
    fMRI_CNN = common.to_cuda(fMRI_CNN)
Beispiel #3
0
    accuracy = (100 * float(correct) / total)
    print("number of below:", num_of_below_avg, " number of average:",
          num_of_avg, " number of above:", num_of_above_avg)
    return accuracy


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--data_folder',
        required=True,
        help='path to folder contaning all the data - train, validate and test'
    )
    parser.add_argument('--model',
                        required=True,
                        help='path to the model after training')
    args = parser.parse_args()

    test_dataset = common.TimeseriesDataset(
        os.path.join(args.data_folder, "test_set_class.pkl"))

    test_loader = torch.utils.data.DataLoader(dataset=test_dataset,
                                              shuffle=False)
    net = common.DeepFCNet()
    #load the model
    net = load_checkpoint(net, args.model)
    net = common.to_cuda(net)
    # Test the Model
    testErr = testFunc(net, test_loader)
    print(testErr)