├── .DS_Store ├── LICENSE ├── README.md ├── exp1_Tensor.py ├── exp2_Autograd.py ├── exp3_simple_linear_model_1.py ├── exp3_simple_linear_model_2.py ├── exp4_CNN_MNIST.py ├── exp5_Tensorboard.py ├── exp6_data_loader.py └── faces ├── 0805personali01.jpg ├── 1084239450_e76e00b7e7.jpg ├── 10comm-decarlo.jpg ├── 110276240_bec305da91.jpg ├── 1198_0_861.jpg ├── 137341995_e7c48e9a75.jpg ├── 1383023626_8a49e4879a.jpg ├── 144044282_87cf3ff76e.jpg ├── 152601997_ec6429a43c.jpg ├── 1549040388_b99e9fa295.jpg ├── 1878519279_f905d4f34e.jpg ├── 2046713398_91aaa6fe1c.jpg ├── 2173711035_dbd53b4f9f.jpg ├── 2210514040_6b03ff2629.jpg ├── 2322901504_08122b01ba.jpg ├── 2327253037_66a61ea6fe.jpg ├── 2328398005_d328a70b4c.jpg ├── 2370961440_6bc8ce346c.jpg ├── 2382SJ8.jpg ├── 252418361_440b75751b.jpg ├── 262007783_943bbcf613.jpg ├── 2633371780_45b740b670.jpg ├── 2647088981_60e9fe40cd.jpg ├── 2711409561_a0786a3d3d.jpg ├── 2722779845_7fcb64a096.jpg ├── 2795838930_0cc5aa5f41.jpg ├── 2902323565_100017b63c.jpg ├── 2902760364_89c50bde40.jpg ├── 2956581526_cd803f2daa.jpg ├── 297448785_b2dda4b2c0.jpg ├── 299733036_fff5ea6f8e.jpg ├── 303808204_1f744bc407.jpg ├── 3074791551_baee7fa0c1.jpg ├── 3152653555_68322314f3.jpg ├── 3264867945_fe18d442c1.jpg ├── 3273658251_b95f65c244.jpg ├── 3298715079_5af7c78fcb.jpg ├── 3325611505_ddc7beffa1.jpg ├── 3362762930_24f76cb89c.jpg ├── 343583208_e986824d77.jpg ├── 3461016494_56cce9c984.jpg ├── 348272697_832ce65324.jpg ├── 3534188114_2108895291.jpg ├── 3534189272_8ef88ba368.jpg ├── 3555944509_7b477069c6.jpg ├── 3574737496_6ee8207045.jpg ├── 362167809_d5a5dcbfdb.jpg ├── 363149951_8be04dc6c0.jpg ├── 3638950581_3387685d3a.jpg ├── 3646828311_bfeb429ef7.jpg ├── 3689162471_5f9ffb5aa0.jpg ├── 3718903026_c1bf5dfcf8.jpg ├── 3790616528_297c0ac935.jpg ├── 3855944735_e252959937.jpg ├── 3856149136_d4595ffdd4.jpg ├── 3872768751_e60d7fdbd5.jpg ├── 529447797_0f9d2fb756.jpg ├── 57635685_d41c98f8ca.jpg ├── 809285949_6889026b53.jpg ├── 92053278_be61a225d2.jpg ├── 96063776_bdb3617b64.jpg ├── 97308305_4b737d0873.jpg ├── britney-bald.jpg ├── deeny.peggy.jpg ├── matt-mathes.jpg ├── person-7.jpg ├── person.jpg ├── person_TjahjonoDGondhowiardjo.jpg └── personalpic.jpg /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/.DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Yiqi Yan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LearningPytorch 2 | Simple demos for PyTorch. 3 | Reference: [PyTorch online tutorials](http://pytorch.org/tutorials/) 4 | 5 | ## exp1_Tensor.py 6 | [Reference](http://pytorch.org/tutorials/beginner/blitz/tensor_tutorial.html#sphx-glr-beginner-blitz-tensor-tutorial-py) 7 | This demo includes: 8 | 1. How to construct a Tensor in PyTorch 9 | 2. Basic operations that can be applied to Tensor objects 10 | 3. How to convert a PyTorch-Tensor to Numpy-Ndarray, and vice versa. 11 | 4. How to move Tensors onto GPU for efficient computation. 12 | 13 | ## exp2_Autograd.py 14 | [Reference](http://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html) 15 | This demo shows how to compute gradients. 16 | 17 | ## exp3_simple_linear_model_1.py & exp3_simple_linear_model_2.py 18 | This demo construct a basic linear regression model. The two scripts shows two equivalent implementation: using **torch.nn** and **torch.nn.functional**, respectively. 19 | 20 | ## exp4_CNN_MNIST.py 21 | Train a simple CNN model on MNIST dataset. 22 | 23 | ## exp5_Tensorboard.py 24 | One disadvantage of PyTorch is that it doesn't have its own visualization toolkit. But it is possible to use Tensorboard in PyTorch, thanks to [tensorboardX]((https://github.com/lanpa/tensorboard-pytorch)). ***(Of course, you need to install tensorlfow first!)*** 25 | 26 | 1. Install tensorboardX 27 | ``` 28 | pip install tensorboardX 29 | ``` 30 | 2. Import tensorboardX 31 | ``` 32 | from tensorboardX import SummaryWriter 33 | ``` 34 | 3. Save tensorboard logs 35 | ``` 36 | # (1) Log the scalar values 37 | writer.add_scalar('loss', running_loss/100, step) 38 | writer.add_scalar('accuracy', 100*correct/total, step) 39 | # (2) Log values and gradients of the parameters (histogram) 40 | for tag, value in net.named_parameters(): 41 | tag = tag.replace('.', '/') 42 | writer.add_histogram(tag, to_np(value), step) 43 | writer.add_histogram(tag+'/grad', to_np(value.grad), step) 44 | # (3) Log the images 45 | images = utils.make_grid(inputs.view(-1,3,32,32).data, nrow=5, 46 | normalize=True, scale_each=True) 47 | writer.add_image('Image', images, step) 48 | ``` 49 | 50 | ## exp6_data_loader.py 51 | [Reference](http://pytorch.org/tutorials/beginner/data_loading_tutorial.html) 52 | One important thing in practice: loading your own dataset. If you are a former Tensorflow user, you must be familiar with constructing TFrecords files. PyTorch also provides an efficient way to load data. 53 | 54 | 1. First, inherit from ***torch.utils.data.Dataset*** and overwirte ***\_\_len\_\_*** & ***\_\_getitem\_\_*** 55 | * overwirte ***\_\_len\_\_*** so that len(dataset) returns the size of the dataset. 56 | * overwirte ***\_\_getitem\_\_*** to support the indexing such that dataset[i] can be used to get the *ith* sample 57 | 2. Senond, instantiate ***torch.utils.data.DataLoader*** 58 | 3. Iterate through the entier dataset, getting one batch each time for backpropgation. 59 | -------------------------------------------------------------------------------- /exp1_Tensor.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # This is an example code for getting started with PyTorch 4 | print("getting started with PyTorth\n") 5 | 6 | import torch 7 | import numpy as np 8 | 9 | # Tensors 10 | x1 = torch.Tensor(5,3) # Construct a 5x3 matrix, uninitialized 11 | print("x1:"); print(x1) 12 | x2 = torch.rand(5,3) # Construct a randomly initialized matrix 13 | print("x2:"); print(x2) 14 | x3_ = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15]]) 15 | x3 = torch.Tensor(x3_) # Construct matrix initialized by ndarray 16 | print("x3:"); print(x3) 17 | print(x3.size()) 18 | # torch.Size is in fact a tuple, so it supports the same operations 19 | 20 | # Operations 21 | # Addition: syntax 1 22 | y1 = torch.add(x2,x3) 23 | print("y1:"); print(y1) 24 | # Addition: syntax 2 25 | y2 = x2 + x3 26 | print("y2:"); print(y2) 27 | # Addition: syntax 3 28 | y3 = torch.Tensor(5,3) 29 | torch.add(x2,x3,out=y3) 30 | print("y3:"); print(y3) 31 | # Addition: in place 32 | y4 = x2.clone() 33 | y4.add_(x3) 34 | print("y4:"); print(y4) 35 | # standard numpy-like indexing is supported 36 | y5 = x3[0,:] 37 | print("y5:"); print(y5) 38 | # expand/squeeze dimensions 39 | x3_hat = x3.clone() 40 | x3_hat = torch.unsqueeze(x3_hat, 0) # [5,3] ----> [1,5,3] 41 | print(x3_hat.size()) 42 | x3_hat = torch.squeeze(x3_hat) # [1,5,3] ----> [5,3] 43 | print(x3_hat.size()) 44 | 45 | # Numpy Bridge 46 | # from Tensor to ndarray 47 | a = torch.ones(3) 48 | print("a:"); print(a) 49 | b = a.numpy() 50 | print("b:"); print(b) 51 | a.add_(1) 52 | print("b_new:"); print(b) # the value of ndarray changes according to torch Tensor 53 | # from ndarray to Tensor 54 | c = torch.from_numpy(b) 55 | print("c:"); print(c) 56 | a.add_(1) 57 | print("c_new:"); print(c) # the values change in a chain: a->b->c 58 | 59 | # CUDA Tensors 60 | # Tensors can be moved onto GPU 61 | if torch.cuda.is_available(): 62 | device = torch.device("cuda") 63 | x2 = x2.to(device) 64 | x3 = x3.to(device) 65 | y = x2 + x3 66 | -------------------------------------------------------------------------------- /exp2_Autograd.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # How does PyTorch compute differentiation? 4 | 5 | import torch 6 | 7 | # create a tensor with requires_grad is True 8 | x = torch.ones(2, 2, requires_grad=True) 9 | # can also modify requires_grad later 10 | # x = torch.ones(2, 2) 11 | # x.requires_grad_() 12 | print("\nx:") 13 | print(x) 14 | 15 | # series of operations 16 | y = x + 2 17 | print("\ny:") 18 | print(y) 19 | 20 | z = y * y * 3 21 | print("\nz:") 22 | print(z) 23 | 24 | out = z.mean() 25 | print("\nout:") 26 | print(out) 27 | 28 | # backprop 29 | out.backward() 30 | 31 | # gradients (we expect 4.5) 32 | print("\nx.grad:") 33 | print(x.grad) 34 | 35 | # can we compute gradient of a non-scalar? 36 | print("\n\n\ngradient of a non-scalar?") 37 | x = torch.ones(2, 2, requires_grad=True) 38 | y = x + 2 39 | z = y * y * 3 40 | a = 5 * torch.ones(2, 2) 41 | z.backward(a) 42 | print(x.grad) 43 | -------------------------------------------------------------------------------- /exp3_simple_linear_model_1.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | import torch.nn as nn 4 | import torch.nn.functional as F 5 | import torch.optim as optim 6 | 7 | os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" 8 | os.environ["CUDA_VISIBLE_DEVICES"] = "0" 9 | 10 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 11 | 12 | torch.backends.cudnn.benchmark = True 13 | 14 | class LinearModel(nn.Module): 15 | def __init__(self, in_features, inter_features, out_features, bias=True): 16 | super(LinearModel, self).__init__() 17 | self.bias = bias 18 | self.training = True 19 | self.weight_param1 = nn.Parameter( 20 | torch.FloatTensor(inter_features, in_features).normal_(0.0, 0.01) 21 | ) 22 | self.weight_param2 = nn.Parameter( 23 | torch.FloatTensor(out_features, inter_features).normal_(0.0, 0.01) 24 | ) 25 | if self.bias: 26 | self.bias_param1 = nn.Parameter( 27 | torch.FloatTensor(inter_features).fill_(0.) 28 | ) 29 | self.bias_param2 = nn.Parameter( 30 | torch.FloatTensor(out_features).fill_(0.) 31 | ) 32 | def set_mode(self, training): 33 | self.training = training 34 | def forward(self, x): 35 | # the shape of x should be batch_size x in_features 36 | x = F.linear(input=x, weight=self.weight_param1, 37 | bias=self.bias_param1 if self.bias else None) 38 | x = F.relu(x) 39 | x = F.dropout(x, p=0.5, training=self.training) 40 | x = F.linear(input=x, weight=self.weight_param2, 41 | bias=self.bias_param2 if self.bias else None) 42 | return x 43 | 44 | if __name__ == "__main__": 45 | # define the model 46 | model = LinearModel(64, 32, 4, True) 47 | model = model.to(device) 48 | 49 | # loss function 50 | criterion = nn.MSELoss() 51 | 52 | # data, batch_size = 1000 53 | input_data = torch.randn(1000, 64).to(device) 54 | target_data = torch.randn(1000, 4).to(device) 55 | test_input = torch.randn(200, 64).to(device) 56 | test_target = torch.randn(200, 4).to(device) 57 | 58 | # optimizer 59 | optimizer = optim.SGD(params=model.parameters(), lr=0.01) 60 | 61 | # train for 100 epochs 62 | for epoch in range(100): # iterate through epochs 63 | torch.cuda.empty_cache() 64 | for i in range(1000): # iterate through dataset 65 | # set to training mode 66 | model.set_mode(True) 67 | # clear grad cache 68 | model.zero_grad() 69 | optimizer.zero_grad() 70 | # forward 71 | input = input_data[i,:].unsqueeze(0) 72 | target = target_data[i,:].unsqueeze(0) 73 | out = model(input) 74 | loss = criterion(out, target) 75 | # backward 76 | loss.backward() 77 | optimizer.step() 78 | # after each epoch: check loss on test set 79 | model.set_mode(False) 80 | with torch.no_grad(): 81 | out_test = model(test_input) 82 | loss_test = criterion(out_test, test_target) 83 | print("epoch %d: test loss %.4f" % (epoch, loss.item())) 84 | -------------------------------------------------------------------------------- /exp3_simple_linear_model_2.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | import torch.nn as nn 4 | import torch.nn.functional as F 5 | import torch.optim as optim 6 | 7 | os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" 8 | os.environ["CUDA_VISIBLE_DEVICES"] = "0" 9 | 10 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 11 | 12 | torch.backends.cudnn.benchmark = True 13 | 14 | class LinearModel(nn.Module): 15 | def __init__(self, in_features, inter_features, out_features, bias=True): 16 | super(LinearModel, self).__init__() 17 | self.layer = nn.Sequential( 18 | nn.Linear(in_features=in_features, out_features=inter_features, bias=bias), 19 | nn.ReLU(), 20 | nn.Dropout(p=0.5), 21 | nn.Linear(in_features=inter_features, out_features=out_features, bias=bias) 22 | ) 23 | self.reset_parameters() 24 | def reset_parameters(self): 25 | for m in self.modules(): 26 | if isinstance(m, nn.Linear): 27 | nn.init.normal_(m.weight, 0, 0.01) 28 | if m.bias is not None: 29 | nn.init.constant_(m.bias, 0) 30 | def forward(self, x): 31 | # the shape of x should be batch_size x in_features 32 | x = self.layer(x) 33 | return x 34 | 35 | if __name__ == "__main__": 36 | # define the model 37 | model = LinearModel(64, 32, 4, True) 38 | model = model.to(device) 39 | 40 | # loss function 41 | criterion = nn.MSELoss() 42 | 43 | # data, batch_size = 1000 44 | input_data = torch.randn(1000, 64).to(device) 45 | target_data = torch.randn(1000, 4).to(device) 46 | test_input = torch.randn(200, 64).to(device) 47 | test_target = torch.randn(200, 4).to(device) 48 | 49 | # optimizer 50 | optimizer = optim.SGD(params=model.parameters(), lr=0.01) 51 | 52 | # train for 100 epochs 53 | for epoch in range(100): # iterate through epochs 54 | torch.cuda.empty_cache() 55 | for i in range(1000): # iterate through dataset 56 | # set to training mode 57 | model.train() 58 | # clear grad cache 59 | model.zero_grad() 60 | optimizer.zero_grad() 61 | # forward 62 | input = input_data[i,:].unsqueeze(0) 63 | target = target_data[i,:].unsqueeze(0) 64 | out = model(input) 65 | loss = criterion(out, target) 66 | # backward 67 | loss.backward() 68 | optimizer.step() 69 | # after each epoch: check loss on test set 70 | model.eval() 71 | with torch.no_grad(): 72 | out_test = model(test_input) 73 | loss_test = criterion(out_test, test_target) 74 | print("epoch %d: test loss %.4f" % (epoch, loss.item())) 75 | -------------------------------------------------------------------------------- /exp4_CNN_MNIST.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | import numpy as np 4 | import torch 5 | import torch.nn as nn 6 | import torch.nn.functional as F 7 | import torch.optim as optim 8 | import torchvision.datasets as datasets 9 | import torchvision.transforms as transforms 10 | 11 | os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" 12 | os.environ["CUDA_VISIBLE_DEVICES"] = "0" 13 | 14 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 15 | 16 | torch.backends.cudnn.benchmark = True 17 | 18 | class Net(nn.Module): 19 | def __init__(self, in_features, num_classes): 20 | super(Net, self).__init__() 21 | self.conv1 = nn.Sequential( 22 | nn.Conv2d(in_channels=in_features, out_channels=32, kernel_size=5, stride=1, padding=2), 23 | nn.ReLU(), 24 | nn.MaxPool2d(kernel_size=2, stride=2) 25 | ) 26 | self.conv2 = nn.Sequential( 27 | nn.Conv2d(in_channels=32, out_channels=64, kernel_size=5, stride=1, padding=2), 28 | nn.ReLU(), 29 | nn.MaxPool2d(kernel_size=2, stride=2) 30 | ) 31 | self.dense = nn.Sequential( 32 | nn.Linear(in_features=7*7*64, out_features=1024, bias=True), 33 | nn.ReLU(), 34 | nn.Dropout(p=0.5), 35 | nn.Linear(in_features=1024, out_features=num_classes, bias=True) 36 | ) 37 | self.reset_parameters() 38 | def reset_parameters(self): 39 | for m in self.modules(): 40 | if isinstance(m, nn.Conv2d): 41 | nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') 42 | if m.bias is not None: 43 | nn.init.constant_(m.bias, 0.) 44 | elif isinstance(m, nn.Linear): 45 | nn.init.normal_(m.weight, 0., 0.01) 46 | nn.init.constant_(m.bias, 0.) 47 | def forward(self, x): 48 | x = self.conv1(x) 49 | x = self.conv2(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.dense(x) 52 | return x 53 | 54 | if __name__ == "__main__": 55 | # dataset 56 | def _worker_init_fn_(): 57 | torch_seed = torch.initial_seed() 58 | np_seed = torch_seed // 2**32-1 59 | random.seed(torch_seed) 60 | np.random.seed(np_seed) 61 | transform = transforms.Compose([ 62 | transforms.ToTensor(), 63 | transforms.Normalize((0.1307,), (0.3081,)) 64 | ]) 65 | trainset = datasets.MNIST(root='MNIST', train=True, download=True, transform=transform) 66 | trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, 67 | shuffle=True, num_workers=4, worker_init_fn=_worker_init_fn_()) 68 | testset = datasets.MNIST(root='MNIST', train=False, download=True, transform=transform) 69 | testloader = torch.utils.data.DataLoader(testset, batch_size=1000, shuffle=False, num_workers=4) 70 | 71 | # define the network 72 | net = Net(in_features=1, num_classes=10).to(device) 73 | 74 | # define loss 75 | criterion = nn.CrossEntropyLoss() 76 | 77 | # define optimizer 78 | optimizer = optim.SGD(net.parameters(), lr=0.01, momentum=0.9) 79 | 80 | # training 81 | epochs = 10 82 | for epoch in range(epochs): 83 | torch.cuda.empty_cache() 84 | correct = 0. 85 | total = 0. 86 | for i, data in enumerate(trainloader, 0): 87 | # data 88 | inputs, labels = data 89 | inputs, labels = inputs.to(device), labels.to(device) 90 | # prepare 91 | net.train() 92 | net.zero_grad() 93 | optimizer.zero_grad() 94 | # forward + backward + optimize 95 | outputs = net(inputs) 96 | loss = criterion(outputs, labels) 97 | loss.backward() 98 | optimizer.step() 99 | # check accuracy on test set 100 | if i % 100 == 0: 101 | net.eval() 102 | with torch.no_grad(): 103 | for __, data_test in enumerate(testloader, 0): 104 | images_test, labels_test = data_test 105 | images_test, labels_test = images_test.to(device), labels_test.to(device) 106 | outputs_test = net(images_test) 107 | predict = torch.argmax(outputs_test, 1) 108 | total += labels_test.size(0) 109 | correct += torch.eq(predict, labels_test).sum().double().item() 110 | print('[eppch %d/%d][iter %d/%d] loss: %.4f test accuracy: %.2f%%' 111 | % (epoch+1, epochs, i+1, len(trainloader), loss.item(), 100*correct/total)) 112 | correct = 0. 113 | total = 0. 114 | -------------------------------------------------------------------------------- /exp5_Tensorboard.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # Use tensorboard visualization toolkit in PyTorch 4 | # reference: https://github.com/lanpa/tensorboard-pytorch 5 | 6 | import torch 7 | from torch.autograd import Variable 8 | import torch.nn as nn 9 | import torch.nn.functional as F 10 | import torch.optim as optim 11 | import torchvision 12 | import torchvision.transforms as transforms 13 | import torchvision.utils as utils 14 | from tensorboardX import SummaryWriter 15 | 16 | transform = transforms.Compose([transforms.ToTensor(), 17 | transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) 18 | trainset = torchvision.datasets.CIFAR10(root='./CIFAR10_data', train=True, download=True, transform=transform) 19 | trainloader = torch.utils.data.DataLoader(trainset, batch_size=10, shuffle=True, num_workers=2) 20 | testset = torchvision.datasets.CIFAR10(root='./CIFAR10_data', train=False, download=True, transform=transform) 21 | testloader = torch.utils.data.DataLoader(testset, batch_size=10, shuffle=False, num_workers=2) 22 | classes = ('plane', 'car', 'bird', 'cat', 23 | 'deer', 'dog', 'frog', 'horse', 'ship', 'truck') 24 | 25 | def to_np(x): 26 | return x.data.cpu().numpy() 27 | 28 | class Net(nn.Module): 29 | def __init__(self): 30 | super(Net, self).__init__() 31 | self.conv = nn.Sequential( 32 | nn.Conv2d(3, 32, 5, bias=True), 33 | nn.ReLU(True), 34 | nn.MaxPool2d(2, 2), 35 | nn.Conv2d(32, 64, 5), 36 | nn.ReLU(True), 37 | nn.MaxPool2d(2, 2) 38 | ) 39 | self.fc = nn.Sequential( 40 | nn.Linear(64*5*5, 1024), 41 | nn.ReLU(True), 42 | nn.Linear(1024, 10) 43 | ) 44 | def forward(self, x): 45 | x = self.conv(x) 46 | x = x.view(-1, 64*5*5) 47 | x = self.fc(x) 48 | return x 49 | 50 | if __name__ == "__main__": 51 | net = Net() 52 | net.cuda() 53 | criterion = nn.CrossEntropyLoss() 54 | optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9) 55 | # Set the Summary Writer 56 | writer = SummaryWriter('./CIFAR10_logs') 57 | # add graph 58 | # if you want to show the input tensor, set requires_grad=True 59 | # t = Variable(torch.Tensor(1,3,32,32).cuda(), requires_grad=True) 60 | # res = net(t) 61 | # writer.add_graph(net, res) 62 | # training 63 | step = 0 64 | for epoch in range(1): # loop over the dataset multiple times; not the # steps! 65 | running_loss = 0.0 66 | correct = 0 67 | total = 0 68 | for i,data in enumerate(trainloader, 0): 69 | inputs, labels = data 70 | inputs, labels = Variable(inputs.cuda()), Variable(labels.cuda()) 71 | optimizer.zero_grad() 72 | outputs = net(inputs) 73 | loss = criterion(outputs, labels) 74 | loss.backward() 75 | optimizer.step() 76 | # print statistics 77 | running_loss += loss.data[0] 78 | if (i+1) % 100 == 0: 79 | # trainging loss 80 | print('[%d, %d] loss: %f' %(epoch+1, i+1, running_loss/100)) 81 | # test accuracy 82 | for data in testloader: 83 | images_test, labels_test = data 84 | images_test, labels_test = Variable(images_test.cuda()), labels_test.cuda() 85 | outputs_test = net(images_test) 86 | _, predicted = torch.max(outputs_test.data, 1) 87 | total += labels_test.size(0) 88 | correct += (predicted == labels_test).sum() 89 | print("test accuracy: %d%%\n" % (100*correct/total)) 90 | 91 | #============ TensorBoard logging ============# 92 | # (1) Log the scalar values 93 | writer.add_scalar('loss', running_loss/100, step) 94 | writer.add_scalar('accuracy', 100*correct/total, step) 95 | # (2) Log values and gradients of the parameters (histogram) 96 | for tag, value in net.named_parameters(): 97 | tag = tag.replace('.', '/') 98 | writer.add_histogram(tag, to_np(value), step) 99 | writer.add_histogram(tag+'/grad', to_np(value.grad), step) 100 | # (3) Log the images 101 | images = utils.make_grid(inputs.view(-1,3,32,32).data, nrow=5, 102 | normalize=True, scale_each=True) 103 | writer.add_image('Image', images, step) 104 | # reset 105 | running_loss = 0.0 106 | correct = 0 107 | total = 0 108 | step += 1 109 | -------------------------------------------------------------------------------- /exp6_data_loader.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import os 3 | import torch 4 | import torch.utils.data as data 5 | import torchvision.transforms as transforms 6 | import torchvision.utils as utils 7 | from logger import Logger 8 | from tensorboardX import SummaryWriter 9 | 10 | # reference: http://pytorch.org/tutorials/beginner/data_loading_tutorial.html 11 | 12 | # inherit from torch.utils.data.Dataset and overwirte __len__ & __getitem__ 13 | class myDataset(data.Dataset): 14 | def __init__(self, root, transform=None): 15 | self.root = root 16 | self.transform = transform 17 | for __, __, filenames in os.walk(self.root): 18 | self.filenames = filenames 19 | 20 | def __len__(self): 21 | return len(self.filenames) 22 | 23 | # read the images in __getitem__ 24 | # this is memory efficient because all the images are not stored in the memory at once but read as required 25 | def __getitem__(self, index): 26 | filename = self.filenames[index] 27 | image = cv2.imread(self.root + '/' + filename) 28 | image = cv2.resize(image, (320,320), cv2.INTER_CUBIC) 29 | image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) 30 | if self.transform is not None: 31 | image = self.transform(image) 32 | data = { 33 | 'name': filename, 34 | 'data': image 35 | } 36 | return data 37 | 38 | if __name__ == "__main__": 39 | logger = Logger('./data_loader_logs') 40 | # writer = SummaryWriter('./data_loader_logs') 41 | batch_size = 6 42 | # instantiate torch.utils.data.DataLoader 43 | transform = transforms.Compose([transforms.ToTensor(), 44 | transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) 45 | imgLoader = data.DataLoader( 46 | myDataset(root="faces", transform=transform), 47 | batch_size=batch_size, shuffle=True, num_workers=2) 48 | for i, data in enumerate(imgLoader, 0): 49 | print("[%d]\n" % i) 50 | print(data['name']); 51 | print('\n') 52 | 53 | info = { 54 | 'images': data['data'][:3] 55 | } 56 | for tag, images in info.items(): 57 | logger.image_summary(tag, images, i) 58 | # images = utils.make_grid(data['data'], nrow=2) 59 | # writer.add_image('Image', images, i) 60 | -------------------------------------------------------------------------------- /faces/0805personali01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/0805personali01.jpg -------------------------------------------------------------------------------- /faces/1084239450_e76e00b7e7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/1084239450_e76e00b7e7.jpg -------------------------------------------------------------------------------- /faces/10comm-decarlo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/10comm-decarlo.jpg -------------------------------------------------------------------------------- /faces/110276240_bec305da91.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/110276240_bec305da91.jpg -------------------------------------------------------------------------------- /faces/1198_0_861.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/1198_0_861.jpg -------------------------------------------------------------------------------- /faces/137341995_e7c48e9a75.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/137341995_e7c48e9a75.jpg -------------------------------------------------------------------------------- /faces/1383023626_8a49e4879a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/1383023626_8a49e4879a.jpg -------------------------------------------------------------------------------- /faces/144044282_87cf3ff76e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/144044282_87cf3ff76e.jpg -------------------------------------------------------------------------------- /faces/152601997_ec6429a43c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/152601997_ec6429a43c.jpg -------------------------------------------------------------------------------- /faces/1549040388_b99e9fa295.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/1549040388_b99e9fa295.jpg -------------------------------------------------------------------------------- /faces/1878519279_f905d4f34e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/1878519279_f905d4f34e.jpg -------------------------------------------------------------------------------- /faces/2046713398_91aaa6fe1c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2046713398_91aaa6fe1c.jpg -------------------------------------------------------------------------------- /faces/2173711035_dbd53b4f9f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2173711035_dbd53b4f9f.jpg -------------------------------------------------------------------------------- /faces/2210514040_6b03ff2629.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2210514040_6b03ff2629.jpg -------------------------------------------------------------------------------- /faces/2322901504_08122b01ba.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2322901504_08122b01ba.jpg -------------------------------------------------------------------------------- /faces/2327253037_66a61ea6fe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2327253037_66a61ea6fe.jpg -------------------------------------------------------------------------------- /faces/2328398005_d328a70b4c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2328398005_d328a70b4c.jpg -------------------------------------------------------------------------------- /faces/2370961440_6bc8ce346c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2370961440_6bc8ce346c.jpg -------------------------------------------------------------------------------- /faces/2382SJ8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2382SJ8.jpg -------------------------------------------------------------------------------- /faces/252418361_440b75751b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/252418361_440b75751b.jpg -------------------------------------------------------------------------------- /faces/262007783_943bbcf613.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/262007783_943bbcf613.jpg -------------------------------------------------------------------------------- /faces/2633371780_45b740b670.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2633371780_45b740b670.jpg -------------------------------------------------------------------------------- /faces/2647088981_60e9fe40cd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2647088981_60e9fe40cd.jpg -------------------------------------------------------------------------------- /faces/2711409561_a0786a3d3d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2711409561_a0786a3d3d.jpg -------------------------------------------------------------------------------- /faces/2722779845_7fcb64a096.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2722779845_7fcb64a096.jpg -------------------------------------------------------------------------------- /faces/2795838930_0cc5aa5f41.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2795838930_0cc5aa5f41.jpg -------------------------------------------------------------------------------- /faces/2902323565_100017b63c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2902323565_100017b63c.jpg -------------------------------------------------------------------------------- /faces/2902760364_89c50bde40.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2902760364_89c50bde40.jpg -------------------------------------------------------------------------------- /faces/2956581526_cd803f2daa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/2956581526_cd803f2daa.jpg -------------------------------------------------------------------------------- /faces/297448785_b2dda4b2c0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/297448785_b2dda4b2c0.jpg -------------------------------------------------------------------------------- /faces/299733036_fff5ea6f8e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/299733036_fff5ea6f8e.jpg -------------------------------------------------------------------------------- /faces/303808204_1f744bc407.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/303808204_1f744bc407.jpg -------------------------------------------------------------------------------- /faces/3074791551_baee7fa0c1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3074791551_baee7fa0c1.jpg -------------------------------------------------------------------------------- /faces/3152653555_68322314f3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3152653555_68322314f3.jpg -------------------------------------------------------------------------------- /faces/3264867945_fe18d442c1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3264867945_fe18d442c1.jpg -------------------------------------------------------------------------------- /faces/3273658251_b95f65c244.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3273658251_b95f65c244.jpg -------------------------------------------------------------------------------- /faces/3298715079_5af7c78fcb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3298715079_5af7c78fcb.jpg -------------------------------------------------------------------------------- /faces/3325611505_ddc7beffa1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3325611505_ddc7beffa1.jpg -------------------------------------------------------------------------------- /faces/3362762930_24f76cb89c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3362762930_24f76cb89c.jpg -------------------------------------------------------------------------------- /faces/343583208_e986824d77.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/343583208_e986824d77.jpg -------------------------------------------------------------------------------- /faces/3461016494_56cce9c984.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3461016494_56cce9c984.jpg -------------------------------------------------------------------------------- /faces/348272697_832ce65324.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/348272697_832ce65324.jpg -------------------------------------------------------------------------------- /faces/3534188114_2108895291.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3534188114_2108895291.jpg -------------------------------------------------------------------------------- /faces/3534189272_8ef88ba368.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3534189272_8ef88ba368.jpg -------------------------------------------------------------------------------- /faces/3555944509_7b477069c6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3555944509_7b477069c6.jpg -------------------------------------------------------------------------------- /faces/3574737496_6ee8207045.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3574737496_6ee8207045.jpg -------------------------------------------------------------------------------- /faces/362167809_d5a5dcbfdb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/362167809_d5a5dcbfdb.jpg -------------------------------------------------------------------------------- /faces/363149951_8be04dc6c0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/363149951_8be04dc6c0.jpg -------------------------------------------------------------------------------- /faces/3638950581_3387685d3a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3638950581_3387685d3a.jpg -------------------------------------------------------------------------------- /faces/3646828311_bfeb429ef7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3646828311_bfeb429ef7.jpg -------------------------------------------------------------------------------- /faces/3689162471_5f9ffb5aa0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3689162471_5f9ffb5aa0.jpg -------------------------------------------------------------------------------- /faces/3718903026_c1bf5dfcf8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3718903026_c1bf5dfcf8.jpg -------------------------------------------------------------------------------- /faces/3790616528_297c0ac935.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3790616528_297c0ac935.jpg -------------------------------------------------------------------------------- /faces/3855944735_e252959937.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3855944735_e252959937.jpg -------------------------------------------------------------------------------- /faces/3856149136_d4595ffdd4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3856149136_d4595ffdd4.jpg -------------------------------------------------------------------------------- /faces/3872768751_e60d7fdbd5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/3872768751_e60d7fdbd5.jpg -------------------------------------------------------------------------------- /faces/529447797_0f9d2fb756.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/529447797_0f9d2fb756.jpg -------------------------------------------------------------------------------- /faces/57635685_d41c98f8ca.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/57635685_d41c98f8ca.jpg -------------------------------------------------------------------------------- /faces/809285949_6889026b53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/809285949_6889026b53.jpg -------------------------------------------------------------------------------- /faces/92053278_be61a225d2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/92053278_be61a225d2.jpg -------------------------------------------------------------------------------- /faces/96063776_bdb3617b64.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/96063776_bdb3617b64.jpg -------------------------------------------------------------------------------- /faces/97308305_4b737d0873.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/97308305_4b737d0873.jpg -------------------------------------------------------------------------------- /faces/britney-bald.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/britney-bald.jpg -------------------------------------------------------------------------------- /faces/deeny.peggy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/deeny.peggy.jpg -------------------------------------------------------------------------------- /faces/matt-mathes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/matt-mathes.jpg -------------------------------------------------------------------------------- /faces/person-7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/person-7.jpg -------------------------------------------------------------------------------- /faces/person.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/person.jpg -------------------------------------------------------------------------------- /faces/person_TjahjonoDGondhowiardjo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/person_TjahjonoDGondhowiardjo.jpg -------------------------------------------------------------------------------- /faces/personalpic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaoYan/Learning_PyTorch/1270a99e2fa5f2bad25dba31e14e5b1f1bf01091/faces/personalpic.jpg --------------------------------------------------------------------------------