Skip to content

AUREX-ML/ImageClassification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classification Project

This project is a deep learning-based image classification system built with TensorFlow and Keras. It classifies images into two categories: "happy" and "sad". The workflow includes data preprocessing, model training, evaluation, and prediction.

Project Structure

├── data/
│   ├── happy/
│   └── sad/
├── logs/
│   ├── train/
│   └── validation/
├── models/
│   └── imageclassifier.h5
├── notebook.ipynb
├── requirements.txt
└── venv311/
  • data/: Contains subfolders for each class ("happy", "sad") with images for training and validation.
  • logs/: Stores TensorBoard logs for training and validation.
  • models/: Contains the saved Keras model.
  • notebook.ipynb: Jupyter notebook with step-by-step code for data processing, model building, training, evaluation, and testing.
  • requirements.txt: List of required Python packages.
  • venv311/: Python virtual environment.

Main Steps

  1. Install Dependencies
    • TensorFlow, OpenCV, Matplotlib, and other required packages.
  2. Data Cleaning
    • Remove corrupted or unsupported images.
  3. Data Loading & Preprocessing
    • Load images using tf.keras.utils.image_dataset_from_directory.
    • Scale pixel values to [0, 1].
    • Split data into training, validation, and test sets.
  4. Model Building
    • Build a CNN using Keras Sequential API.
  5. Training
    • Train the model with TensorBoard logging.
  6. Evaluation
    • Evaluate model performance using accuracy, precision, and recall.
  7. Testing
    • Test the model on new images.
  8. Saving & Loading Model
    • Save the trained model and demonstrate loading for inference.

Usage

  1. Clone the repository and navigate to the project directory.
  2. (Optional) Create and activate a Python virtual environment.
  3. Install dependencies:
    pip install -r requirements.txt
  4. Place your images in the data/happy/ and data/sad/ folders.
  5. Open and run the Getting Started.ipynb notebook to train and test the model.

Requirements

  • Python 3.11+
  • TensorFlow
  • OpenCV
  • Matplotlib
  • NumPy

All dependencies are listed in requirements.txt.

Model

  • The model is a simple CNN with Conv2D, MaxPooling2D, Flatten, and Dense layers.
  • Trained model is saved as models/imageclassifier.h5.

Logs

  • Training and validation logs are saved in the logs/ directory for visualization with TensorBoard.

License

This project is for educational purposes.

About

Jupyter notebook showing how to build an image classifier with Python and Tensorflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%