Skip to content

Commit

Permalink
Train data augmentation scripts and config files closes #26
Browse files Browse the repository at this point in the history
  • Loading branch information
pab1s committed Jul 15, 2024
1 parent b347592 commit 3e1d20b
Show file tree
Hide file tree
Showing 12 changed files with 821 additions and 141 deletions.
81 changes: 81 additions & 0 deletions config/m_color_jitter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
trainer: "BasicTrainer"
random_seed: 43

model:
type: "efficientnet_b0"
parameters:
num_classes: 34
pretrained: true

training:
batch_size: 64
epochs:
initial: 200
fine_tuning: 200
loss_function:
type: "CrossEntropyLoss"
optimizer:
type: "SGD"
parameters:
lr: 0.05
learning_rates:
initial: 0.01
fine_tuning: 0.001
final_fine_tuning: 0.0001
freeze_until_layer: "classifier.1.weight"

metrics:
- type: "Accuracy"
- type: "Precision"
- type: "Recall"
- type: "F1Score"

callbacks:
CSVLogging:
parameters:
csv_path: "dinamically/set/by/date.csv"
Checkpoint:
parameters:
save_freq: 5
EarlyStopping:
parameters:
monitor: "val_loss"
patience: 5
delta: 0
verbose: true

data:
name: "CarDataset"
dataset_path: "./data/processed/DB_Marca"
test_size: 0.1
val_size: 0.1
transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "ColorJitter"
parameters:
brightness: 0.3
contrast: 0.3
saturation: 0.3
hue: 0.1
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
eval_transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

paths:
model_path: "./outputs/models/"
log_path: "./logs/"
plot_path: "./outputs/figures/"
checkpoint_path: "./outputs/checkpoints/"
79 changes: 79 additions & 0 deletions config/m_gaussian_blur.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
trainer: "BasicTrainer"
random_seed: 43

model:
type: "efficientnet_b0"
parameters:
num_classes: 34
pretrained: true

training:
batch_size: 64
epochs:
initial: 200
fine_tuning: 200
loss_function:
type: "CrossEntropyLoss"
optimizer:
type: "SGD"
parameters:
lr: 0.05
learning_rates:
initial: 0.01
fine_tuning: 0.001
final_fine_tuning: 0.0001
freeze_until_layer: "classifier.1.weight"

metrics:
- type: "Accuracy"
- type: "Precision"
- type: "Recall"
- type: "F1Score"

callbacks:
CSVLogging:
parameters:
csv_path: "dinamically/set/by/date.csv"
Checkpoint:
parameters:
save_freq: 5
EarlyStopping:
parameters:
monitor: "val_loss"
patience: 5
delta: 0
verbose: true

data:
name: "CarDataset"
dataset_path: "./data/processed/DB_Marca"
test_size: 0.1
val_size: 0.1
transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "GaussianBlur"
parameters:
kernel_size: [5, 5]
sigma: [0.1, 2.0]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
eval_transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

paths:
model_path: "./outputs/models/"
log_path: "./logs/"
plot_path: "./outputs/figures/"
checkpoint_path: "./outputs/checkpoints/"
78 changes: 78 additions & 0 deletions config/m_random_horizontal_flip.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
trainer: "BasicTrainer"
random_seed: 43

model:
type: "efficientnet_b0"
parameters:
num_classes: 34
pretrained: true

training:
batch_size: 64
epochs:
initial: 200
fine_tuning: 200
loss_function:
type: "CrossEntropyLoss"
optimizer:
type: "SGD"
parameters:
lr: 0.05
learning_rates:
initial: 0.01
fine_tuning: 0.001
final_fine_tuning: 0.0001
freeze_until_layer: "classifier.1.weight"

metrics:
- type: "Accuracy"
- type: "Precision"
- type: "Recall"
- type: "F1Score"

callbacks:
CSVLogging:
parameters:
csv_path: "dinamically/set/by/date.csv"
Checkpoint:
parameters:
save_freq: 5
EarlyStopping:
parameters:
monitor: "val_loss"
patience: 5
delta: 0
verbose: true

data:
name: "CarDataset"
dataset_path: "./data/processed/DB_Marca"
test_size: 0.1
val_size: 0.1
transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "RandomHorizontalFlip"
parameters:
p: 0.5
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
eval_transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

paths:
model_path: "./outputs/models/"
log_path: "./logs/"
plot_path: "./outputs/figures/"
checkpoint_path: "./outputs/checkpoints/"
80 changes: 80 additions & 0 deletions config/m_random_resized_crop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
trainer: "BasicTrainer"
random_seed: 43

model:
type: "efficientnet_b0"
parameters:
num_classes: 34
pretrained: true

training:
batch_size: 64
epochs:
initial: 200
fine_tuning: 200
loss_function:
type: "CrossEntropyLoss"
optimizer:
type: "SGD"
parameters:
lr: 0.05
learning_rates:
initial: 0.01
fine_tuning: 0.001
final_fine_tuning: 0.0001
freeze_until_layer: "classifier.1.weight"

metrics:
- type: "Accuracy"
- type: "Precision"
- type: "Recall"
- type: "F1Score"

callbacks:
CSVLogging:
parameters:
csv_path: "dinamically/set/by/date.csv"
Checkpoint:
parameters:
save_freq: 5
EarlyStopping:
parameters:
monitor: "val_loss"
patience: 5
delta: 0
verbose: true

data:
name: "CarDataset"
dataset_path: "./data/processed/DB_Marca"
test_size: 0.1
val_size: 0.1
transforms:
- type: "Resize"
parameters:
size: [224, 224]
- type: "RandomResizedCrop"
parameters:
size: [224, 224]
scale: [0.8, 1.0]
ratio: [0.75, 1.33]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
eval_transforms:
- type: "Resize"
parameters:
size: [240, 240]
- type: "ToTensor"
- type: "Normalize"
parameters:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

paths:
model_path: "./outputs/models/"
log_path: "./logs/"
plot_path: "./outputs/figures/"
checkpoint_path: "./outputs/checkpoints/"
Loading

0 comments on commit 3e1d20b

Please sign in to comment.