Giter Site home page Giter Site logo

hafizurcse / progressive-resizing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hafizurmeldcx/progressive-resizing

0.0 0.0 0.0 3.69 MB

Applying progressive resizing to building models in Keras.

Home Page: https://towardsdatascience.com/boost-your-cnn-image-classifier-performance-with-progressive-resizing-in-keras-a7d96da06e20

Dockerfile 0.06% Shell 0.08% Python 0.45% Jupyter Notebook 99.42%

progressive-resizing's Introduction

progressive-resizing

This repository contains the code for building a convolutional neural network machine learning classifier in three parts. It is the companion repo for the article "Boost your CNN performance with progressive resizing in Keras".

The three components are:

  • A first model that works on 48x48 images.
  • A second model that works on 96x96 images.
  • A final model that works on 192x192 images.

The resultant model is a "three layer cake": each larger-scale model subsumes the previous smaller-scale model layers and weights in its architecture.

This approach is meant to demonstrate a workflow and technique for building neural networks known as "progressive resizing". Progressive resizing has been used to good effect by Jeremy Howard, who used to achieve a top 10% finish in the Planet Kaggle Competition, and he uses it throughout his fast.ai course "Practical Deep Learning for Coders".

The data

This project uses the "Open Fruit" dataset, a dataset of fruit images taken from Google's Open Images Dataset.

You can download the data for yourself from the source data package on Quilt T4:

$ pip install -U t4
$ python -c "import t4; t4.Package.install('s3://quilt-example', 'quilt/open_fruit', './')"

Alternatively, to build this data from source again (warning: this takes a long time!):

$ git clone https://github.com/quiltdata/open-images.git
$ cd open-images/
$ conda env create -f environment.yml
$ source activate quilt-open-images-dev
$ pip install -e ./src/openimager/
$ python -c "import openimager; openimager.download(['Apple', 'Grape', 'Orange', 'Pomegranate', 'Banana', 'Grapefruit', 'Peach', 'Strawberry', 'Cantaloupe', 'Lemon', 'Pear', 'Tomato', 'Common fig', 'Mango', 'Pineapple', 'Watermelon'])"

The run the code in the build-dataset.ipynb notebook to generate the final cropped images.

To learn more about using Google Open Images for building new datasets, see "How to classify photos in 600 classes using nine million Open Images".

The models

The build-models.ipynb notebook is the notebook where I work through the model definitions. The actual model builds were executed using the fahr remote training CLI, which I have been building side-by-side with this project. To model resources are in the various resnet* folders in this repository.

Note that you can execute setup.sh to install the required resources (a recent version of keras-preprocessing, fahr, etc.).

progressive-resizing's People

Contributors

residentmario avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.