示例#1
0
        generate_dataset.save_images()
        generate_dataset.save_images('finaltest')
        generate_dataset.save_images('val')

    if args.hyperparams:
        epochs = args.epochs
        lr = args.learning_rate
        batchsize = args.batch_size
    else:
        epochs = 100
        lr = 0.005
        batchsize = 128

    if args.train:
        net = Deep_Emotion()
        net.to(device)
        print("Model archticture: ", net)
        traincsv_file = args.data + '/' + 'train.csv'
        validationcsv_file = args.data + '/' + 'val.csv'
        train_img_dir = args.data + '/' + 'train/'
        validation_img_dir = args.data + '/' + 'val/'

        transformation = transforms.Compose(
            [transforms.ToTensor(),
             transforms.Normalize((0.5, ), (0.5, ))])
        train_dataset = Plain_Dataset(csv_file=traincsv_file,
                                      img_dir=train_img_dir,
                                      datatype='train',
                                      transform=transformation)
        validation_dataset = Plain_Dataset(csv_file=validationcsv_file,
                                           img_dir=validation_img_dir,
示例#2
0
#         batchsize = 128

#     if args.train:
#         net = Deep_Emotion()
#         net.to(device)
#         print("Model archticture: ", net)
#         traincsv_file = args.data+'/'+'train.csv'
#         validationcsv_file = args.data+'/'+'val.csv'
#         train_img_dir = args.data+'/'+'train/'
#         validation_img_dir = args.data+'/'+'val/'

epochs = 100
lr = 0.005  # Learning rate
batchsize = 128
net = Deep_Emotion()  ## CREATING THE MODEL BY CALLING DEEPMOTION.PY
net.to(device)  ## MOVING IT TO GPU / CPU
print("Model archticture: ", net)
traincsv_file = 'data' + '/' + 'train.csv'
validationcsv_file = 'data' + '/' + 'val.csv'
train_img_dir = 'data' + '/' + 'train/'
validation_img_dir = 'data' + '/' + 'val/'

transformation = transforms.Compose(
    [transforms.ToTensor(),
     transforms.Normalize((0.5, ), (0.5, ))])
train_dataset = Plain_Dataset(csv_file=traincsv_file,
                              img_dir=train_img_dir,
                              datatype='train',
                              transform=transformation)
validation_dataset = Plain_Dataset(csv_file=validationcsv_file,
                                   img_dir=validation_img_dir,