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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file image-classifier-0.0.1.tar.gz
.
File metadata
- Download URL: image-classifier-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96a325be3bf853bda2b92936ace821456452f49110512f08421177e95376c0ff |
|
MD5 | 613cbb5e91f1a5d57bfbb629f99f0f43 |
|
BLAKE2b-256 | 0ec5f6de1b4f1b1ae6bf85d250a7386205ee40dbc018c6cb05b70c4ccd10b439 |
File details
Details for the file image_classifier-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: image_classifier-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0afd2408d6280b9c20351cad3dd10ebb5aa5ee8ff6b848c0a3ccefd2f16791e9 |
|
MD5 | 499afa2b57fadee784185489172b105d |
|
BLAKE2b-256 | b77e9cee30610c8fc02140c2d26286c919fd39c913e2a109eb030d8de07db08b |