Ajout RandAugment

This commit is contained in:
Harle, Antoine (Contracteur) 2019-11-27 12:54:19 -05:00
parent 3c2022de32
commit 4a7e73088d
4 changed files with 249 additions and 37 deletions

View file

@ -14,6 +14,26 @@ tf_names = [
'ShearX',
'ShearY',
## Color TF (Expect image in the range of [0, 1]) ##
'Contrast',
'Color',
'Brightness',
'Sharpness',
'Posterize',
'Solarize', #=>Image entre [0,1] #Pas opti pour des batch
#Color TF (Common mag scale)
#'+Contrast',
#'+Color',
#'+Brightness',
#'+Sharpness',
#'-Contrast',
#'-Color',
#'-Brightness',
#'-Sharpness',
#'=Posterize',
#'=Solarize',
#'BRotate',
#'BTranslateX',
#'BTranslateY',
@ -24,14 +44,10 @@ tf_names = [
#'BadTranslateY',
#'BadTranslateY_neg',
## Color TF (Expect image in the range of [0, 1]) ##
'Contrast',
'Color',
'Brightness',
'Sharpness',
'Posterize',
'Solarize', #=>Image entre [0,1] #Pas opti pour des batch
#'BadColor',
#'BadSharpness',
#'BadContrast',
#'BadBrightness',
#Non fonctionnel
#'Auto_Contrast', #Pas opti pour des batch (Super lent)
#'Equalize',
@ -47,8 +63,8 @@ else:
##########################################
if __name__ == "__main__":
n_inner_iter = 10
epochs = 100
n_inner_iter = 0
epochs = 150
dataug_epoch_start=0
#### Classic ####
@ -74,12 +90,13 @@ if __name__ == "__main__":
print('-'*9)
'''
#### Augmented Model ####
'''
#'''
t0 = time.process_time()
tf_dict = {k: TF.TF_dict[k] for k in tf_names}
#tf_dict = TF.TF_dict
aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=1, mix_dist=0.0, fixed_prob=True, fixed_mag=False, shared_mag=False), LeNet(3,10)).to(device)
#aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=1, mix_dist=0.0, fixed_prob=False, fixed_mag=True, shared_mag=True), LeNet(3,10)).to(device)
#aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=2, mix_dist=0.5, fixed_mag=True, shared_mag=True), WideResNet(num_classes=10, wrn_size=160)).to(device)
aug_model = Augmented_model(RandAug(TF_dict=tf_dict, N_TF=2), LeNet(3,10)).to(device)
print(str(aug_model), 'on', device_name)
#run_simple_dataug(inner_it=n_inner_iter, epochs=epochs)
log= run_dist_dataugV2(model=aug_model, epochs=epochs, inner_it=n_inner_iter, dataug_epoch_start=dataug_epoch_start, print_freq=10, loss_patience=None)
@ -98,9 +115,9 @@ if __name__ == "__main__":
print('Execution Time : %.00f '%(time.process_time() - t0))
print('-'*9)
'''
#### TF tests ####
#'''
#### TF tests ####
'''
res_folder="res/brutus-tests/"
epochs= 150
inner_its = [1, 10]
@ -150,4 +167,4 @@ if __name__ == "__main__":
#plot_resV2(log, fig_name=res_folder+filename, param_names=tf_names)
print('-'*9)
#'''
'''