mirror of
https://github.com/AntoineHX/smart_augmentation.git
synced 2025-05-04 04:00:46 +02:00
Cross Validation splits + New mesure process time (train utils)
This commit is contained in:
parent
bce882de38
commit
385bc9977c
3 changed files with 51 additions and 30 deletions
|
@ -13,19 +13,19 @@ tf_names = [
|
|||
'Identity',
|
||||
'FlipUD',
|
||||
'FlipLR',
|
||||
#'Rotate',
|
||||
#'TranslateX',
|
||||
#'TranslateY',
|
||||
#'ShearX',
|
||||
#'ShearY',
|
||||
'Rotate',
|
||||
'TranslateX',
|
||||
'TranslateY',
|
||||
'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
|
||||
'Contrast',
|
||||
'Color',
|
||||
'Brightness',
|
||||
'Sharpness',
|
||||
'Posterize',
|
||||
'Solarize', #=>Image entre [0,1] #Pas opti pour des batch
|
||||
|
||||
#Color TF (Common mag scale)
|
||||
#'+Contrast',
|
||||
|
@ -74,12 +74,12 @@ if __name__ == "__main__":
|
|||
|
||||
#Task to perform
|
||||
tasks={
|
||||
'classic',
|
||||
#'aug_model'
|
||||
#'classic',
|
||||
'aug_model'
|
||||
}
|
||||
#Parameters
|
||||
n_inner_iter = 1
|
||||
epochs = 2
|
||||
epochs = 150
|
||||
dataug_epoch_start=0
|
||||
optim_param={
|
||||
'Meta':{
|
||||
|
@ -147,7 +147,7 @@ if __name__ == "__main__":
|
|||
|
||||
tf_dict = {k: TF.TF_dict[k] for k in tf_names}
|
||||
model = Higher_model(model, model_name) #run_dist_dataugV3
|
||||
aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=2, mix_dist=0.8, fixed_prob=False, fixed_mag=False, shared_mag=False), model).to(device)
|
||||
aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=3, mix_dist=0.8, fixed_prob=False, fixed_mag=False, shared_mag=False), model).to(device)
|
||||
#aug_model = Augmented_model(RandAug(TF_dict=tf_dict, N_TF=2), model).to(device)
|
||||
|
||||
print("{} on {} for {} epochs - {} inner_it".format(str(aug_model), device_name, epochs, n_inner_iter))
|
||||
|
@ -156,7 +156,7 @@ if __name__ == "__main__":
|
|||
inner_it=n_inner_iter,
|
||||
dataug_epoch_start=dataug_epoch_start,
|
||||
opt_param=optim_param,
|
||||
print_freq=1,
|
||||
print_freq=20,
|
||||
unsup_loss=1,
|
||||
hp_opt=False,
|
||||
save_sample_freq=None)
|
||||
|
@ -174,7 +174,7 @@ if __name__ == "__main__":
|
|||
"Param_names": aug_model.TF_names(),
|
||||
"Log": log}
|
||||
print(str(aug_model),": acc", out["Accuracy"], "in:", out["Time"][0], "+/-", out["Time"][1])
|
||||
filename = "{}-{} epochs (dataug:{})- {} in_it".format(str(aug_model),epochs,dataug_epoch_start,n_inner_iter)
|
||||
filename = "{}-{} epochs (dataug:{})- {} in_it".format(str(aug_model),epochs,dataug_epoch_start,n_inner_iter)+"(CV)"
|
||||
with open("../res/log/%s.json" % filename, "w+") as f:
|
||||
try:
|
||||
json.dump(out, f, indent=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue