def main_program(path_data,nb_row_per_classe,
                 use_gpu,
                 nb_epoch,batch_size,learning_rate,
                 path_save_model):




    # Label encoding and decoding dicts
    enc_dict, dec_dict = create_encoding_deconding_dict(path_data)




    #Data_set
    size_image_train = 224
    data_train=create_huge_data_set(path_data,nb_rows=nb_row_per_classe,size_image=size_image_train,encoding_dict=enc_dict)

    data_valid=create_huge_data_set(path_data,nb_rows=100,size_image=size_image_train,skip_rows=range(1,nb_row_per_classe),encoding_dict=enc_dict)





    # Model
    model = create_model(use_gpu)

    if use_gpu:
        model.cuda()

    #Loss
    criterion = nn.CrossEntropyLoss()

    #Optimiser
    optimizer = optim.SGD(model.parameters(), lr=learning_rate)

    # Scheduler LR
    scheduler = LambdaLR(optimizer, lr_lambda=LRPolicy(start_lr=learning_rate))


    #Data loader
    train_loader=DataLoader(data_train,batch_size=batch_size,shuffle=True)
    valid_loader=DataLoader(data_valid,batch_size=batch_size)

    #Train
    train_model(model,train_loader,valid_loader,nb_epoch,
                scheduler,optimizer,criterion,use_gpu,
                path_save=path_save_model)








    pass
def main_program(path_data, nb_row_per_classe, use_gpu, do_training,
                 do_testing, nb_epoch, batch_size, learning_rate,
                 path_save_model):

    # Label encoding and decoding dicts
    enc_dict, dec_dict = create_encoding_deconding_dict(path_data)

    #Data_set
    size_image_train = 224
    data_train = create_huge_data_set(path_data,
                                      nb_rows=nb_row_per_classe,
                                      size_image=size_image_train,
                                      encoding_dict=enc_dict)

    data_valid = create_huge_data_set(path_data,
                                      nb_rows=100,
                                      size_image=size_image_train,
                                      skip_rows=range(1, nb_row_per_classe),
                                      encoding_dict=enc_dict)

    # Model
    model = create_model(use_gpu)

    if use_gpu:
        model.cuda()

    #Loss
    criterion = nn.CrossEntropyLoss()

    #Optimiser
    optimizer = optim.SGD(model.parameters(), lr=learning_rate)

    # Scheduler LR
    scheduler = LambdaLR(optimizer, lr_lambda=LRPolicy(start_lr=learning_rate))

    #Data loader
    train_loader = DataLoader(data_train, batch_size=batch_size, shuffle=True)
    valid_loader = DataLoader(data_valid, batch_size=batch_size)

    #Train
    if do_training:
        train_model(model,
                    train_loader,
                    valid_loader,
                    nb_epoch,
                    scheduler,
                    optimizer,
                    criterion,
                    use_gpu,
                    path_save=path_save_model)

        score = validate(model, valid_loader, use_gpu=use_gpu)[0]
        print(score)

    #Test
    if do_testing:
        print("BIDON")
        model_final, history = load_model_weights(model,
                                                  path_save_model,
                                                  type="best",
                                                  use_gpu=use_gpu,
                                                  get_history=True)
        history.display()
        score = validate(model, valid_loader, use_gpu=use_gpu)[0]
        print(score)

    pass