Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks.
%load_ext watermark
%watermark -a 'Sebastian Raschka' -v -p torch
Sebastian Raschka CPython 3.7.3 IPython 7.9.0 torch 1.3.0
based on
import os
import time
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.utils.data import Subset
from torchvision import datasets
from torchvision import transforms
import matplotlib.pyplot as plt
from PIL import Image
if torch.cuda.is_available():
torch.backends.cudnn.deterministic = True
torch.tensor([1]).device
device(type='cpu')
##########################
### SETTINGS
##########################
# Hyperparameters
RANDOM_SEED = 1
LEARNING_RATE = 0.0005
BATCH_SIZE = 256
NUM_EPOCHS = 100
# Architecture
NUM_CLASSES = 10
# Other
DEVICE = "cuda:3"
GRAYSCALE = False
##########################
### CIFAR-10 Dataset
##########################
# Note transforms.ToTensor() scales input images
# to 0-1 range
train_indices = torch.arange(0, 49000)
valid_indices = torch.arange(49000, 50000)
train_and_valid = datasets.CIFAR10(root='data',
train=True,
transform=transforms.ToTensor(),
download=True)
train_dataset = Subset(train_and_valid, train_indices)
valid_dataset = Subset(train_and_valid, valid_indices)
test_dataset = datasets.CIFAR10(root='data',
train=False,
transform=transforms.ToTensor())
#####################################################
### Data Loaders
#####################################################
train_loader = DataLoader(dataset=train_dataset,
batch_size=BATCH_SIZE,
num_workers=8,
shuffle=True)
valid_loader = DataLoader(dataset=valid_dataset,
batch_size=BATCH_SIZE,
num_workers=8,
shuffle=False)
test_loader = DataLoader(dataset=test_dataset,
batch_size=BATCH_SIZE,
num_workers=8,
shuffle=False)
#####################################################
# Checking the dataset
for images, labels in train_loader:
print('Image batch dimensions:', images.shape)
print('Image label dimensions:', labels.shape)
break
for images, labels in test_loader:
print('Image batch dimensions:', images.shape)
print('Image label dimensions:', labels.shape)
break
for images, labels in valid_loader:
print('Image batch dimensions:', images.shape)
print('Image label dimensions:', labels.shape)
break
Files already downloaded and verified Image batch dimensions: torch.Size([256, 3, 32, 32]) Image label dimensions: torch.Size([256]) Image batch dimensions: torch.Size([256, 3, 32, 32]) Image label dimensions: torch.Size([256]) Image batch dimensions: torch.Size([256, 3, 32, 32]) Image label dimensions: torch.Size([256])
##########################
### MODEL
##########################
class NiN(nn.Module):
def __init__(self, num_classes):
super(NiN, self).__init__()
self.num_classes = num_classes
self.classifier = nn.Sequential(
nn.Conv2d(3, 192, kernel_size=5, stride=1, padding=2),
nn.ReLU(inplace=True),
nn.Conv2d(192, 160, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.Conv2d(160, 96, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2, padding=1),
nn.Dropout(0.5),
nn.Conv2d(96, 192, kernel_size=5, stride=1, padding=2),
nn.ReLU(inplace=True),
nn.Conv2d(192, 192, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.Conv2d(192, 192, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.AvgPool2d(kernel_size=3, stride=2, padding=1),
nn.Dropout(0.5),
nn.Conv2d(192, 192, kernel_size=3, stride=1, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(192, 192, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.Conv2d(192, 10, kernel_size=1, stride=1, padding=0),
nn.ReLU(inplace=True),
nn.AvgPool2d(kernel_size=8, stride=1, padding=0),
)
def forward(self, x):
x = self.classifier(x)
logits = x.view(x.size(0), self.num_classes)
probas = torch.softmax(logits, dim=1)
return logits, probas
torch.manual_seed(RANDOM_SEED)
model = NiN(NUM_CLASSES)
model.to(DEVICE)
optimizer = torch.optim.Adam(model.parameters(), lr=LEARNING_RATE)
def compute_accuracy(model, data_loader, device):
correct_pred, num_examples = 0, 0
for i, (features, targets) in enumerate(data_loader):
features = features.to(device)
targets = targets.to(device)
logits, probas = model(features)
_, predicted_labels = torch.max(probas, 1)
num_examples += targets.size(0)
correct_pred += (predicted_labels == targets).sum()
return correct_pred.float()/num_examples * 100
start_time = time.time()
for epoch in range(NUM_EPOCHS):
model.train()
for batch_idx, (features, targets) in enumerate(train_loader):
### PREPARE MINIBATCH
features = features.to(DEVICE)
targets = targets.to(DEVICE)
### FORWARD AND BACK PROP
logits, probas = model(features)
cost = F.cross_entropy(logits, targets)
optimizer.zero_grad()
cost.backward()
### UPDATE MODEL PARAMETERS
optimizer.step()
### LOGGING
if not batch_idx % 120:
print (f'Epoch: {epoch+1:03d}/{NUM_EPOCHS:03d} | '
f'Batch {batch_idx:03d}/{len(train_loader):03d} |'
f' Cost: {cost:.4f}')
# no need to build the computation graph for backprop when computing accuracy
with torch.set_grad_enabled(False):
train_acc = compute_accuracy(model, train_loader, device=DEVICE)
valid_acc = compute_accuracy(model, valid_loader, device=DEVICE)
print(f'Epoch: {epoch+1:03d}/{NUM_EPOCHS:03d} Train Acc.: {train_acc:.2f}%'
f' | Validation Acc.: {valid_acc:.2f}%')
elapsed = (time.time() - start_time)/60
print(f'Time elapsed: {elapsed:.2f} min')
elapsed = (time.time() - start_time)/60
print(f'Total Training Time: {elapsed:.2f} min')
Epoch: 001/100 | Batch 000/192 | Cost: 2.3043 Epoch: 001/100 | Batch 120/192 | Cost: 2.0653 Epoch: 001/100 Train Acc.: 24.69% | Validation Acc.: 24.50% Time elapsed: 0.32 min Epoch: 002/100 | Batch 000/192 | Cost: 1.8584 Epoch: 002/100 | Batch 120/192 | Cost: 1.7447 Epoch: 002/100 Train Acc.: 36.51% | Validation Acc.: 36.90% Time elapsed: 0.64 min Epoch: 003/100 | Batch 000/192 | Cost: 1.6050 Epoch: 003/100 | Batch 120/192 | Cost: 1.5591 Epoch: 003/100 Train Acc.: 40.50% | Validation Acc.: 37.50% Time elapsed: 0.97 min Epoch: 004/100 | Batch 000/192 | Cost: 1.5428 Epoch: 004/100 | Batch 120/192 | Cost: 1.4454 Epoch: 004/100 Train Acc.: 46.12% | Validation Acc.: 45.80% Time elapsed: 1.30 min Epoch: 005/100 | Batch 000/192 | Cost: 1.4038 Epoch: 005/100 | Batch 120/192 | Cost: 1.4141 Epoch: 005/100 Train Acc.: 50.21% | Validation Acc.: 49.90% Time elapsed: 1.63 min Epoch: 006/100 | Batch 000/192 | Cost: 1.3475 Epoch: 006/100 | Batch 120/192 | Cost: 1.2627 Epoch: 006/100 Train Acc.: 52.66% | Validation Acc.: 54.40% Time elapsed: 1.96 min Epoch: 007/100 | Batch 000/192 | Cost: 1.3238 Epoch: 007/100 | Batch 120/192 | Cost: 1.2220 Epoch: 007/100 Train Acc.: 54.42% | Validation Acc.: 54.40% Time elapsed: 2.29 min Epoch: 008/100 | Batch 000/192 | Cost: 1.2009 Epoch: 008/100 | Batch 120/192 | Cost: 1.2045 Epoch: 008/100 Train Acc.: 55.81% | Validation Acc.: 55.30% Time elapsed: 2.63 min Epoch: 009/100 | Batch 000/192 | Cost: 1.2797 Epoch: 009/100 | Batch 120/192 | Cost: 1.1397 Epoch: 009/100 Train Acc.: 59.10% | Validation Acc.: 60.60% Time elapsed: 2.97 min Epoch: 010/100 | Batch 000/192 | Cost: 1.0562 Epoch: 010/100 | Batch 120/192 | Cost: 1.1625 Epoch: 010/100 Train Acc.: 59.79% | Validation Acc.: 60.90% Time elapsed: 3.32 min Epoch: 011/100 | Batch 000/192 | Cost: 1.0868 Epoch: 011/100 | Batch 120/192 | Cost: 1.0636 Epoch: 011/100 Train Acc.: 60.43% | Validation Acc.: 61.00% Time elapsed: 3.66 min Epoch: 012/100 | Batch 000/192 | Cost: 1.0049 Epoch: 012/100 | Batch 120/192 | Cost: 1.2247 Epoch: 012/100 Train Acc.: 62.14% | Validation Acc.: 62.70% Time elapsed: 4.00 min Epoch: 013/100 | Batch 000/192 | Cost: 0.9232 Epoch: 013/100 | Batch 120/192 | Cost: 1.0345 Epoch: 013/100 Train Acc.: 61.42% | Validation Acc.: 61.70% Time elapsed: 4.35 min Epoch: 014/100 | Batch 000/192 | Cost: 0.9256 Epoch: 014/100 | Batch 120/192 | Cost: 1.1639 Epoch: 014/100 Train Acc.: 63.82% | Validation Acc.: 65.80% Time elapsed: 4.69 min Epoch: 015/100 | Batch 000/192 | Cost: 0.9600 Epoch: 015/100 | Batch 120/192 | Cost: 1.0263 Epoch: 015/100 Train Acc.: 63.94% | Validation Acc.: 64.00% Time elapsed: 5.04 min Epoch: 016/100 | Batch 000/192 | Cost: 0.8859 Epoch: 016/100 | Batch 120/192 | Cost: 1.0307 Epoch: 016/100 Train Acc.: 65.79% | Validation Acc.: 66.40% Time elapsed: 5.39 min Epoch: 017/100 | Batch 000/192 | Cost: 1.0020 Epoch: 017/100 | Batch 120/192 | Cost: 0.9755 Epoch: 017/100 Train Acc.: 66.95% | Validation Acc.: 66.60% Time elapsed: 5.73 min Epoch: 018/100 | Batch 000/192 | Cost: 0.9551 Epoch: 018/100 | Batch 120/192 | Cost: 0.8429 Epoch: 018/100 Train Acc.: 67.56% | Validation Acc.: 66.30% Time elapsed: 6.08 min Epoch: 019/100 | Batch 000/192 | Cost: 1.0420 Epoch: 019/100 | Batch 120/192 | Cost: 0.9771 Epoch: 019/100 Train Acc.: 69.44% | Validation Acc.: 68.20% Time elapsed: 6.43 min Epoch: 020/100 | Batch 000/192 | Cost: 0.8471 Epoch: 020/100 | Batch 120/192 | Cost: 0.8322 Epoch: 020/100 Train Acc.: 69.99% | Validation Acc.: 70.20% Time elapsed: 6.77 min Epoch: 021/100 | Batch 000/192 | Cost: 0.8974 Epoch: 021/100 | Batch 120/192 | Cost: 0.8585 Epoch: 021/100 Train Acc.: 69.52% | Validation Acc.: 69.30% Time elapsed: 7.12 min Epoch: 022/100 | Batch 000/192 | Cost: 0.8691 Epoch: 022/100 | Batch 120/192 | Cost: 0.6618 Epoch: 022/100 Train Acc.: 68.26% | Validation Acc.: 65.90% Time elapsed: 7.47 min Epoch: 023/100 | Batch 000/192 | Cost: 0.9277 Epoch: 023/100 | Batch 120/192 | Cost: 0.9011 Epoch: 023/100 Train Acc.: 71.66% | Validation Acc.: 72.10% Time elapsed: 7.81 min Epoch: 024/100 | Batch 000/192 | Cost: 0.7764 Epoch: 024/100 | Batch 120/192 | Cost: 0.7561 Epoch: 024/100 Train Acc.: 71.70% | Validation Acc.: 68.80% Time elapsed: 8.16 min Epoch: 025/100 | Batch 000/192 | Cost: 0.8113 Epoch: 025/100 | Batch 120/192 | Cost: 0.7186 Epoch: 025/100 Train Acc.: 73.62% | Validation Acc.: 73.00% Time elapsed: 8.50 min Epoch: 026/100 | Batch 000/192 | Cost: 0.6515 Epoch: 026/100 | Batch 120/192 | Cost: 0.6954 Epoch: 026/100 Train Acc.: 72.22% | Validation Acc.: 70.20% Time elapsed: 8.85 min Epoch: 027/100 | Batch 000/192 | Cost: 0.7278 Epoch: 027/100 | Batch 120/192 | Cost: 0.7117 Epoch: 027/100 Train Acc.: 74.82% | Validation Acc.: 72.30% Time elapsed: 9.19 min Epoch: 028/100 | Batch 000/192 | Cost: 0.6732 Epoch: 028/100 | Batch 120/192 | Cost: 0.6591 Epoch: 028/100 Train Acc.: 74.93% | Validation Acc.: 72.60% Time elapsed: 9.54 min Epoch: 029/100 | Batch 000/192 | Cost: 0.7438 Epoch: 029/100 | Batch 120/192 | Cost: 0.6429 Epoch: 029/100 Train Acc.: 75.44% | Validation Acc.: 72.80% Time elapsed: 9.88 min Epoch: 030/100 | Batch 000/192 | Cost: 0.7306 Epoch: 030/100 | Batch 120/192 | Cost: 0.6643 Epoch: 030/100 Train Acc.: 76.34% | Validation Acc.: 74.40% Time elapsed: 10.22 min Epoch: 031/100 | Batch 000/192 | Cost: 0.5957 Epoch: 031/100 | Batch 120/192 | Cost: 0.5574 Epoch: 031/100 Train Acc.: 76.60% | Validation Acc.: 75.90% Time elapsed: 10.57 min Epoch: 032/100 | Batch 000/192 | Cost: 0.6414 Epoch: 032/100 | Batch 120/192 | Cost: 0.6951 Epoch: 032/100 Train Acc.: 77.15% | Validation Acc.: 76.10% Time elapsed: 10.91 min Epoch: 033/100 | Batch 000/192 | Cost: 0.6898 Epoch: 033/100 | Batch 120/192 | Cost: 0.7784 Epoch: 033/100 Train Acc.: 77.15% | Validation Acc.: 74.70% Time elapsed: 11.26 min Epoch: 034/100 | Batch 000/192 | Cost: 0.5633 Epoch: 034/100 | Batch 120/192 | Cost: 0.6176 Epoch: 034/100 Train Acc.: 77.53% | Validation Acc.: 74.30% Time elapsed: 11.60 min Epoch: 035/100 | Batch 000/192 | Cost: 0.6300 Epoch: 035/100 | Batch 120/192 | Cost: 0.6720 Epoch: 035/100 Train Acc.: 78.39% | Validation Acc.: 76.10% Time elapsed: 11.94 min Epoch: 036/100 | Batch 000/192 | Cost: 0.7154 Epoch: 036/100 | Batch 120/192 | Cost: 0.6519 Epoch: 036/100 Train Acc.: 78.49% | Validation Acc.: 75.40% Time elapsed: 12.29 min Epoch: 037/100 | Batch 000/192 | Cost: 0.6381 Epoch: 037/100 | Batch 120/192 | Cost: 0.6618 Epoch: 037/100 Train Acc.: 79.58% | Validation Acc.: 75.80% Time elapsed: 12.63 min Epoch: 038/100 | Batch 000/192 | Cost: 0.6078 Epoch: 038/100 | Batch 120/192 | Cost: 0.5283 Epoch: 038/100 Train Acc.: 79.17% | Validation Acc.: 76.00% Time elapsed: 12.97 min Epoch: 039/100 | Batch 000/192 | Cost: 0.5576 Epoch: 039/100 | Batch 120/192 | Cost: 0.6219 Epoch: 039/100 Train Acc.: 79.91% | Validation Acc.: 76.70% Time elapsed: 13.32 min Epoch: 040/100 | Batch 000/192 | Cost: 0.5660 Epoch: 040/100 | Batch 120/192 | Cost: 0.5577 Epoch: 040/100 Train Acc.: 80.49% | Validation Acc.: 76.50% Time elapsed: 13.66 min Epoch: 041/100 | Batch 000/192 | Cost: 0.5098 Epoch: 041/100 | Batch 120/192 | Cost: 0.6621 Epoch: 041/100 Train Acc.: 80.86% | Validation Acc.: 75.70% Time elapsed: 14.00 min Epoch: 042/100 | Batch 000/192 | Cost: 0.4589 Epoch: 042/100 | Batch 120/192 | Cost: 0.5637 Epoch: 042/100 Train Acc.: 81.11% | Validation Acc.: 77.00% Time elapsed: 14.34 min Epoch: 043/100 | Batch 000/192 | Cost: 0.4507 Epoch: 043/100 | Batch 120/192 | Cost: 0.4865 Epoch: 043/100 Train Acc.: 82.07% | Validation Acc.: 78.10% Time elapsed: 14.68 min Epoch: 044/100 | Batch 000/192 | Cost: 0.4427 Epoch: 044/100 | Batch 120/192 | Cost: 0.5242 Epoch: 044/100 Train Acc.: 82.61% | Validation Acc.: 79.10% Time elapsed: 15.02 min Epoch: 045/100 | Batch 000/192 | Cost: 0.4989 Epoch: 045/100 | Batch 120/192 | Cost: 0.5811 Epoch: 045/100 Train Acc.: 82.55% | Validation Acc.: 79.30% Time elapsed: 15.36 min Epoch: 046/100 | Batch 000/192 | Cost: 0.5303 Epoch: 046/100 | Batch 120/192 | Cost: 0.4242 Epoch: 046/100 Train Acc.: 81.80% | Validation Acc.: 76.80% Time elapsed: 15.71 min Epoch: 047/100 | Batch 000/192 | Cost: 0.4491 Epoch: 047/100 | Batch 120/192 | Cost: 0.4902 Epoch: 047/100 Train Acc.: 82.54% | Validation Acc.: 77.90% Time elapsed: 16.05 min Epoch: 048/100 | Batch 000/192 | Cost: 0.4913 Epoch: 048/100 | Batch 120/192 | Cost: 0.6474 Epoch: 048/100 Train Acc.: 83.31% | Validation Acc.: 79.20% Time elapsed: 16.39 min Epoch: 049/100 | Batch 000/192 | Cost: 0.4585 Epoch: 049/100 | Batch 120/192 | Cost: 0.4845 Epoch: 049/100 Train Acc.: 83.53% | Validation Acc.: 78.40% Time elapsed: 16.73 min Epoch: 050/100 | Batch 000/192 | Cost: 0.6038 Epoch: 050/100 | Batch 120/192 | Cost: 0.5446 Epoch: 050/100 Train Acc.: 83.86% | Validation Acc.: 80.50% Time elapsed: 17.08 min Epoch: 051/100 | Batch 000/192 | Cost: 0.3793 Epoch: 051/100 | Batch 120/192 | Cost: 0.4499 Epoch: 051/100 Train Acc.: 83.11% | Validation Acc.: 76.80% Time elapsed: 17.42 min Epoch: 052/100 | Batch 000/192 | Cost: 0.5527 Epoch: 052/100 | Batch 120/192 | Cost: 0.4610 Epoch: 052/100 Train Acc.: 84.63% | Validation Acc.: 79.30% Time elapsed: 17.76 min Epoch: 053/100 | Batch 000/192 | Cost: 0.5015 Epoch: 053/100 | Batch 120/192 | Cost: 0.4079 Epoch: 053/100 Train Acc.: 84.18% | Validation Acc.: 77.60% Time elapsed: 18.11 min Epoch: 054/100 | Batch 000/192 | Cost: 0.5012 Epoch: 054/100 | Batch 120/192 | Cost: 0.4912 Epoch: 054/100 Train Acc.: 84.41% | Validation Acc.: 77.20% Time elapsed: 18.45 min Epoch: 055/100 | Batch 000/192 | Cost: 0.4015 Epoch: 055/100 | Batch 120/192 | Cost: 0.4919 Epoch: 055/100 Train Acc.: 85.16% | Validation Acc.: 80.20% Time elapsed: 18.79 min Epoch: 056/100 | Batch 000/192 | Cost: 0.3976 Epoch: 056/100 | Batch 120/192 | Cost: 0.4252 Epoch: 056/100 Train Acc.: 85.28% | Validation Acc.: 80.30% Time elapsed: 19.14 min Epoch: 057/100 | Batch 000/192 | Cost: 0.3372 Epoch: 057/100 | Batch 120/192 | Cost: 0.4634 Epoch: 057/100 Train Acc.: 84.29% | Validation Acc.: 78.60% Time elapsed: 19.48 min Epoch: 058/100 | Batch 000/192 | Cost: 0.4438 Epoch: 058/100 | Batch 120/192 | Cost: 0.3490 Epoch: 058/100 Train Acc.: 85.93% | Validation Acc.: 77.50% Time elapsed: 19.82 min Epoch: 059/100 | Batch 000/192 | Cost: 0.4541 Epoch: 059/100 | Batch 120/192 | Cost: 0.4415 Epoch: 059/100 Train Acc.: 84.34% | Validation Acc.: 78.40% Time elapsed: 20.16 min Epoch: 060/100 | Batch 000/192 | Cost: 0.3766 Epoch: 060/100 | Batch 120/192 | Cost: 0.4851 Epoch: 060/100 Train Acc.: 86.02% | Validation Acc.: 80.00% Time elapsed: 20.51 min Epoch: 061/100 | Batch 000/192 | Cost: 0.4967 Epoch: 061/100 | Batch 120/192 | Cost: 0.3708 Epoch: 061/100 Train Acc.: 85.57% | Validation Acc.: 79.50% Time elapsed: 20.85 min Epoch: 062/100 | Batch 000/192 | Cost: 0.4197 Epoch: 062/100 | Batch 120/192 | Cost: 0.3054 Epoch: 062/100 Train Acc.: 86.23% | Validation Acc.: 78.40% Time elapsed: 21.19 min Epoch: 063/100 | Batch 000/192 | Cost: 0.4595 Epoch: 063/100 | Batch 120/192 | Cost: 0.4200 Epoch: 063/100 Train Acc.: 86.52% | Validation Acc.: 79.80% Time elapsed: 21.54 min Epoch: 064/100 | Batch 000/192 | Cost: 0.3806 Epoch: 064/100 | Batch 120/192 | Cost: 0.3670 Epoch: 064/100 Train Acc.: 86.81% | Validation Acc.: 80.20% Time elapsed: 21.88 min Epoch: 065/100 | Batch 000/192 | Cost: 0.3922 Epoch: 065/100 | Batch 120/192 | Cost: 0.3698 Epoch: 065/100 Train Acc.: 86.30% | Validation Acc.: 77.90% Time elapsed: 22.22 min Epoch: 066/100 | Batch 000/192 | Cost: 0.3608 Epoch: 066/100 | Batch 120/192 | Cost: 0.4444 Epoch: 066/100 Train Acc.: 88.01% | Validation Acc.: 80.10% Time elapsed: 22.56 min Epoch: 067/100 | Batch 000/192 | Cost: 0.3374 Epoch: 067/100 | Batch 120/192 | Cost: 0.3158 Epoch: 067/100 Train Acc.: 87.94% | Validation Acc.: 80.40% Time elapsed: 22.91 min Epoch: 068/100 | Batch 000/192 | Cost: 0.3959 Epoch: 068/100 | Batch 120/192 | Cost: 0.2217 Epoch: 068/100 Train Acc.: 87.74% | Validation Acc.: 79.70% Time elapsed: 23.25 min Epoch: 069/100 | Batch 000/192 | Cost: 0.3795 Epoch: 069/100 | Batch 120/192 | Cost: 0.3398 Epoch: 069/100 Train Acc.: 88.28% | Validation Acc.: 79.70% Time elapsed: 23.59 min Epoch: 070/100 | Batch 000/192 | Cost: 0.3098 Epoch: 070/100 | Batch 120/192 | Cost: 0.3012 Epoch: 070/100 Train Acc.: 87.96% | Validation Acc.: 80.80% Time elapsed: 23.93 min Epoch: 071/100 | Batch 000/192 | Cost: 0.3705 Epoch: 071/100 | Batch 120/192 | Cost: 0.2943 Epoch: 071/100 Train Acc.: 88.02% | Validation Acc.: 79.90% Time elapsed: 24.27 min Epoch: 072/100 | Batch 000/192 | Cost: 0.3353 Epoch: 072/100 | Batch 120/192 | Cost: 0.3237 Epoch: 072/100 Train Acc.: 88.34% | Validation Acc.: 80.60% Time elapsed: 24.62 min Epoch: 073/100 | Batch 000/192 | Cost: 0.3683 Epoch: 073/100 | Batch 120/192 | Cost: 0.4178 Epoch: 073/100 Train Acc.: 88.93% | Validation Acc.: 80.10% Time elapsed: 24.96 min Epoch: 074/100 | Batch 000/192 | Cost: 0.2282 Epoch: 074/100 | Batch 120/192 | Cost: 0.1967 Epoch: 074/100 Train Acc.: 88.58% | Validation Acc.: 81.40% Time elapsed: 25.30 min Epoch: 075/100 | Batch 000/192 | Cost: 0.2701 Epoch: 075/100 | Batch 120/192 | Cost: 0.3722 Epoch: 075/100 Train Acc.: 87.93% | Validation Acc.: 79.70% Time elapsed: 25.64 min Epoch: 076/100 | Batch 000/192 | Cost: 0.2850 Epoch: 076/100 | Batch 120/192 | Cost: 0.2874 Epoch: 076/100 Train Acc.: 88.92% | Validation Acc.: 81.10% Time elapsed: 25.98 min Epoch: 077/100 | Batch 000/192 | Cost: 0.2686 Epoch: 077/100 | Batch 120/192 | Cost: 0.4312 Epoch: 077/100 Train Acc.: 89.39% | Validation Acc.: 81.60% Time elapsed: 26.33 min Epoch: 078/100 | Batch 000/192 | Cost: 0.2282 Epoch: 078/100 | Batch 120/192 | Cost: 0.3395 Epoch: 078/100 Train Acc.: 88.67% | Validation Acc.: 78.90% Time elapsed: 26.67 min Epoch: 079/100 | Batch 000/192 | Cost: 0.3127 Epoch: 079/100 | Batch 120/192 | Cost: 0.2906 Epoch: 079/100 Train Acc.: 90.77% | Validation Acc.: 81.20% Time elapsed: 27.01 min Epoch: 080/100 | Batch 000/192 | Cost: 0.2468 Epoch: 080/100 | Batch 120/192 | Cost: 0.3638 Epoch: 080/100 Train Acc.: 89.99% | Validation Acc.: 80.40% Time elapsed: 27.35 min Epoch: 081/100 | Batch 000/192 | Cost: 0.2936 Epoch: 081/100 | Batch 120/192 | Cost: 0.3772 Epoch: 081/100 Train Acc.: 90.76% | Validation Acc.: 80.50% Time elapsed: 27.69 min Epoch: 082/100 | Batch 000/192 | Cost: 0.2584 Epoch: 082/100 | Batch 120/192 | Cost: 0.2718 Epoch: 082/100 Train Acc.: 91.01% | Validation Acc.: 81.20% Time elapsed: 28.04 min Epoch: 083/100 | Batch 000/192 | Cost: 0.1904 Epoch: 083/100 | Batch 120/192 | Cost: 0.3090 Epoch: 083/100 Train Acc.: 90.68% | Validation Acc.: 81.30% Time elapsed: 28.38 min Epoch: 084/100 | Batch 000/192 | Cost: 0.2506 Epoch: 084/100 | Batch 120/192 | Cost: 0.2825 Epoch: 084/100 Train Acc.: 90.43% | Validation Acc.: 80.40% Time elapsed: 28.73 min Epoch: 085/100 | Batch 000/192 | Cost: 0.2307 Epoch: 085/100 | Batch 120/192 | Cost: 0.2441 Epoch: 085/100 Train Acc.: 90.88% | Validation Acc.: 81.30% Time elapsed: 29.07 min Epoch: 086/100 | Batch 000/192 | Cost: 0.3149 Epoch: 086/100 | Batch 120/192 | Cost: 0.3129 Epoch: 086/100 Train Acc.: 90.13% | Validation Acc.: 82.40% Time elapsed: 29.41 min Epoch: 087/100 | Batch 000/192 | Cost: 0.3487 Epoch: 087/100 | Batch 120/192 | Cost: 0.2559 Epoch: 087/100 Train Acc.: 90.74% | Validation Acc.: 81.40% Time elapsed: 29.75 min Epoch: 088/100 | Batch 000/192 | Cost: 0.2412 Epoch: 088/100 | Batch 120/192 | Cost: 0.1828 Epoch: 088/100 Train Acc.: 91.08% | Validation Acc.: 80.20% Time elapsed: 30.10 min Epoch: 089/100 | Batch 000/192 | Cost: 0.2957 Epoch: 089/100 | Batch 120/192 | Cost: 0.2939 Epoch: 089/100 Train Acc.: 90.67% | Validation Acc.: 80.30% Time elapsed: 30.44 min Epoch: 090/100 | Batch 000/192 | Cost: 0.2298 Epoch: 090/100 | Batch 120/192 | Cost: 0.2900 Epoch: 090/100 Train Acc.: 91.63% | Validation Acc.: 79.00% Time elapsed: 30.78 min Epoch: 091/100 | Batch 000/192 | Cost: 0.2558 Epoch: 091/100 | Batch 120/192 | Cost: 0.2915 Epoch: 091/100 Train Acc.: 91.36% | Validation Acc.: 81.00% Time elapsed: 31.12 min Epoch: 092/100 | Batch 000/192 | Cost: 0.1510 Epoch: 092/100 | Batch 120/192 | Cost: 0.1974 Epoch: 092/100 Train Acc.: 91.84% | Validation Acc.: 82.20% Time elapsed: 31.47 min Epoch: 093/100 | Batch 000/192 | Cost: 0.2308 Epoch: 093/100 | Batch 120/192 | Cost: 0.2247 Epoch: 093/100 Train Acc.: 91.50% | Validation Acc.: 80.50% Time elapsed: 31.81 min Epoch: 094/100 | Batch 000/192 | Cost: 0.2712 Epoch: 094/100 | Batch 120/192 | Cost: 0.3268 Epoch: 094/100 Train Acc.: 91.74% | Validation Acc.: 81.30% Time elapsed: 32.15 min Epoch: 095/100 | Batch 000/192 | Cost: 0.2417 Epoch: 095/100 | Batch 120/192 | Cost: 0.2162 Epoch: 095/100 Train Acc.: 91.53% | Validation Acc.: 79.00% Time elapsed: 32.49 min Epoch: 096/100 | Batch 000/192 | Cost: 0.2523 Epoch: 096/100 | Batch 120/192 | Cost: 0.2598 Epoch: 096/100 Train Acc.: 91.56% | Validation Acc.: 81.00% Time elapsed: 32.84 min Epoch: 097/100 | Batch 000/192 | Cost: 0.2027 Epoch: 097/100 | Batch 120/192 | Cost: 0.2432 Epoch: 097/100 Train Acc.: 92.53% | Validation Acc.: 80.80% Time elapsed: 33.18 min Epoch: 098/100 | Batch 000/192 | Cost: 0.2115 Epoch: 098/100 | Batch 120/192 | Cost: 0.2746 Epoch: 098/100 Train Acc.: 92.30% | Validation Acc.: 81.10% Time elapsed: 33.52 min Epoch: 099/100 | Batch 000/192 | Cost: 0.1611 Epoch: 099/100 | Batch 120/192 | Cost: 0.2142 Epoch: 099/100 Train Acc.: 92.66% | Validation Acc.: 80.90% Time elapsed: 33.86 min Epoch: 100/100 | Batch 000/192 | Cost: 0.1935 Epoch: 100/100 | Batch 120/192 | Cost: 0.2488 Epoch: 100/100 Train Acc.: 92.68% | Validation Acc.: 80.20% Time elapsed: 34.20 min Total Training Time: 34.20 min
%watermark -iv
PIL.Image 6.2.1 torch 1.3.0 numpy 1.17.4 matplotlib 3.1.0 pandas 0.24.2 torchvision 0.4.1a0+d94043a