Keras28Models Package for Transfer Learning

Keras28 Models This is my Python package for easy build deep learning applications by using transfer learning pre trainined 28 models in easy few line code. to avoid wasting time scripting in your deep learning

photo from dasca.org splash

in this story we will learn how to using keras28models python package for easy way to training custom dataset by usig 28 keras transefer learning pre-trainined models by using one code line .

You can read about keras models in complex code scriptining keras document for Models API .that is easy code for training your custom dataset in faster code not complex scripting code. more than 25% of time spent on deep learning projects is collecting and cleaning data and building convolution neural network (CNN)..but this package is very easy for images classifiction and recognition application and save final weights models .and compare all pre trainined models results for choice the best accurecy one convert results to DataFrame for easy viewing…(CSV format file spreadsheet) contains model name and number model parameters and validation accurcy ..and final code it is plot the num model params vs validation_accuracy for choosing benchmark.

Note

The training of the Keras28Models Package will be on Google Colab because it was previously prepared for all training libraries deep learning and away from the problems of installation troublesome libraries. and i’m using and test it for chest X-Ray Pneumonia dataset from kaggle .step by step and u must load kaggle.json API For your account to get and full access X-Ray images dataset…i will explain it in small script to load it

step-1

load and install package in colab

!pip install Keras28Models==0.1.0

Step-2

load and install kaggle libraries and module

!pip install -q kaggle

Step-3

load kaggle.json from API account to access full dataset

! mkdir ~/.kaggle
! cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json

Step-4

load dataset from kaggle

!kaggle datasets download -d paultimothymooney/chest-xray-pneumonia

Step-5

unzip compressed dataset from zip file

!unzip /content/chest-xray-pneumonia.zip

Step-6

load keras28models library to training your custom dataset in quickly script code and few Initialization parameter for training models.

from keras28models import models28 as k28m
batch_size=32 # batch size for custom dataset
train_path=’/content/chest_xray/chest_xray/train’ # path for training dataset
valid_path=’/content/chest_xray/chest_xray/val’ # path for validation dataset
num_class=2 # class number here for chest x-ray diseses NORMAL or PNEUMONIA
epochs=2 #epoch number for traiing

Step-7

call function to training dataset into 28 models in one code

k28m.models_fgs28(batch_size,train_path,valid_path,num_class,epochs)

full script

from keras28models import models28 as k28m
batch_size=32
train_path=’/content/chest_xray/chest_xray/train’
valid_path=’/content/chest_xray/chest_xray/val’
num_class=2
epochs=2
k28m.models_fgs28(batch_size,train_path,valid_path,num_class,epochs)

you will see progree bar for ever download pre trainined model and name it and begin for training custom dataset very fast and save all models name with theri weights parameters into spreadsheet csv file contains model name and number model parameters and validation accurcy ..and final code it is plot the num model params vs validation accuracy for choosing best benchmark.with graph for all models

spreadsheet file contain model name ,model parameters and validation accuracy
graph for all models Accuracy vs Model Size

and every finishing training .the code will saving finishing weights with keras format to choose the best file for evaluation or for deploy in application

all the code and original file is located at Google Colab

and the pakage module in PyPi

thanks for reading If you love this tutorial, give some claps.

Connect with me on FB ,Github ,linkedin,my blog ,PyPi,Google Store Play,my youtube channel

Email :falahgs07@gmail.com

Developer Programmer, in Python and deep learning. IOT Microcontroller Developer iraqprogrammer.wordpress.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store