Git Product home page Git Product logo

imagereader_w_data_augmentation's Introduction

A simplified approach to Data Augmentation for Computer Vision applications using python.

(Please bear with me, I’m still a beginner in deep learning and this is my first upload to GitHub, I don’t know the way of the hub)
After doing a lot of mini projects, I realized the need to have a generalized input pipeline for machine learning models involving images. Further, I wanted to streamline data augmentation by creating certain common and easy to use image transformations.
This library is my solution to the problems posed above. I acknowledge that there will many bugs in the code provided. Also, the code may not have followed the best design philosophies. I welcome all changes to my repo. The class ImageReader serves to provide all of image reading and data augmentation functionalities in minimal lines of code.
Here is an example to show just how easy it is:

tfms = [Horizontal_flip(), Vertical_flip(), Gaussian_blur(3),
       Crop_and_resize(do_crop=False, sz=(300, 300))]
imr = ImageReader(PATH_TO_IMAGES, transforms=tfms)
image = imr.read_image_random()

This will read an image from the given path with random transformations applied each time an image is read.

The `ImageReader` class provides certain convenience functions:
`read_image_from_id(self, ID)`: reads an image specified by ID.
`read_image_from_idx(self, idx)`: reads an image from specified index from a list of all files in `PATH_TO_IMAGES`
`read_image_random(self)`: reads and returns a random image from `PATH_TO_IMAGES`
`show_by_id(self, ID)`: Displays image specified by ID
`show_random(self)`: Displays a random image from `PATH_TO_IMAGES`

Here, OpenCV is primarily used to read images and perform most transformation operations.

The file aug_transforms.py includes certain common transformations used in computer vision and their appropriate documentation is included in the functions.
The file Transformer.py provides a Transformer class that is used by the ImageReader class. It can be used to create objects that transform images read as numpy arrays. You can pass any number of your own transformations that behave as specified in the Transformer class’ documentation.

A typical way to use this library would be as follows:

from ImageReader import *

tfms = [Horizontal_flip(), Vertical_flip(), Gaussian_blur(3),
        Crop_and_resize(do_crop=False, sz=(300, 300))]
imr = ImageReader(PATH_TO_IMAGES, transforms=tfms)
image = imr.read_image_random()



Dependencies:
OpenCV, skimage, Numpy, Matplotlib, os.

Use as you please :-)

imagereader_w_data_augmentation's People

Contributors

akashpalrecha avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

zcyroot

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.