Skip to content

Behdad-kanaani/SampleCNN-Image-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎉 SampleCNN – Easy Object Detection AI 🖼️🤖

License Python PyTorch Issues

This is Sample CNN Classification AI for object detection using PyTorch.

This is a really simple sample project, but super helpful if you want to start learning object detection. Very easy AI type to test and play with. 🚀✨


🌟 Project Vibes


Behdad-kanaani/SampleCNN-Image-Classification//
│
├── dataset/
│   ├── train/   # Put your training images here! 📸
│   └── val/     # Put your validation images here! ✔️
│
├── sample_cnn.py  # The main magic script ✨
└── README.md      # You’re already here 😉

  • Organize images in class subfolders
  • Works for binary classification, but you can expand it

⚡ Getting Started (Quick & Easy)

  1. Clone this repo:
git clone git@github.com:Behdad-kanaani/SampleCNN-Image-Classification.git
cd SampleCNN-Image-Classification
  1. Make a virtual environment:
python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows
  1. Install PyTorch and Torchvision:
pip install torch torchvision

🤖 How the Model Works

  • 3 Convolutional Layers + ReLU + MaxPool
  • Fully Connected Layers: Flatten → 128 → 2 classes
  • Input: 224×224×3 images
  • Output: Scores for 2 classes

Super simple, easy to tweak, easy to test. 💡


🚀 Training – Let’s Go!

  • Batch size: 32
  • Epochs: 10 (or more if you want)
  • Loss: CrossEntropyLoss
  • Optimizer: Adam with lr=0.0001
python sample_cnn.py

Sample output:

Epoch 1/10, Loss: 0.6934
Epoch 2/10, Loss: 0.5123
…

🏆 Validation – Custom Dataset Results

How well did our SampleCNN perform?

Metric Result
🎯 Accuracy 89.79%

89.79% Accuracy

These results are calculated on My Personal DataSet.
Keep experimenting with your data and hyperparameters to boost performance! 🚀

💡 Tip: Generally, the more images you include in your dataset, the better your model can learn and distinguish patterns. Training for more epochs can also help improve accuracy, but make sure not to overfit!

⚠️ Note: The dataset is not included in this repository. Please provide your own images in the dataset/train and dataset/val folders to run the model. 🖼️


🔧 Customize & Play

  • Set Your datasets 🖼️
  • Adjust hyperparameters ⚡
  • Make it multi-class 🌈
  • Experiment and have fun! 😎

📜 License

This project is licensed under GNU Affero General Public License v3.0 (AGPL-3.0).

  • ✅ You can use, share, and modify the code freely
  • ❌ If you deploy this project or modify it, you must make your changes public

🌈 Shoutouts & Thanks

Donation

Help Me To improve it In Issue Section

If you want, I can also add cool status badges for model training, downloads, or coverage to make it look like a professional AI project!

About

A simple Convolutional Neural Network (CNN) implemented in PyTorch for binary image classification. This repository demonstrates training, validation, and evaluation of a CNN on a custom image dataset using PyTorch and Torchvision.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages