Skip to main content

Python package for creating Image classifiers

Project description

ImageClassifier

ImageClassifier is a python package for creating Image classifiers with the help of CNNs.

Installation

Use the package manager pip to install ImageClassifier.

pip install image-classifier

Data format

First you need to create or download the images and save them in a folder in their corresponding label folders.

example folder structure:

data-->
    apple-->
        (images related to apple)
    banana-->
        (images realated to banana)

here "data" is the main folder, "apple" and "banana" are the label folders which have their corresponding images related to them.

[NOTE]: You can create as many label folders as you want but they should have their corresponding images.

Usage

To create a Image classifier :-

Creating the data and model.

from ImageClassifier import CreateDataAndModel

main = CreateDataAndModel(file_path="./data/", model_file_name_to_save="model.hdf5", init_lr=0.0001, epochs=100, batch_size=32)

# Here "./data/" is the data folder where we have the label folder- "apple" and "banana" (Remember to include a "/" after the folder like "./data/" ). Basically, you have to give the data folder path where you have the label folders, it can also be like "./seg_pred/seg_pred/".   

main.create() # This will create the data and the model for you.

Running the image classifier to predict a single image.

from ImageClassifier import Run

r = Run(model_file_name="model.hdf5") # The model file in your current directory

img_to_predict = "./example_dir/example.jpg"

pred = r.run(img_to_predict)

print(pred)

Output

apple

Running the image classifier to predict multiple images.

import os

r = Run("model.hdf5")

file_path = "./seg_pred/seg_pred/"

for file in os.listdir(file_path):
  pred = r.run(file_path + file)
  print(pred)

Output

apple
banana
banana
apple
banana

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

See the source code here /image-classifier/ImageClassifier/

Data types

You can use any type of images for creating data like- jpeg, png etc. Even mixed!!!

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image-classifier-0.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

image_classifier-0.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page