This project provides a no-code interface for developing image classification models using the TensorFlow framework. Use the setup_and_run script to set up and open the Gradio-based interface, which simplifies the process of developing and testing image classification models.
- Prerequisites
- Getting Started
- Project Structure
- Dataset Structure
- Setup and Run (no code)
- Setup and Run (by Command Line)
- Supported Base Models
- Example
- Troubleshooting
- Contributing
- License
- Python 3.6 or higher
interface.py: The Gradio interface script that provides a web interface for data loading, training, testing, and prediction.data_loader.py: Processes and splits data into training, testing, and validation sets. It also performs data augmentation if enabled by the user.test.py: Contains functions for evaluating the trained model on test data and generating performance metrics.train.py: Includes the logic for training the image classification model, including data preprocessing, model training, and saving the trained model.predict.py: Handles the prediction process, allowing the model to make predictions on new, unseen images.requirements.txt: Lists all the required Python packages for the project.
├── Dataset (Raw)
├── class_name_1
│ └── *.jpg
├── class_name_2
│ └── *.jpg
├── class_name_3
│ └── *.jpg
└── class_name_4
└── *.jpg-
Clone the Repository
If you haven’t already, clone the repository to your local machine:
git clone https://github.com/Purushothaman-natarajan/No-Code-Image-Classifier cd No-Code-Image-Classifier -
Create a Virtual Environment (Optional but Recommended)
It’s a good practice to use a virtual environment to manage your project's dependencies:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Run the Interface Script
Method-1: Click
setup_and_run.bat, and use default setup to start the Gradio interface.Method-2: Install the dependencies:
pip install -r requirements.txt
Execute the
interface.pyscript to start the Gradio interface:python interface.py
This script will:
- Run the
interface.pyscript to start the Gradio interface.
- Run the
-
Access the Gradio Interface
Once the Gradio interface is running, you will see a URL in the terminal. Open this URL in your web browser to access the no-code image classifier interface.
-
Clone the Repository
If you haven’t already, clone the repository to your local machine:
git clone https://github.com/Purushothaman-natarajan/No-Code-Image-Classifier cd No-Code-Image-Classifier -
Create a Virtual Environment (Optional but Recommended)
It’s a good practice to use a virtual environment to manage your project's dependencies:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the Dependencies
pip install -r requirements.txt
-
Run the Scripts
-
Data Loading:
python data_loader.py --path "path/to/raw/dataset" --target_folder "path/to/target/folder" --dim 224 --batch_size 32 --num_workers 4 --augment_data
-
Model Training:
python train.py --base_models VGG16, ResNet50 --shape 224 224 3 --data_path "path/to/processed/dataset" --log_dir "path/to/log/dir" --model_dir "path/to/model/dir" --epochs 100 --optimizer adam --learning_rate 0.0001 --batch_size 32
-
Model Testing:
python test.py --model_path "path/to/trained/model" --model_dir "path/to/model/dir" --img_path "path/to/test/image" --log_dir "path/to/log/dir" --test_dir "path/to/test/dir" --train_dir "path/to/train/dir" --class_names "class1,class2,class3"
-
Prediction:
python predict.py --model_path "path/to/trained/model" --img_path "path/to/image" --train_dir "path/to/train/dir"
-
The following base models are supported for training:
- VGG16
- VGG19
- ResNet50
- ResNet101
- InceptionV3
- DenseNet121
- MobileNetV2
- Xception
- InceptionResNetV2
- EfficientNetB0
Here's an example workflow that demonstrates how to use the scripts for data loading, model training, testing, and prediction.
-
Data Loading:
- With Data Augmentation:
python data_loader.py --path "path/to/raw/dataset" --target_folder "path/to/target/folder" --dim 224 --batch_size 32 --num_workers 4 --augment_data
- Without Data Augmentation:
python data_loader.py --path "path/to/raw/dataset" --target_folder "path/to/target/folder" --dim 224 --batch_size 32 --num_workers 4
- With Data Augmentation:
-
Model Training:
python train.py --base_models VGG16,ResNet50 --shape 224 224 3 --data_path "path/to/processed/dataset" --log_dir "path/to/log/dir" --model_dir "path/to/model/dir" --epochs 100 --optimizer adam --learning_rate 0.0001 --batch_size 32
-
Model Testing:
python test.py --model_path "path/to/trained/model" --model_dir "path/to/model/dir" --img_path "path/to/test/image" --log_dir "path/to/log/dir" --test_dir "path/to/test/dir" --train_dir "path/to/train/dir"
-
Prediction:
python predict.py --model_path "path/to/trained/model" --img_path "path/to/image" --train_dir "path/to/train/dir"
- Dependencies Issues: If you encounter issues with installing dependencies, ensure you have the correct version of Python and try running the
run.pyscript again. - Script Errors: If you encounter errors while running
interface.py, check the script for any missing or misconfigured paths.
Feel free to fork the repository and submit pull requests. For any issues or feature requests, please open an issue on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for more details.
