Posts

Day 5: Transfer learning - impact of the number of hidden layers 1

In one of discussion with my fellow scholars, I want to find out the effect of number of hidden layers defined in a model. Some says 2 or 3 hidden layers is the number of optimum hidden layers. The larger the number of hidden layer, the more your model will overfit the data, and can't generalize any solution. That mean you will get a higher loss. The larger number take more time to train your model too. The lesser number of hidden layer cause underfitting. I want to check that by modifyng the Lesson 2 Part 8 code. First prepare the trainloader and testloader data. %matplotlib inline %config InlineBackend.figure_format = 'retina' import time import matplotlib.pyplot as plt import torch from torch import nn from torch import optim import torch.nn.functional as F from torchvision import datasets, transforms, models data_dir = 'Cat_Dog_data' # Define transforms for the training data and testing data train_transforms = transforms.Compose([transforms....

Day 4: Transfer learning 2 - Running and exploring the code

Today, I am running the sample solution on the Lesson 2 Part 8 Transfer learning. I exercised different pre trained network such as resnet101 and densenet121. I came up with this problems, data_dir = 'Cat_Dog_data' # TODO: Define transforms for the training data and testing data train_transforms = transforms.Compose([transforms.RandomRotation(30),                                       transforms.RandomResizedCrop(224),                                       transforms.RandomHorizontalFlip(),                                       transforms.ToTensor(),                                       transforms.Norma...

Day 3: Transfer learning 1 - Introduction

update for data augmentation questions yesterday, After discussion with @Arka, @Anna Scott and @George Christopoulus, my understanding of data augmentation would be the transforms we applied to the dataset will not increase the size of the dataset. The data augmentation is process to vary the dataset with applied transformation such as random resize, random crop, random horizontal flipping, and many other transformations functions. The increasing number of dataset would be done by caling the loaded model in iteration. The applied transform functions would return the copy of dataset differently in each iteration. I just need to find out on how it is actually done. The iteration process. Let see if I can found out today on the transfer learning process. Today, I want to learn about transfer learning. What is transfer learning, from this article , Transfer learning is a machine learning technique where a model trained on one task is re-purposed on a second related task. Or simply...

Day 2: Data augmentation

I admit that my sample images for jars are too few. However, using data augmentation technique I can increase the sample images. What is data augmentation? Data augmentation is an automatic way to boost the number of different images you will use to train your Deep learning algorithms. A good simple definition taken from here . Reading this article, I can get a good understanding of the data augmentation. But still, taking the context to pytorch, I am still confused to generate thousands images from 48 images. Below are the lines of code that augmenting the training data (Lesson 2 Part 7), train_transforms = transforms.Compose([transforms.RandomRotation(30),                     transforms.RandomResizedCrop(224),                     transforms.RandomHorizontalFlip(),                     transforms.ToTensor()]) train_data =...

Day 1: Explore loading model code

Image
Yesterday, I started with running dog classification project. However, I found out the Lesson 2 Deep Learning with PyTorch: 21 Loading image was more suitable as the basis to study the code. Today, I revisit the material on Lesson 2: 21 Loading image. Images are the real high quality images, but probably in different sizes. The first step would be to make this images have the same sizes and probably crop them as well using transforms compose. In the example,  transform = transforms . Compose ([ transforms . Resize ( 255 ), transforms . CenterCrop ( 224 ), transforms . ToTensor ()]) I think I need to ask this in tech_help channel, Resize and CenterCrop which one is executed first and 255 and 224 is pixel or other? Quick help from the channel. It make sense now. Running Part 7 exercise locally, I got an error on torchvision. It seemed yesterday code to install pytorch was not correct. Below ...

Day 0: Preparation day

Image
This journey started when I received the "You have been accepted into the Secure and Private AI Scholarship Challenge Program" email. One of the challenge in this project is to code in 60 days. My project would be Jar Classification Machine . Let us see if I can manage to implement further up to a mobile application. The project is similar to dog and cat classification. But this time, I want to classify the jars according to its model and brand. My dream is to have a visual scanner mobile app, a kind of barcode reader but this time just by take the photo of a jar. Why it is a dream, because I don't think I can manage to finish by having a fully working mobile app. I just want to take a step by step to achieve that, it may take more than 60 days, but I do not care. The progress is the important thing. Today is preparation day. First I setup this blog to record all activities. I chose blogspot for the sake of simplicity. In just few minutes it can be run. I unders...