From bb48a7402248931a1a0af6a68958babd51d9d40e Mon Sep 17 00:00:00 2001 From: Chaitanya Sri Krishna Lolla Date: Thu, 28 Mar 2019 16:33:13 -0700 Subject: [PATCH] Update README.md --- README.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cac470d..4e3e5bb 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,34 @@ -# fruit-classification-pytorch -Fruit classification using Kaggle Dataset [Fruit-360](https://www.kaggle.com/moltean/fruits) in pytorch +# Fruit Classifier using Pytorch +Fruit classification using Kaggle Dataset [Fruit-360](https://www.kaggle.com/moltean/fruits) in pytorch. +This repository contains some code on : +a) Creation of custom dataset using pytorch. Look at fruit.py to understand how the custom dataset can be prepared from a set of training and test images. +b) Creation of a Network in pytorch which is simplier to create and try out any changes to it. +c) Easy to train and test. -## How to run the test -Make sure to download the directory in a folder. +# Training and Validation of Fruit-360 dataset. -First load the datasets into npy files. +## Step 1 +The same concept applies to all different kinds of datasets. +Firstly, load all the images that are downloaded from the above link and convert them into npy files. +Advantage of using npy files is to use only 4 files named train_data.npy, train_labels.npy and validation_data.npy , validation_labels.npy +rather than using thousands of files for pre-processing. + +To convert your training and validation dataset into npy files use the below script. ``` python load_dataset.py --dataset-dir ``` + This creates train_data.npy, train_labels.npy, validation_data.npy, validation_labels.npy -Using this, train and test the fruit dataset using train.py +## Step 2 +Use the dataset files that are created above, train the fruit classifier and evaluate the model. ``` -python train.py --data-dir +python train.py --data-dir [--epochs ] ``` +This generates a log that trains the network for each epoch and finally do inference against the validation dataset spits out the validation accuracy. + +