This script trains a single linear (logistic regression) classifier on the flattened 64×64 grayscale Chinese MNIST images. It explores a small hyperparameter grid across batch size, optimizer, and learning rate, evaluates all saved checkpoints on the test set, then reports and visualizes the best performer.
Pipeline Steps
Dataset preparation / validation via preprocessing_utils.prepare_images.
Construction of train / validation / test DataLoaders (optionally with light augmentation on the training split) via preprocessing_utils.get_dataloaders.
Definition of a single-layer linear classifier (LogisticRegressionModel).
Training across the grid:
batch_size: [32, 256] (NOTE: The earlier 64 value was removed to reduce runtime / memory.)
optimizer: Adam and SGD (SGD uses momentum=0.9)
learning_rate: [0.01, 0.001, 0.0005] (updated; 0.005 no longer used)
epochs: 30 (with early stopping)
early stopping patience: 5 epochs (monitors validation accuracy)
Checkpoint saving: best validation accuracy per run →
Curve plotting: training / validation accuracy & loss → plots/log_reg/
Test evaluation of every checkpoint (accuracy, macro‑F1, confusion matrix) to find best model.
Confusion matrix plotting for the best checkpoint.
Simple per‑class qualitative inference (one random test image per class) using the best model.
Key Assumptions
Inputs passed to :class:LogisticRegressionModel are already flattened to shape (batch_size, input_dim). The module does not perform flattening internally.
input_dim is inferred dynamically from a sample batch after the initial DataLoader creation.
Utilities sourced from preprocessing_utils.py and models_utils.py (training loop, evaluation, plotting, prediction helper).
Returned values from :func:predict_image are raw logits (not softmax probabilities). When the script prints them it labels them as probabilities for convenience; apply torch.softmax(logits, dim=0) if true probabilities are required.
Run
python log_reg.py
Reproducibility / Notes
Random sampling (image previews, per-class inference) is not seeded; set a manual seed if deterministic behavior is needed.
Early stopping triggers when validation accuracy fails to improve for patience epochs; best checkpoint is preserved.
Code
import osimport reimport randomimport torchfrom torchinfo import summaryfrom preprocessing_utils import prepare_images, get_dataloaders, summarize_split, preview_random_images, show_batchfrom models_utils import train_model, test_model, plot_confusion_matrix, plot_training_process, predict_imageclass LogisticRegressionModel(torch.nn.Module):""" Baseline 0: Logistic Regression for Chinese Characters. A single linear layer mapping `input_dim -> num_classes` trained with cross-entropy. Note: This module does not apply any activation or flattening internally. Args: input_dim (int): Number of input features per sample (e.g., 64*64 for a 1x64x64 image if flattened). num_classes (int): Number of target classes. """def__init__(self, input_dim, num_classes):super().__init__()self.linear = torch.nn.Linear(input_dim, num_classes)def forward(self, x):""" Compute logits for a batch. Args: x (torch.Tensor): Input tensor of shape `(batch_size, input_dim)`. Must be 2D and already flattened. Returns: torch.Tensor: Logits of shape `(batch_size, num_classes)`. """returnself.linear(x)if__name__=="__main__":# Check PyTorch versionprint(torch.__version__)# Device setup device = torch.device("cuda"if torch.cuda.is_available() else"cpu")print(f"Using device: {device}")# Getting images ready# Prepare dataset root = prepare_images()print(f"Dataset ready at: {root}")# Summarize dataset summarize_split(str(root))# Preview random images preview_random_images(data_dir=str(root /"c_mnist"), n_images=9, grid_size=(3, 3))# Preprocessing# Get dataloaders dataloaders, datasets = get_dataloaders(data_dir="data", batch_size=64, image_size=(64, 64), augment=True) labels = datasets['train'].classesprint("DataLoaders ready.")print(f"Classes: {labels}") show_batch(datasets["train"], n=12, cols=4)# Hyperparameters sample_batch =next(iter(dataloaders["train"]))[0] INPUT_DIM = sample_batch.shape[1] if sample_batch.ndim ==2else sample_batch[0].numel() NUM_CLASSES =len(labels)# Batch sizes explored (kept small & large for gradient noise vs. stability comparison) BATCH_SIZE = [32, 256] EPOCHS =30 LEARNING_RATE = [0.01, 0.001, 0.0005] WEIGHT_DECAY =5e-4 MOMENTUM =0.9# For SGD PATIENCE =5# Model definition log_reg_model = LogisticRegressionModel(input_dim=INPUT_DIM, num_classes=NUM_CLASSES).to(device)# Loss and optimizer criterion = torch.nn.CrossEntropyLoss()# Model summaryprint(f"Logistic Regression summary (input_dim={INPUT_DIM}, num_classes={NUM_CLASSES})") summary(log_reg_model, input_size=(1, INPUT_DIM), col_names=("input_size", "output_size", "num_params"))# Training dataloaders_dict = {}for bs in BATCH_SIZE: dl, _ = get_dataloaders( data_dir="data", batch_size=bs, image_size=(64, 64), augment=True) dataloaders_dict[bs] = dlprint(f"DataLoaders for batch size {bs} ready.") total_acc_train_sgd = {} total_acc_validation_sgd = {} total_loss_train_sgd = {} total_loss_validation_sgd = {} total_acc_train_adam = {} total_acc_validation_adam = {} total_loss_train_adam = {} total_loss_validation_adam = {}for bs in BATCH_SIZE:print(f"\nTraining with batch size: {bs}") dataloaders = dataloaders_dict[bs] run_idx =1for lr in LEARNING_RATE:# Adam runprint(f" Run {run_idx}: Adam optimizer with lr={lr}") model_adam = LogisticRegressionModel(INPUT_DIM, NUM_CLASSES).to(device) adam_opt = torch.optim.Adam(model_adam.parameters(), lr=lr, weight_decay=WEIGHT_DECAY) ( acc_train_adam, loss_train_adam, acc_val_adam, loss_val_adam, ) = train_model( model_adam, dataloaders, adam_opt, criterion, epochs=EPOCHS, patience=PATIENCE, save_path=f"checkpoints/log_reg/model_{bs}_adam_{lr}.pth", ) total_acc_train_adam[(bs, lr)] = acc_train_adam total_loss_train_adam[(bs, lr)] = loss_train_adam total_acc_validation_adam[(bs, lr)] = acc_val_adam total_loss_validation_adam[(bs, lr)] = loss_val_adam# SGD runprint(f" Run {run_idx}: SGD optimizer with lr={lr}, momentum={MOMENTUM}") model_sgd = LogisticRegressionModel(INPUT_DIM, NUM_CLASSES).to(device) sgd_opt = torch.optim.SGD(model_sgd.parameters(), lr=lr, momentum=MOMENTUM, weight_decay=WEIGHT_DECAY) ( acc_train_sgd, loss_train_sgd, acc_val_sgd, loss_val_sgd, ) = train_model( model_sgd, dataloaders, sgd_opt, criterion, epochs=EPOCHS, patience=PATIENCE, save_path=f"checkpoints/log_reg/model_{bs}_sgd_{lr}.pth", ) total_acc_train_sgd[(bs, lr)] = acc_train_sgd total_loss_train_sgd[(bs, lr)] = loss_train_sgd total_acc_validation_sgd[(bs, lr)] = acc_val_sgd total_loss_validation_sgd[(bs, lr)] = loss_val_sgd run_idx +=1# Plotting training processfor bs in BATCH_SIZE:for lr in LEARNING_RATE:print(f"\nPlotting training process for batch size {bs} and learning rate {lr} (SGD)") plot_training_process( total_acc_train_sgd[(bs, lr)], total_loss_train_sgd[(bs, lr)], total_acc_validation_sgd[(bs, lr)], total_loss_validation_sgd[(bs, lr)],f"plots/log_reg/training_process_{bs}_{lr}_sgd.png", plot=False )print(f"\nPlotting training process for batch size {bs} and learning rate {lr} (Adam)") plot_training_process( total_acc_train_adam[(bs, lr)], total_loss_train_adam[(bs, lr)], total_acc_validation_adam[(bs, lr)], total_loss_validation_adam[(bs, lr)],f"plots/log_reg/training_process_{bs}_{lr}_adam.png", plot=False )# Testing MODELS_DIR ="checkpoints/log_reg" best = {"path": None,"acc": 0.0,"f1": 0.0,"cm": None }# Iterate over all .pth files in directoryif os.path.isdir(MODELS_DIR):for model_file in os.listdir(MODELS_DIR):ifnot model_file.endswith(".pth"):continue model_path = os.path.join(MODELS_DIR, model_file)print(f"\nTesting model: {model_path}")# Extract batch size from filename (model_32_adam_0.01.pth → 32) match = re.search(r"model_(\d+)_", model_file)ifnot match:print(f"Could not extract batch size from {model_file}, skipping...")continue batch_size =int(match.group(1))# Load model log_reg_model = LogisticRegressionModel(INPUT_DIM, NUM_CLASSES).to(device) log_reg_model.load_state_dict(torch.load(model_path, map_location=device)) log_reg_model.eval()# Evaluate with correct dataloader test_loader = dataloaders_dict.get(batch_size, dataloaders_dict[BATCH_SIZE[0]])["test"] test_acc, f1, cm = test_model(log_reg_model, test_loader, criterion)print(f"Accuracy: {test_acc:.4f} | F1: {f1:.4f}")# Update best modelif test_acc > best["acc"]: best.update({"path": model_path, "acc": test_acc, "f1": f1, "cm": cm})print(f"New best model: {model_path} (Acc: {test_acc:.4f}, F1: {f1:.4f})")else:print(f"Models directory not found: {MODELS_DIR}")# Plot training process and confusion matrix of the best modelif best["cm"] isnotNone:print(f"\nBest model: {best['path']} | Acc: {best['acc']:.4f} | F1: {best['f1']:.4f}") plot_confusion_matrix(best["cm"], datasets["train"].classes)# Extract batch size and learning rate from best model filename m = re.search(r"model_(\d+)_(adam|sgd)_([0-9.]+)\.pth", os.path.basename(best["path"]))if m: batch_size =int(m.group(1)) optimizer = m.group(2) learning_rate =float(m.group(3))print(f"Extracted batch size: {batch_size}, optimizer: {optimizer}, learning rate: {learning_rate}")if optimizer =="sgd": plot_training_process( total_acc_train_sgd[(batch_size, learning_rate)], total_loss_train_sgd[(batch_size, learning_rate)], total_acc_validation_sgd[(batch_size, learning_rate)], total_loss_validation_sgd[(batch_size, learning_rate)],f"plots/log_reg/best_model_training_process_{batch_size}_{learning_rate}_{optimizer}.png" )else: plot_training_process( total_acc_train_adam[(batch_size, learning_rate)], total_loss_train_adam[(batch_size, learning_rate)], total_acc_validation_adam[(batch_size, learning_rate)], total_loss_validation_adam[(batch_size, learning_rate)],f"plots/log_reg/best_model_training_process_{batch_size}_{learning_rate}_{optimizer}.png", plot=True )else:print("Could not extract parameters from best model filename. Skipping best-run plot.")# Inference on random images from test set# Collect one random image per class folder in data/test TEST_ROOT ="data/test" selected_images = []for cls insorted(os.listdir(TEST_ROOT)): cls_dir = os.path.join(TEST_ROOT, cls)ifnot os.path.isdir(cls_dir):continue imgs = [f for f in os.listdir(cls_dir) if f.lower().endswith((".jpg",))]ifnot imgs:continue selected = os.path.join(cls_dir, random.choice(imgs)) selected_images.append(selected)if best["path"]: log_reg_model = LogisticRegressionModel(INPUT_DIM, NUM_CLASSES).to(device) log_reg_model.load_state_dict(torch.load(best["path"], map_location=device)) log_reg_model.eval()for img_path in selected_images:print(f"Selected image for prediction: {img_path}") prediction, logits = predict_image( model=log_reg_model, image_path=img_path, class_names=datasets['train'].classes, device=device, )# NOTE: 'logits' are raw scores; apply torch.softmax(logits, dim=0) for probabilitiesprint(f"Predicted class: {prediction} | Logits: {logits}")else:print("No best model available; skipping inference.")
Logistic Regression summary (input_dim=4096, num_classes=15)
DataLoaders for batch size 32 ready.
DataLoaders for batch size 256 ready.
Training with batch size: 32
Run 1: Adam optimizer with lr=0.01
Epoch 01 | Train Loss: 2.1773 | Train Acc: 0.3397 | Val Loss: 1.9226 | Val Acc: 0.4207
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.01.pth
Saved new best checkpoint (epoch 1, val_acc=0.4207)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.0232 | Train Acc: 0.3930 | Val Loss: 1.8390 | Val Acc: 0.4560
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.01.pth
Saved new best checkpoint (epoch 2, val_acc=0.4560)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 1.9989 | Train Acc: 0.3996 | Val Loss: 1.8184 | Val Acc: 0.4567
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.01.pth
Saved new best checkpoint (epoch 3, val_acc=0.4567)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 1.9616 | Train Acc: 0.4042 | Val Loss: 1.7916 | Val Acc: 0.4440
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 1.9560 | Train Acc: 0.4039 | Val Loss: 1.7685 | Val Acc: 0.4653
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.01.pth
Saved new best checkpoint (epoch 5, val_acc=0.4653)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 1.9515 | Train Acc: 0.4036 | Val Loss: 1.7741 | Val Acc: 0.4647
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 1.9348 | Train Acc: 0.4094 | Val Loss: 1.7685 | Val Acc: 0.4553
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 1.9407 | Train Acc: 0.4054 | Val Loss: 1.7639 | Val Acc: 0.4627
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 1.9500 | Train Acc: 0.4017 | Val Loss: 1.7883 | Val Acc: 0.4580
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 1.9339 | Train Acc: 0.4062 | Val Loss: 1.7775 | Val Acc: 0.4593
------------------------------------------------------------------------------------------
Early stopping at epoch 10. Best val acc: 0.4653 (epoch 5)
Training finished. Best val acc: 0.4653 (epoch 5)
==========================================================================================
Run 1: SGD optimizer with lr=0.01, momentum=0.9
Epoch 01 | Train Loss: 2.5272 | Train Acc: 0.2175 | Val Loss: 2.3446 | Val Acc: 0.3520
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 1, val_acc=0.3520)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.3102 | Train Acc: 0.3578 | Val Loss: 2.1705 | Val Acc: 0.4273
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 2, val_acc=0.4273)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.1986 | Train Acc: 0.3892 | Val Loss: 2.0653 | Val Acc: 0.4413
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 3, val_acc=0.4413)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.1282 | Train Acc: 0.4003 | Val Loss: 1.9980 | Val Acc: 0.4607
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 4, val_acc=0.4607)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.0769 | Train Acc: 0.4143 | Val Loss: 1.9484 | Val Acc: 0.4707
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 5, val_acc=0.4707)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.0504 | Train Acc: 0.4182 | Val Loss: 1.9090 | Val Acc: 0.4620
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.0152 | Train Acc: 0.4253 | Val Loss: 1.8796 | Val Acc: 0.4720
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 7, val_acc=0.4720)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 1.9902 | Train Acc: 0.4296 | Val Loss: 1.8575 | Val Acc: 0.4760
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 8, val_acc=0.4760)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 1.9777 | Train Acc: 0.4313 | Val Loss: 1.8357 | Val Acc: 0.4900
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 9, val_acc=0.4900)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 1.9606 | Train Acc: 0.4376 | Val Loss: 1.8201 | Val Acc: 0.4900
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 1.9492 | Train Acc: 0.4380 | Val Loss: 1.8068 | Val Acc: 0.4860
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 1.9299 | Train Acc: 0.4432 | Val Loss: 1.7948 | Val Acc: 0.5007
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 12, val_acc=0.5007)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 1.9222 | Train Acc: 0.4432 | Val Loss: 1.7842 | Val Acc: 0.4973
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 1.9201 | Train Acc: 0.4480 | Val Loss: 1.7737 | Val Acc: 0.4967
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 1.9125 | Train Acc: 0.4496 | Val Loss: 1.7687 | Val Acc: 0.5073
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 15, val_acc=0.5073)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 1.8992 | Train Acc: 0.4528 | Val Loss: 1.7604 | Val Acc: 0.5040
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 1.9021 | Train Acc: 0.4534 | Val Loss: 1.7547 | Val Acc: 0.5040
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 1.8921 | Train Acc: 0.4528 | Val Loss: 1.7518 | Val Acc: 0.5013
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 1.8907 | Train Acc: 0.4518 | Val Loss: 1.7441 | Val Acc: 0.5087
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 19, val_acc=0.5087)
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 1.8896 | Train Acc: 0.4532 | Val Loss: 1.7449 | Val Acc: 0.5007
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 1.8822 | Train Acc: 0.4564 | Val Loss: 1.7368 | Val Acc: 0.5080
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 1.8760 | Train Acc: 0.4550 | Val Loss: 1.7365 | Val Acc: 0.5060
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 1.8767 | Train Acc: 0.4556 | Val Loss: 1.7318 | Val Acc: 0.5107
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 23, val_acc=0.5107)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 1.8673 | Train Acc: 0.4568 | Val Loss: 1.7286 | Val Acc: 0.5140
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 24, val_acc=0.5140)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 1.8616 | Train Acc: 0.4542 | Val Loss: 1.7254 | Val Acc: 0.5113
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 1.8725 | Train Acc: 0.4551 | Val Loss: 1.7228 | Val Acc: 0.5173
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 26, val_acc=0.5173)
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 1.8555 | Train Acc: 0.4622 | Val Loss: 1.7204 | Val Acc: 0.5167
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 1.8660 | Train Acc: 0.4620 | Val Loss: 1.7186 | Val Acc: 0.5173
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 1.8573 | Train Acc: 0.4591 | Val Loss: 1.7156 | Val Acc: 0.5187
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.01.pth
Saved new best checkpoint (epoch 29, val_acc=0.5187)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 1.8640 | Train Acc: 0.4562 | Val Loss: 1.7134 | Val Acc: 0.5147
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.5187 (epoch 29)
==========================================================================================
Run 2: Adam optimizer with lr=0.001
Epoch 01 | Train Loss: 2.4048 | Train Acc: 0.2659 | Val Loss: 2.1889 | Val Acc: 0.3980
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 1, val_acc=0.3980)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.1992 | Train Acc: 0.3732 | Val Loss: 2.0522 | Val Acc: 0.4380
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 2, val_acc=0.4380)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.1260 | Train Acc: 0.3931 | Val Loss: 1.9827 | Val Acc: 0.4487
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 3, val_acc=0.4487)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.0760 | Train Acc: 0.4107 | Val Loss: 1.9346 | Val Acc: 0.4707
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 4, val_acc=0.4707)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.0452 | Train Acc: 0.4203 | Val Loss: 1.9032 | Val Acc: 0.4713
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 5, val_acc=0.4713)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.0171 | Train Acc: 0.4291 | Val Loss: 1.8798 | Val Acc: 0.4867
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 6, val_acc=0.4867)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.0044 | Train Acc: 0.4358 | Val Loss: 1.8617 | Val Acc: 0.4827
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 1.9903 | Train Acc: 0.4329 | Val Loss: 1.8514 | Val Acc: 0.4880
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 8, val_acc=0.4880)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 1.9787 | Train Acc: 0.4485 | Val Loss: 1.8432 | Val Acc: 0.4873
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 1.9735 | Train Acc: 0.4412 | Val Loss: 1.8285 | Val Acc: 0.4967
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 10, val_acc=0.4967)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 1.9496 | Train Acc: 0.4511 | Val Loss: 1.8182 | Val Acc: 0.4893
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 1.9489 | Train Acc: 0.4491 | Val Loss: 1.8131 | Val Acc: 0.4960
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 1.9407 | Train Acc: 0.4485 | Val Loss: 1.7998 | Val Acc: 0.5033
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 13, val_acc=0.5033)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 1.9292 | Train Acc: 0.4502 | Val Loss: 1.7943 | Val Acc: 0.4960
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 1.9355 | Train Acc: 0.4483 | Val Loss: 1.7834 | Val Acc: 0.5100
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 15, val_acc=0.5100)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 1.9242 | Train Acc: 0.4540 | Val Loss: 1.7789 | Val Acc: 0.4993
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 1.9151 | Train Acc: 0.4520 | Val Loss: 1.7762 | Val Acc: 0.5140
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 17, val_acc=0.5140)
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 1.9027 | Train Acc: 0.4569 | Val Loss: 1.7679 | Val Acc: 0.4980
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 1.9105 | Train Acc: 0.4540 | Val Loss: 1.7621 | Val Acc: 0.5073
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 1.8924 | Train Acc: 0.4568 | Val Loss: 1.7510 | Val Acc: 0.5100
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 1.9004 | Train Acc: 0.4570 | Val Loss: 1.7562 | Val Acc: 0.5100
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 1.8921 | Train Acc: 0.4533 | Val Loss: 1.7475 | Val Acc: 0.5160
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.001.pth
Saved new best checkpoint (epoch 22, val_acc=0.5160)
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 1.8921 | Train Acc: 0.4596 | Val Loss: 1.7448 | Val Acc: 0.5093
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 1.8813 | Train Acc: 0.4617 | Val Loss: 1.7375 | Val Acc: 0.5100
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 1.8802 | Train Acc: 0.4612 | Val Loss: 1.7372 | Val Acc: 0.5033
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 1.8783 | Train Acc: 0.4560 | Val Loss: 1.7343 | Val Acc: 0.5107
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 1.8696 | Train Acc: 0.4602 | Val Loss: 1.7312 | Val Acc: 0.5047
------------------------------------------------------------------------------------------
Early stopping at epoch 27. Best val acc: 0.5160 (epoch 22)
Training finished. Best val acc: 0.5160 (epoch 22)
==========================================================================================
Run 2: SGD optimizer with lr=0.001, momentum=0.9
Epoch 01 | Train Loss: 2.6792 | Train Acc: 0.1050 | Val Loss: 2.6436 | Val Acc: 0.1233
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 1, val_acc=0.1233)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.6287 | Train Acc: 0.1340 | Val Loss: 2.5931 | Val Acc: 0.1573
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 2, val_acc=0.1573)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.5883 | Train Acc: 0.1650 | Val Loss: 2.5500 | Val Acc: 0.2033
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 3, val_acc=0.2033)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.5507 | Train Acc: 0.1986 | Val Loss: 2.5112 | Val Acc: 0.2573
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 4, val_acc=0.2573)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.5186 | Train Acc: 0.2429 | Val Loss: 2.4760 | Val Acc: 0.2987
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 5, val_acc=0.2987)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.4922 | Train Acc: 0.2682 | Val Loss: 2.4445 | Val Acc: 0.3293
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 6, val_acc=0.3293)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.4638 | Train Acc: 0.2864 | Val Loss: 2.4150 | Val Acc: 0.3540
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 7, val_acc=0.3540)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.4386 | Train Acc: 0.3091 | Val Loss: 2.3876 | Val Acc: 0.3667
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 8, val_acc=0.3667)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.4173 | Train Acc: 0.3241 | Val Loss: 2.3624 | Val Acc: 0.3760
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 9, val_acc=0.3760)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.3947 | Train Acc: 0.3311 | Val Loss: 2.3389 | Val Acc: 0.3860
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 10, val_acc=0.3860)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.3768 | Train Acc: 0.3444 | Val Loss: 2.3173 | Val Acc: 0.3927
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 11, val_acc=0.3927)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.3593 | Train Acc: 0.3511 | Val Loss: 2.2968 | Val Acc: 0.3960
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 12, val_acc=0.3960)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.3400 | Train Acc: 0.3535 | Val Loss: 2.2774 | Val Acc: 0.4020
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 13, val_acc=0.4020)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.3212 | Train Acc: 0.3676 | Val Loss: 2.2587 | Val Acc: 0.4073
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 14, val_acc=0.4073)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.3080 | Train Acc: 0.3659 | Val Loss: 2.2415 | Val Acc: 0.4127
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 15, val_acc=0.4127)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.2943 | Train Acc: 0.3743 | Val Loss: 2.2252 | Val Acc: 0.4200
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 16, val_acc=0.4200)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.2849 | Train Acc: 0.3695 | Val Loss: 2.2103 | Val Acc: 0.4200
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.2676 | Train Acc: 0.3812 | Val Loss: 2.1956 | Val Acc: 0.4253
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 18, val_acc=0.4253)
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.2532 | Train Acc: 0.3848 | Val Loss: 2.1817 | Val Acc: 0.4327
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 19, val_acc=0.4327)
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.2433 | Train Acc: 0.3842 | Val Loss: 2.1685 | Val Acc: 0.4367
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 20, val_acc=0.4367)
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.2395 | Train Acc: 0.3827 | Val Loss: 2.1563 | Val Acc: 0.4387
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 21, val_acc=0.4387)
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.2252 | Train Acc: 0.3848 | Val Loss: 2.1442 | Val Acc: 0.4373
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.2153 | Train Acc: 0.3857 | Val Loss: 2.1327 | Val Acc: 0.4400
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 23, val_acc=0.4400)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 2.2039 | Train Acc: 0.3892 | Val Loss: 2.1217 | Val Acc: 0.4407
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 24, val_acc=0.4407)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 2.1991 | Train Acc: 0.3903 | Val Loss: 2.1115 | Val Acc: 0.4420
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 25, val_acc=0.4420)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 2.1900 | Train Acc: 0.3970 | Val Loss: 2.1020 | Val Acc: 0.4393
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 2.1819 | Train Acc: 0.3975 | Val Loss: 2.0929 | Val Acc: 0.4447
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 27, val_acc=0.4447)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 2.1747 | Train Acc: 0.3990 | Val Loss: 2.0840 | Val Acc: 0.4473
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 28, val_acc=0.4473)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 2.1661 | Train Acc: 0.4034 | Val Loss: 2.0752 | Val Acc: 0.4500
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 29, val_acc=0.4500)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 2.1587 | Train Acc: 0.4015 | Val Loss: 2.0667 | Val Acc: 0.4507
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.001.pth
Saved new best checkpoint (epoch 30, val_acc=0.4507)
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.4507 (epoch 30)
==========================================================================================
Run 3: Adam optimizer with lr=0.0005
Epoch 01 | Train Loss: 2.5049 | Train Acc: 0.1963 | Val Loss: 2.3317 | Val Acc: 0.3387
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 1, val_acc=0.3387)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.3121 | Train Acc: 0.3287 | Val Loss: 2.1874 | Val Acc: 0.4027
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 2, val_acc=0.4027)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.2268 | Train Acc: 0.3699 | Val Loss: 2.1056 | Val Acc: 0.4280
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 3, val_acc=0.4280)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.1686 | Train Acc: 0.3868 | Val Loss: 2.0503 | Val Acc: 0.4400
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 4, val_acc=0.4400)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.1320 | Train Acc: 0.3969 | Val Loss: 2.0122 | Val Acc: 0.4480
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 5, val_acc=0.4480)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.1040 | Train Acc: 0.4042 | Val Loss: 1.9818 | Val Acc: 0.4607
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 6, val_acc=0.4607)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.0876 | Train Acc: 0.4092 | Val Loss: 1.9586 | Val Acc: 0.4687
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 7, val_acc=0.4687)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.0679 | Train Acc: 0.4198 | Val Loss: 1.9361 | Val Acc: 0.4813
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 8, val_acc=0.4813)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.0442 | Train Acc: 0.4182 | Val Loss: 1.9194 | Val Acc: 0.4833
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 9, val_acc=0.4833)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.0302 | Train Acc: 0.4332 | Val Loss: 1.9089 | Val Acc: 0.4800
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.0154 | Train Acc: 0.4335 | Val Loss: 1.8933 | Val Acc: 0.4833
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.0081 | Train Acc: 0.4377 | Val Loss: 1.8841 | Val Acc: 0.4880
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 12, val_acc=0.4880)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.0052 | Train Acc: 0.4383 | Val Loss: 1.8733 | Val Acc: 0.4927
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 13, val_acc=0.4927)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 1.9880 | Train Acc: 0.4399 | Val Loss: 1.8628 | Val Acc: 0.4967
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 14, val_acc=0.4967)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 1.9911 | Train Acc: 0.4451 | Val Loss: 1.8539 | Val Acc: 0.4967
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 1.9781 | Train Acc: 0.4412 | Val Loss: 1.8451 | Val Acc: 0.5007
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 16, val_acc=0.5007)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 1.9742 | Train Acc: 0.4427 | Val Loss: 1.8390 | Val Acc: 0.4953
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 1.9614 | Train Acc: 0.4489 | Val Loss: 1.8336 | Val Acc: 0.4960
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 1.9464 | Train Acc: 0.4529 | Val Loss: 1.8259 | Val Acc: 0.4993
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 1.9527 | Train Acc: 0.4566 | Val Loss: 1.8184 | Val Acc: 0.5040
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 20, val_acc=0.5040)
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 1.9553 | Train Acc: 0.4516 | Val Loss: 1.8121 | Val Acc: 0.4973
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 1.9433 | Train Acc: 0.4552 | Val Loss: 1.8058 | Val Acc: 0.5033
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 1.9443 | Train Acc: 0.4521 | Val Loss: 1.8020 | Val Acc: 0.5027
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 1.9484 | Train Acc: 0.4517 | Val Loss: 1.7977 | Val Acc: 0.5067
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 24, val_acc=0.5067)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 1.9365 | Train Acc: 0.4530 | Val Loss: 1.7934 | Val Acc: 0.5033
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 1.9220 | Train Acc: 0.4595 | Val Loss: 1.7873 | Val Acc: 0.4993
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 1.9297 | Train Acc: 0.4514 | Val Loss: 1.7838 | Val Acc: 0.5080
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 27, val_acc=0.5080)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 1.9234 | Train Acc: 0.4601 | Val Loss: 1.7801 | Val Acc: 0.5073
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 1.9191 | Train Acc: 0.4602 | Val Loss: 1.7770 | Val Acc: 0.5153
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_adam_0.0005.pth
Saved new best checkpoint (epoch 29, val_acc=0.5153)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 1.9190 | Train Acc: 0.4555 | Val Loss: 1.7737 | Val Acc: 0.5153
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.5153 (epoch 29)
==========================================================================================
Run 3: SGD optimizer with lr=0.0005, momentum=0.9
Epoch 01 | Train Loss: 2.6937 | Train Acc: 0.0902 | Val Loss: 2.6761 | Val Acc: 0.1107
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 1, val_acc=0.1107)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.6646 | Train Acc: 0.1137 | Val Loss: 2.6465 | Val Acc: 0.1127
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 2, val_acc=0.1127)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.6395 | Train Acc: 0.1212 | Val Loss: 2.6199 | Val Acc: 0.1280
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 3, val_acc=0.1280)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.6173 | Train Acc: 0.1427 | Val Loss: 2.5957 | Val Acc: 0.1520
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 4, val_acc=0.1520)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.5965 | Train Acc: 0.1559 | Val Loss: 2.5733 | Val Acc: 0.1680
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 5, val_acc=0.1680)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.5765 | Train Acc: 0.1763 | Val Loss: 2.5519 | Val Acc: 0.2013
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 6, val_acc=0.2013)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.5602 | Train Acc: 0.1938 | Val Loss: 2.5321 | Val Acc: 0.2247
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 7, val_acc=0.2247)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.5427 | Train Acc: 0.2118 | Val Loss: 2.5131 | Val Acc: 0.2507
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 8, val_acc=0.2507)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.5269 | Train Acc: 0.2282 | Val Loss: 2.4951 | Val Acc: 0.2713
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 9, val_acc=0.2713)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.5100 | Train Acc: 0.2456 | Val Loss: 2.4777 | Val Acc: 0.2927
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 10, val_acc=0.2927)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.4972 | Train Acc: 0.2609 | Val Loss: 2.4612 | Val Acc: 0.3100
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 11, val_acc=0.3100)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.4817 | Train Acc: 0.2759 | Val Loss: 2.4453 | Val Acc: 0.3233
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 12, val_acc=0.3233)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.4690 | Train Acc: 0.2857 | Val Loss: 2.4302 | Val Acc: 0.3413
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 13, val_acc=0.3413)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.4558 | Train Acc: 0.2991 | Val Loss: 2.4157 | Val Acc: 0.3493
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 14, val_acc=0.3493)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.4451 | Train Acc: 0.3030 | Val Loss: 2.4018 | Val Acc: 0.3593
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 15, val_acc=0.3593)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.4296 | Train Acc: 0.3157 | Val Loss: 2.3884 | Val Acc: 0.3620
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 16, val_acc=0.3620)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.4215 | Train Acc: 0.3217 | Val Loss: 2.3756 | Val Acc: 0.3707
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 17, val_acc=0.3707)
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.4109 | Train Acc: 0.3305 | Val Loss: 2.3633 | Val Acc: 0.3760
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 18, val_acc=0.3760)
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.3974 | Train Acc: 0.3309 | Val Loss: 2.3511 | Val Acc: 0.3793
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 19, val_acc=0.3793)
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.3903 | Train Acc: 0.3377 | Val Loss: 2.3397 | Val Acc: 0.3827
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 20, val_acc=0.3827)
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.3800 | Train Acc: 0.3381 | Val Loss: 2.3284 | Val Acc: 0.3853
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 21, val_acc=0.3853)
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.3702 | Train Acc: 0.3414 | Val Loss: 2.3176 | Val Acc: 0.3887
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 22, val_acc=0.3887)
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.3610 | Train Acc: 0.3498 | Val Loss: 2.3073 | Val Acc: 0.3940
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 23, val_acc=0.3940)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 2.3504 | Train Acc: 0.3558 | Val Loss: 2.2971 | Val Acc: 0.3980
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 24, val_acc=0.3980)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 2.3407 | Train Acc: 0.3623 | Val Loss: 2.2872 | Val Acc: 0.4000
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 25, val_acc=0.4000)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 2.3318 | Train Acc: 0.3620 | Val Loss: 2.2777 | Val Acc: 0.4047
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 26, val_acc=0.4047)
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 2.3240 | Train Acc: 0.3641 | Val Loss: 2.2685 | Val Acc: 0.4087
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 27, val_acc=0.4087)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 2.3146 | Train Acc: 0.3697 | Val Loss: 2.2595 | Val Acc: 0.4107
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 28, val_acc=0.4107)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 2.3127 | Train Acc: 0.3678 | Val Loss: 2.2509 | Val Acc: 0.4133
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 29, val_acc=0.4133)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 2.3060 | Train Acc: 0.3633 | Val Loss: 2.2425 | Val Acc: 0.4153
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_32_sgd_0.0005.pth
Saved new best checkpoint (epoch 30, val_acc=0.4153)
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.4153 (epoch 30)
==========================================================================================
Training with batch size: 256
Run 1: Adam optimizer with lr=0.01
Epoch 01 | Train Loss: 2.2681 | Train Acc: 0.3187 | Val Loss: 1.9879 | Val Acc: 0.4247
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 1, val_acc=0.4247)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.0789 | Train Acc: 0.4005 | Val Loss: 1.9196 | Val Acc: 0.4560
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 2, val_acc=0.4560)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.0341 | Train Acc: 0.4163 | Val Loss: 1.8913 | Val Acc: 0.4640
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 3, val_acc=0.4640)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 1.9989 | Train Acc: 0.4202 | Val Loss: 1.8525 | Val Acc: 0.4773
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 4, val_acc=0.4773)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 1.9842 | Train Acc: 0.4255 | Val Loss: 1.8350 | Val Acc: 0.4753
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 1.9710 | Train Acc: 0.4235 | Val Loss: 1.8207 | Val Acc: 0.4813
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 6, val_acc=0.4813)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 1.9403 | Train Acc: 0.4385 | Val Loss: 1.8044 | Val Acc: 0.4820
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 7, val_acc=0.4820)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 1.9279 | Train Acc: 0.4294 | Val Loss: 1.7950 | Val Acc: 0.4907
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 8, val_acc=0.4907)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 1.9252 | Train Acc: 0.4341 | Val Loss: 1.7810 | Val Acc: 0.4980
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 9, val_acc=0.4980)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 1.9172 | Train Acc: 0.4397 | Val Loss: 1.7756 | Val Acc: 0.4733
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 1.9116 | Train Acc: 0.4411 | Val Loss: 1.7551 | Val Acc: 0.4940
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 1.9069 | Train Acc: 0.4392 | Val Loss: 1.7615 | Val Acc: 0.4753
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 1.8987 | Train Acc: 0.4418 | Val Loss: 1.7431 | Val Acc: 0.5013
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 13, val_acc=0.5013)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 1.8982 | Train Acc: 0.4385 | Val Loss: 1.7316 | Val Acc: 0.5040
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 14, val_acc=0.5040)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 1.8919 | Train Acc: 0.4432 | Val Loss: 1.7348 | Val Acc: 0.5013
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 1.8739 | Train Acc: 0.4343 | Val Loss: 1.7364 | Val Acc: 0.4793
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 1.8850 | Train Acc: 0.4453 | Val Loss: 1.7300 | Val Acc: 0.4913
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 1.8806 | Train Acc: 0.4423 | Val Loss: 1.7253 | Val Acc: 0.5053
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.01.pth
Saved new best checkpoint (epoch 18, val_acc=0.5053)
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 1.8783 | Train Acc: 0.4491 | Val Loss: 1.7245 | Val Acc: 0.4993
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 1.8791 | Train Acc: 0.4447 | Val Loss: 1.7266 | Val Acc: 0.5007
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 1.8692 | Train Acc: 0.4462 | Val Loss: 1.7246 | Val Acc: 0.4833
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 1.8742 | Train Acc: 0.4392 | Val Loss: 1.7312 | Val Acc: 0.4920
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 1.8728 | Train Acc: 0.4401 | Val Loss: 1.7193 | Val Acc: 0.4987
------------------------------------------------------------------------------------------
Early stopping at epoch 23. Best val acc: 0.5053 (epoch 18)
Training finished. Best val acc: 0.5053 (epoch 18)
==========================================================================================
Run 1: SGD optimizer with lr=0.01, momentum=0.9
Epoch 01 | Train Loss: 2.6820 | Train Acc: 0.1064 | Val Loss: 2.6405 | Val Acc: 0.1320
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 1, val_acc=0.1320)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.6207 | Train Acc: 0.1414 | Val Loss: 2.5782 | Val Acc: 0.1713
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 2, val_acc=0.1713)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.5704 | Train Acc: 0.1793 | Val Loss: 2.5260 | Val Acc: 0.2187
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 3, val_acc=0.2187)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.5295 | Train Acc: 0.2252 | Val Loss: 2.4804 | Val Acc: 0.2880
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 4, val_acc=0.2880)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.4899 | Train Acc: 0.2641 | Val Loss: 2.4396 | Val Acc: 0.3353
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 5, val_acc=0.3353)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.4563 | Train Acc: 0.3006 | Val Loss: 2.4034 | Val Acc: 0.3627
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 6, val_acc=0.3627)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.4273 | Train Acc: 0.3172 | Val Loss: 2.3705 | Val Acc: 0.3767
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 7, val_acc=0.3767)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.4013 | Train Acc: 0.3361 | Val Loss: 2.3404 | Val Acc: 0.3880
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 8, val_acc=0.3880)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.3757 | Train Acc: 0.3407 | Val Loss: 2.3129 | Val Acc: 0.3960
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 9, val_acc=0.3960)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.3510 | Train Acc: 0.3528 | Val Loss: 2.2873 | Val Acc: 0.4093
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 10, val_acc=0.4093)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.3320 | Train Acc: 0.3592 | Val Loss: 2.2638 | Val Acc: 0.4113
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 11, val_acc=0.4113)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.3134 | Train Acc: 0.3698 | Val Loss: 2.2420 | Val Acc: 0.4187
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 12, val_acc=0.4187)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.2950 | Train Acc: 0.3734 | Val Loss: 2.2221 | Val Acc: 0.4220
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 13, val_acc=0.4220)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.2764 | Train Acc: 0.3793 | Val Loss: 2.2030 | Val Acc: 0.4227
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 14, val_acc=0.4227)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.2603 | Train Acc: 0.3840 | Val Loss: 2.1854 | Val Acc: 0.4300
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 15, val_acc=0.4300)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.2520 | Train Acc: 0.3794 | Val Loss: 2.1689 | Val Acc: 0.4367
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 16, val_acc=0.4367)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.2357 | Train Acc: 0.3849 | Val Loss: 2.1531 | Val Acc: 0.4387
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 17, val_acc=0.4387)
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.2224 | Train Acc: 0.3856 | Val Loss: 2.1387 | Val Acc: 0.4380
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.2131 | Train Acc: 0.3868 | Val Loss: 2.1251 | Val Acc: 0.4373
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.1980 | Train Acc: 0.3896 | Val Loss: 2.1119 | Val Acc: 0.4340
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.1892 | Train Acc: 0.3956 | Val Loss: 2.0995 | Val Acc: 0.4393
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 21, val_acc=0.4393)
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.1815 | Train Acc: 0.3923 | Val Loss: 2.0880 | Val Acc: 0.4393
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.1692 | Train Acc: 0.3975 | Val Loss: 2.0771 | Val Acc: 0.4433
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 23, val_acc=0.4433)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 2.1627 | Train Acc: 0.3958 | Val Loss: 2.0669 | Val Acc: 0.4433
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 2.1513 | Train Acc: 0.4017 | Val Loss: 2.0572 | Val Acc: 0.4447
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 25, val_acc=0.4447)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 2.1445 | Train Acc: 0.4044 | Val Loss: 2.0473 | Val Acc: 0.4447
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 2.1360 | Train Acc: 0.3981 | Val Loss: 2.0378 | Val Acc: 0.4480
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 27, val_acc=0.4480)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 2.1292 | Train Acc: 0.4087 | Val Loss: 2.0289 | Val Acc: 0.4493
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 28, val_acc=0.4493)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 2.1255 | Train Acc: 0.4022 | Val Loss: 2.0206 | Val Acc: 0.4527
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 29, val_acc=0.4527)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 2.1128 | Train Acc: 0.4150 | Val Loss: 2.0123 | Val Acc: 0.4553
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.01.pth
Saved new best checkpoint (epoch 30, val_acc=0.4553)
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.4553 (epoch 30)
==========================================================================================
Run 2: Adam optimizer with lr=0.001
Epoch 01 | Train Loss: 2.5762 | Train Acc: 0.1659 | Val Loss: 2.4468 | Val Acc: 0.2487
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 1, val_acc=0.2487)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.4135 | Train Acc: 0.2554 | Val Loss: 2.3077 | Val Acc: 0.3360
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 2, val_acc=0.3360)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.3238 | Train Acc: 0.3225 | Val Loss: 2.2194 | Val Acc: 0.3820
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 3, val_acc=0.3820)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.2618 | Train Acc: 0.3532 | Val Loss: 2.1571 | Val Acc: 0.4093
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 4, val_acc=0.4093)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.2182 | Train Acc: 0.3693 | Val Loss: 2.1089 | Val Acc: 0.4213
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 5, val_acc=0.4213)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.1758 | Train Acc: 0.3884 | Val Loss: 2.0696 | Val Acc: 0.4380
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 6, val_acc=0.4380)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.1551 | Train Acc: 0.3948 | Val Loss: 2.0404 | Val Acc: 0.4453
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 7, val_acc=0.4453)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.1372 | Train Acc: 0.3998 | Val Loss: 2.0185 | Val Acc: 0.4607
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 8, val_acc=0.4607)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.1164 | Train Acc: 0.4042 | Val Loss: 1.9988 | Val Acc: 0.4587
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.1021 | Train Acc: 0.4103 | Val Loss: 1.9826 | Val Acc: 0.4600
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.0832 | Train Acc: 0.4156 | Val Loss: 1.9667 | Val Acc: 0.4687
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 11, val_acc=0.4687)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.0693 | Train Acc: 0.4232 | Val Loss: 1.9543 | Val Acc: 0.4680
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.0707 | Train Acc: 0.4184 | Val Loss: 1.9420 | Val Acc: 0.4707
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 13, val_acc=0.4707)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.0542 | Train Acc: 0.4240 | Val Loss: 1.9315 | Val Acc: 0.4653
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.0502 | Train Acc: 0.4280 | Val Loss: 1.9226 | Val Acc: 0.4687
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.0479 | Train Acc: 0.4253 | Val Loss: 1.9137 | Val Acc: 0.4767
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 16, val_acc=0.4767)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.0290 | Train Acc: 0.4403 | Val Loss: 1.9065 | Val Acc: 0.4767
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.0309 | Train Acc: 0.4294 | Val Loss: 1.8993 | Val Acc: 0.4747
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.0257 | Train Acc: 0.4322 | Val Loss: 1.8943 | Val Acc: 0.4767
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.0247 | Train Acc: 0.4319 | Val Loss: 1.8900 | Val Acc: 0.4800
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 20, val_acc=0.4800)
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.0149 | Train Acc: 0.4392 | Val Loss: 1.8848 | Val Acc: 0.4793
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.0109 | Train Acc: 0.4400 | Val Loss: 1.8799 | Val Acc: 0.4800
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.0055 | Train Acc: 0.4350 | Val Loss: 1.8756 | Val Acc: 0.4833
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 23, val_acc=0.4833)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 1.9959 | Train Acc: 0.4397 | Val Loss: 1.8703 | Val Acc: 0.4833
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 1.9929 | Train Acc: 0.4455 | Val Loss: 1.8656 | Val Acc: 0.4880
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 25, val_acc=0.4880)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 1.9911 | Train Acc: 0.4437 | Val Loss: 1.8605 | Val Acc: 0.4853
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 1.9876 | Train Acc: 0.4459 | Val Loss: 1.8545 | Val Acc: 0.4913
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 27, val_acc=0.4913)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 1.9822 | Train Acc: 0.4432 | Val Loss: 1.8514 | Val Acc: 0.4947
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 28, val_acc=0.4947)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 1.9734 | Train Acc: 0.4494 | Val Loss: 1.8482 | Val Acc: 0.4960
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.001.pth
Saved new best checkpoint (epoch 29, val_acc=0.4960)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 1.9781 | Train Acc: 0.4429 | Val Loss: 1.8461 | Val Acc: 0.4940
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.4960 (epoch 29)
==========================================================================================
Run 2: SGD optimizer with lr=0.001, momentum=0.9
Epoch 01 | Train Loss: 2.7036 | Train Acc: 0.0912 | Val Loss: 2.6991 | Val Acc: 0.0980
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 1, val_acc=0.0980)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.6957 | Train Acc: 0.1103 | Val Loss: 2.6900 | Val Acc: 0.1113
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 2, val_acc=0.1113)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.6873 | Train Acc: 0.1207 | Val Loss: 2.6814 | Val Acc: 0.1167
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 3, val_acc=0.1167)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.6803 | Train Acc: 0.1197 | Val Loss: 2.6731 | Val Acc: 0.1133
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.6729 | Train Acc: 0.1197 | Val Loss: 2.6652 | Val Acc: 0.1140
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.6664 | Train Acc: 0.1189 | Val Loss: 2.6577 | Val Acc: 0.1153
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.6598 | Train Acc: 0.1205 | Val Loss: 2.6504 | Val Acc: 0.1187
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 7, val_acc=0.1187)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.6538 | Train Acc: 0.1194 | Val Loss: 2.6432 | Val Acc: 0.1207
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 8, val_acc=0.1207)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.6463 | Train Acc: 0.1245 | Val Loss: 2.6363 | Val Acc: 0.1253
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 9, val_acc=0.1253)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.6410 | Train Acc: 0.1287 | Val Loss: 2.6296 | Val Acc: 0.1300
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 10, val_acc=0.1300)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.6347 | Train Acc: 0.1291 | Val Loss: 2.6230 | Val Acc: 0.1340
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 11, val_acc=0.1340)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.6295 | Train Acc: 0.1334 | Val Loss: 2.6167 | Val Acc: 0.1393
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 12, val_acc=0.1393)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.6236 | Train Acc: 0.1363 | Val Loss: 2.6104 | Val Acc: 0.1420
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 13, val_acc=0.1420)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.6177 | Train Acc: 0.1382 | Val Loss: 2.6042 | Val Acc: 0.1440
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 14, val_acc=0.1440)
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.6127 | Train Acc: 0.1461 | Val Loss: 2.5983 | Val Acc: 0.1487
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 15, val_acc=0.1487)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.6073 | Train Acc: 0.1487 | Val Loss: 2.5924 | Val Acc: 0.1513
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 16, val_acc=0.1513)
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.6019 | Train Acc: 0.1542 | Val Loss: 2.5867 | Val Acc: 0.1587
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 17, val_acc=0.1587)
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.5969 | Train Acc: 0.1575 | Val Loss: 2.5809 | Val Acc: 0.1627
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 18, val_acc=0.1627)
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.5922 | Train Acc: 0.1628 | Val Loss: 2.5754 | Val Acc: 0.1707
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 19, val_acc=0.1707)
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.5873 | Train Acc: 0.1658 | Val Loss: 2.5699 | Val Acc: 0.1767
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 20, val_acc=0.1767)
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.5832 | Train Acc: 0.1687 | Val Loss: 2.5645 | Val Acc: 0.1800
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 21, val_acc=0.1800)
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.5774 | Train Acc: 0.1757 | Val Loss: 2.5592 | Val Acc: 0.1847
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 22, val_acc=0.1847)
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.5744 | Train Acc: 0.1745 | Val Loss: 2.5540 | Val Acc: 0.1913
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 23, val_acc=0.1913)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 2.5688 | Train Acc: 0.1821 | Val Loss: 2.5489 | Val Acc: 0.1947
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 24, val_acc=0.1947)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 2.5651 | Train Acc: 0.1888 | Val Loss: 2.5438 | Val Acc: 0.2007
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 25, val_acc=0.2007)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 2.5604 | Train Acc: 0.1928 | Val Loss: 2.5388 | Val Acc: 0.2073
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 26, val_acc=0.2073)
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 2.5554 | Train Acc: 0.1982 | Val Loss: 2.5339 | Val Acc: 0.2160
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 27, val_acc=0.2160)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 2.5500 | Train Acc: 0.2098 | Val Loss: 2.5290 | Val Acc: 0.2240
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 28, val_acc=0.2240)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 2.5479 | Train Acc: 0.2072 | Val Loss: 2.5242 | Val Acc: 0.2280
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 29, val_acc=0.2280)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 2.5422 | Train Acc: 0.2107 | Val Loss: 2.5194 | Val Acc: 0.2367
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.001.pth
Saved new best checkpoint (epoch 30, val_acc=0.2367)
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.2367 (epoch 30)
==========================================================================================
Run 3: Adam optimizer with lr=0.0005
Epoch 01 | Train Loss: 2.6345 | Train Acc: 0.1226 | Val Loss: 2.5519 | Val Acc: 0.1933
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 1, val_acc=0.1933)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.5234 | Train Acc: 0.1962 | Val Loss: 2.4528 | Val Acc: 0.2573
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 2, val_acc=0.2573)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.4473 | Train Acc: 0.2469 | Val Loss: 2.3763 | Val Acc: 0.2987
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 3, val_acc=0.2987)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.3911 | Train Acc: 0.2785 | Val Loss: 2.3156 | Val Acc: 0.3400
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 4, val_acc=0.3400)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.3462 | Train Acc: 0.3068 | Val Loss: 2.2665 | Val Acc: 0.3673
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 5, val_acc=0.3673)
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.3085 | Train Acc: 0.3335 | Val Loss: 2.2258 | Val Acc: 0.3793
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 6, val_acc=0.3793)
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.2759 | Train Acc: 0.3443 | Val Loss: 2.1907 | Val Acc: 0.4007
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 7, val_acc=0.4007)
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.2491 | Train Acc: 0.3587 | Val Loss: 2.1610 | Val Acc: 0.4100
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 8, val_acc=0.4100)
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.2281 | Train Acc: 0.3683 | Val Loss: 2.1353 | Val Acc: 0.4173
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 9, val_acc=0.4173)
------------------------------------------------------------------------------------------
Epoch 10 | Train Loss: 2.2112 | Train Acc: 0.3761 | Val Loss: 2.1137 | Val Acc: 0.4193
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 10, val_acc=0.4193)
------------------------------------------------------------------------------------------
Epoch 11 | Train Loss: 2.1841 | Train Acc: 0.3839 | Val Loss: 2.0932 | Val Acc: 0.4360
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 11, val_acc=0.4360)
------------------------------------------------------------------------------------------
Epoch 12 | Train Loss: 2.1754 | Train Acc: 0.3894 | Val Loss: 2.0757 | Val Acc: 0.4393
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 12, val_acc=0.4393)
------------------------------------------------------------------------------------------
Epoch 13 | Train Loss: 2.1657 | Train Acc: 0.3932 | Val Loss: 2.0595 | Val Acc: 0.4500
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 13, val_acc=0.4500)
------------------------------------------------------------------------------------------
Epoch 14 | Train Loss: 2.1531 | Train Acc: 0.3933 | Val Loss: 2.0455 | Val Acc: 0.4453
------------------------------------------------------------------------------------------
Epoch 15 | Train Loss: 2.1432 | Train Acc: 0.3998 | Val Loss: 2.0331 | Val Acc: 0.4573
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 15, val_acc=0.4573)
------------------------------------------------------------------------------------------
Epoch 16 | Train Loss: 2.1238 | Train Acc: 0.4053 | Val Loss: 2.0217 | Val Acc: 0.4567
------------------------------------------------------------------------------------------
Epoch 17 | Train Loss: 2.1236 | Train Acc: 0.4046 | Val Loss: 2.0104 | Val Acc: 0.4547
------------------------------------------------------------------------------------------
Epoch 18 | Train Loss: 2.1134 | Train Acc: 0.4044 | Val Loss: 2.0012 | Val Acc: 0.4580
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 18, val_acc=0.4580)
------------------------------------------------------------------------------------------
Epoch 19 | Train Loss: 2.1084 | Train Acc: 0.4078 | Val Loss: 1.9925 | Val Acc: 0.4620
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 19, val_acc=0.4620)
------------------------------------------------------------------------------------------
Epoch 20 | Train Loss: 2.1018 | Train Acc: 0.4094 | Val Loss: 1.9858 | Val Acc: 0.4620
------------------------------------------------------------------------------------------
Epoch 21 | Train Loss: 2.0918 | Train Acc: 0.4153 | Val Loss: 1.9779 | Val Acc: 0.4653
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 21, val_acc=0.4653)
------------------------------------------------------------------------------------------
Epoch 22 | Train Loss: 2.0759 | Train Acc: 0.4208 | Val Loss: 1.9699 | Val Acc: 0.4667
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 22, val_acc=0.4667)
------------------------------------------------------------------------------------------
Epoch 23 | Train Loss: 2.0801 | Train Acc: 0.4178 | Val Loss: 1.9628 | Val Acc: 0.4693
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 23, val_acc=0.4693)
------------------------------------------------------------------------------------------
Epoch 24 | Train Loss: 2.0739 | Train Acc: 0.4158 | Val Loss: 1.9566 | Val Acc: 0.4700
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 24, val_acc=0.4700)
------------------------------------------------------------------------------------------
Epoch 25 | Train Loss: 2.0654 | Train Acc: 0.4276 | Val Loss: 1.9506 | Val Acc: 0.4713
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 25, val_acc=0.4713)
------------------------------------------------------------------------------------------
Epoch 26 | Train Loss: 2.0615 | Train Acc: 0.4250 | Val Loss: 1.9446 | Val Acc: 0.4733
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 26, val_acc=0.4733)
------------------------------------------------------------------------------------------
Epoch 27 | Train Loss: 2.0597 | Train Acc: 0.4262 | Val Loss: 1.9398 | Val Acc: 0.4740
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 27, val_acc=0.4740)
------------------------------------------------------------------------------------------
Epoch 28 | Train Loss: 2.0610 | Train Acc: 0.4237 | Val Loss: 1.9349 | Val Acc: 0.4747
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 28, val_acc=0.4747)
------------------------------------------------------------------------------------------
Epoch 29 | Train Loss: 2.0506 | Train Acc: 0.4263 | Val Loss: 1.9299 | Val Acc: 0.4760
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 29, val_acc=0.4760)
------------------------------------------------------------------------------------------
Epoch 30 | Train Loss: 2.0538 | Train Acc: 0.4220 | Val Loss: 1.9251 | Val Acc: 0.4813
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_adam_0.0005.pth
Saved new best checkpoint (epoch 30, val_acc=0.4813)
------------------------------------------------------------------------------------------
Training finished. Best val acc: 0.4813 (epoch 30)
==========================================================================================
Run 3: SGD optimizer with lr=0.0005, momentum=0.9
Epoch 01 | Train Loss: 2.7045 | Train Acc: 0.0857 | Val Loss: 2.7024 | Val Acc: 0.0987
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.0005.pth
Saved new best checkpoint (epoch 1, val_acc=0.0987)
------------------------------------------------------------------------------------------
Epoch 02 | Train Loss: 2.7005 | Train Acc: 0.0974 | Val Loss: 2.6977 | Val Acc: 0.1060
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.0005.pth
Saved new best checkpoint (epoch 2, val_acc=0.1060)
------------------------------------------------------------------------------------------
Epoch 03 | Train Loss: 2.6966 | Train Acc: 0.1057 | Val Loss: 2.6931 | Val Acc: 0.1213
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.0005.pth
Saved new best checkpoint (epoch 3, val_acc=0.1213)
------------------------------------------------------------------------------------------
Epoch 04 | Train Loss: 2.6924 | Train Acc: 0.1111 | Val Loss: 2.6887 | Val Acc: 0.1227
------------------------------------------------------------------------------------------
Model saved to checkpoints\log_reg\model_256_sgd_0.0005.pth
Saved new best checkpoint (epoch 4, val_acc=0.1227)
------------------------------------------------------------------------------------------
Epoch 05 | Train Loss: 2.6882 | Train Acc: 0.1172 | Val Loss: 2.6843 | Val Acc: 0.1220
------------------------------------------------------------------------------------------
Epoch 06 | Train Loss: 2.6849 | Train Acc: 0.1167 | Val Loss: 2.6801 | Val Acc: 0.1200
------------------------------------------------------------------------------------------
Epoch 07 | Train Loss: 2.6813 | Train Acc: 0.1172 | Val Loss: 2.6760 | Val Acc: 0.1147
------------------------------------------------------------------------------------------
Epoch 08 | Train Loss: 2.6774 | Train Acc: 0.1161 | Val Loss: 2.6720 | Val Acc: 0.1167
------------------------------------------------------------------------------------------
Epoch 09 | Train Loss: 2.6740 | Train Acc: 0.1140 | Val Loss: 2.6679 | Val Acc: 0.1160
------------------------------------------------------------------------------------------
Early stopping at epoch 9. Best val acc: 0.1227 (epoch 4)
Training finished. Best val acc: 0.1227 (epoch 4)
==========================================================================================
Plotting training process for batch size 32 and learning rate 0.01 (SGD)
Training process plot saved to plots/log_reg/training_process_32_0.01_sgd.png
Plotting training process for batch size 32 and learning rate 0.01 (Adam)
Training process plot saved to plots/log_reg/training_process_32_0.01_adam.png
Plotting training process for batch size 32 and learning rate 0.001 (SGD)
Training process plot saved to plots/log_reg/training_process_32_0.001_sgd.png
Plotting training process for batch size 32 and learning rate 0.001 (Adam)
Training process plot saved to plots/log_reg/training_process_32_0.001_adam.png
Plotting training process for batch size 32 and learning rate 0.0005 (SGD)
Training process plot saved to plots/log_reg/training_process_32_0.0005_sgd.png
Plotting training process for batch size 32 and learning rate 0.0005 (Adam)
Training process plot saved to plots/log_reg/training_process_32_0.0005_adam.png
Plotting training process for batch size 256 and learning rate 0.01 (SGD)
Training process plot saved to plots/log_reg/training_process_256_0.01_sgd.png
Plotting training process for batch size 256 and learning rate 0.01 (Adam)
Training process plot saved to plots/log_reg/training_process_256_0.01_adam.png
Plotting training process for batch size 256 and learning rate 0.001 (SGD)
Training process plot saved to plots/log_reg/training_process_256_0.001_sgd.png
Plotting training process for batch size 256 and learning rate 0.001 (Adam)
Training process plot saved to plots/log_reg/training_process_256_0.001_adam.png
Plotting training process for batch size 256 and learning rate 0.0005 (SGD)
Training process plot saved to plots/log_reg/training_process_256_0.0005_sgd.png
Plotting training process for batch size 256 and learning rate 0.0005 (Adam)
Training process plot saved to plots/log_reg/training_process_256_0.0005_adam.png
Testing model: checkpoints/log_reg\model_256_adam_0.0005.pth
Test Loss: 1.9606 | Test Accuracy: 0.4873 | Macro F1: 0.4786
Accuracy: 0.4873 | F1: 0.4786
New best model: checkpoints/log_reg\model_256_adam_0.0005.pth (Acc: 0.4873, F1: 0.4786)
Testing model: checkpoints/log_reg\model_256_adam_0.001.pth
Test Loss: 1.8863 | Test Accuracy: 0.5080 | Macro F1: 0.5001
Accuracy: 0.5080 | F1: 0.5001
New best model: checkpoints/log_reg\model_256_adam_0.001.pth (Acc: 0.5080, F1: 0.5001)
Testing model: checkpoints/log_reg\model_256_adam_0.005.pth
Test Loss: 1.8249 | Test Accuracy: 0.5040 | Macro F1: 0.4963
Accuracy: 0.5040 | F1: 0.4963
Testing model: checkpoints/log_reg\model_256_adam_0.01.pth
Test Loss: 1.7951 | Test Accuracy: 0.4900 | Macro F1: 0.4846
Accuracy: 0.4900 | F1: 0.4846
Testing model: checkpoints/log_reg\model_256_sgd_0.0005.pth
Test Loss: 2.6890 | Test Accuracy: 0.1227 | Macro F1: 0.0783
Accuracy: 0.1227 | F1: 0.0783
Testing model: checkpoints/log_reg\model_256_sgd_0.001.pth
Test Loss: 2.5271 | Test Accuracy: 0.2327 | Macro F1: 0.1980
Accuracy: 0.2327 | F1: 0.1980
Testing model: checkpoints/log_reg\model_256_sgd_0.005.pth
Test Loss: 2.2078 | Test Accuracy: 0.4267 | Macro F1: 0.4062
Accuracy: 0.4267 | F1: 0.4062
Testing model: checkpoints/log_reg\model_256_sgd_0.01.pth
Test Loss: 2.0467 | Test Accuracy: 0.4547 | Macro F1: 0.4382
Accuracy: 0.4547 | F1: 0.4382
Testing model: checkpoints/log_reg\model_32_adam_0.0005.pth
Test Loss: 1.8274 | Test Accuracy: 0.5160 | Macro F1: 0.5070
Accuracy: 0.5160 | F1: 0.5070
New best model: checkpoints/log_reg\model_32_adam_0.0005.pth (Acc: 0.5160, F1: 0.5070)
Testing model: checkpoints/log_reg\model_32_adam_0.001.pth
Test Loss: 1.7961 | Test Accuracy: 0.5080 | Macro F1: 0.4980
Accuracy: 0.5080 | F1: 0.4980
Testing model: checkpoints/log_reg\model_32_adam_0.005.pth
Test Loss: 1.8015 | Test Accuracy: 0.4740 | Macro F1: 0.4634
Accuracy: 0.4740 | F1: 0.4634
Testing model: checkpoints/log_reg\model_32_adam_0.01.pth
Test Loss: 1.8333 | Test Accuracy: 0.4567 | Macro F1: 0.4494
Accuracy: 0.4567 | F1: 0.4494
Testing model: checkpoints/log_reg\model_32_sgd_0.0005.pth
Test Loss: 2.2613 | Test Accuracy: 0.4073 | Macro F1: 0.3823
Accuracy: 0.4073 | F1: 0.3823
Testing model: checkpoints/log_reg\model_32_sgd_0.001.pth
Test Loss: 2.0974 | Test Accuracy: 0.4500 | Macro F1: 0.4332
Accuracy: 0.4500 | F1: 0.4332
Testing model: checkpoints/log_reg\model_32_sgd_0.005.pth
Test Loss: 1.8353 | Test Accuracy: 0.5080 | Macro F1: 0.4992
Accuracy: 0.5080 | F1: 0.4992
Testing model: checkpoints/log_reg\model_32_sgd_0.01.pth
Test Loss: 1.7729 | Test Accuracy: 0.5127 | Macro F1: 0.5031
Accuracy: 0.5127 | F1: 0.5031
Testing model: checkpoints/log_reg\model_64_adam_0.0005.pth
Test Loss: 1.8634 | Test Accuracy: 0.5093 | Macro F1: 0.4999
Accuracy: 0.5093 | F1: 0.4999
Testing model: checkpoints/log_reg\model_64_adam_0.005.pth
Test Loss: 1.7769 | Test Accuracy: 0.4953 | Macro F1: 0.4877
Accuracy: 0.4953 | F1: 0.4877
Testing model: checkpoints/log_reg\model_64_adam_0.01.pth
Test Loss: 1.8179 | Test Accuracy: 0.4540 | Macro F1: 0.4436
Accuracy: 0.4540 | F1: 0.4436
Testing model: checkpoints/log_reg\model_64_sgd_0.0005.pth
Test Loss: 2.4131 | Test Accuracy: 0.3387 | Macro F1: 0.3131
Accuracy: 0.3387 | F1: 0.3131
Testing model: checkpoints/log_reg\model_64_sgd_0.005.pth
Test Loss: 1.9118 | Test Accuracy: 0.4800 | Macro F1: 0.4682
Accuracy: 0.4800 | F1: 0.4682
Testing model: checkpoints/log_reg\model_64_sgd_0.01.pth
Test Loss: 1.8244 | Test Accuracy: 0.5000 | Macro F1: 0.4907
Accuracy: 0.5000 | F1: 0.4907
Best model: checkpoints/log_reg\model_32_adam_0.0005.pth | Acc: 0.5160 | F1: 0.5070
Extracted batch size: 32, optimizer: adam, learning rate: 0.0005
Training process plot saved to plots/log_reg/best_model_training_process_32_0.0005_adam.png
Selected image for prediction: data/test\0\input_26_10_1.jpg