Welcome to the Custom Image Classifier! This guide will walk you through setting up and using the framework.
- Python 3.8 or higher
- pip (Python package manager)
- 4GB+ RAM (8GB+ recommended)
- Optional: CUDA-compatible GPU for faster training
git clone https://github.com/iad1tya/custom-image-classifier.git
cd custom-image-classifierOn macOS/Linux:
python3 -m venv venv
source venv/bin/activateOn Windows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtThis will install:
- Flask (web framework)
- PyTorch (deep learning)
- OpenCV (image processing)
- And other necessary libraries
python app.pyThe application will start on http://localhost:5000
- Open
http://localhost:5000in your browser - Click "➕ New Project"
- Enter a project name (e.g.,
dog_breeds,plant_classifier) - Add an optional description
- Click "Create"
Organize your images into folders by class:
my_dataset/
├── class1/
│ ├── image1.jpg
│ ├── image2.jpg
│ ├── image3.jpg
│ └── ...
├── class2/
│ ├── image1.jpg
│ ├── image2.jpg
│ └── ...
└── class3/
├── image1.jpg
└── ...
Tips:
- Use clear, descriptive folder names (these become your class labels)
- Include at least 50-100 images per class for good results
- Images should be clear and representative of the class
- Supported formats: JPG, PNG, GIF, BMP
- Click "📤 Upload Dataset"
- Select your project from the dropdown
- Either:
- Zip your dataset folder and upload it, OR
- Upload individual images and specify the class name
- Wait for upload to complete
- You'll see confirmation with detected classes
- Go back to the home page
- Find your project card
- Click "Train" button
- Training will start in the background
- Depending on your dataset size and hardware:
- Small datasets (<1000 images): 2-10 minutes
- Medium datasets (1000-5000 images): 10-30 minutes
- Large datasets (5000+ images): 30+ minutes
Training Progress:
- Training happens in a separate process
- Check the terminal/console for real-time progress
- You'll see epoch updates and loss/accuracy metrics
Once training is complete:
- Click "🔮 Make Prediction"
- Select your trained model
- Choose to either:
- Upload an image from your computer, OR
- Use your webcam to capture an image
- Click "Predict"
- View results with confidence scores for all classes
animals/
├── dog/
├── cat/
├── bird/
└── fish/
plant_diseases/
├── healthy/
├── rust/
├── powdery_mildew/
└── blight/
products/
├── electronics/
├── clothing/
├── food/
└── toys/
documents/
├── invoice/
├── receipt/
├── contract/
└── letter/
- ✅ Use high-quality, clear images
- ✅ Include variety within each class
- ✅ Balance the number of images across classes
- ❌ Avoid blurry or corrupted images
- ❌ Don't include irrelevant images
- Start with default settings (10 epochs)
- If accuracy is low, try:
- Adding more training images
- Increasing epochs to 20-30
- Ensuring better class balance
- If training is too slow:
- Reduce image count
- Use a GPU if available
- Reduce batch size
- Test your model with new images (not from training set)
- If predictions are poor:
- Add more diverse training images
- Retrain with more epochs
- Check if classes are too similar
- Ensure training data represents real-world scenarios
- Click "Retrain" on any project card
- Useful after adding more training data
- Previous model will be overwritten
- Click "Delete" on the project card
- This removes all data and models (cannot be undone!)
- Use with caution
# Make sure you're in the virtual environment
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
# Reinstall dependencies
pip install -r requirements.txt# Reduce batch size in training
# Edit scripts/train_model.py, reduce DEFAULT_BATCH_SIZE- Ensure training completed successfully
- Check terminal for training errors
- Retrain the project
- GPU not detected: Check PyTorch CUDA installation
- Use smaller images: Images are resized to 128x128 automatically
- Reduce epochs: Start with 5-10 epochs for testing
- 80-100%: Very confident prediction
- 60-80%: Confident prediction
- 40-60%: Uncertain prediction
- <40%: Low confidence (model unsure)
- Loss: Lower is better (measures error)
- Accuracy: Higher is better (percentage correct)
- Expect improvement over epochs
Edit scripts/train_model.py to adjust:
- Number of epochs
- Learning rate
- Batch size
- Image size
- Data augmentation settings
Use the REST API to integrate with other applications:
import requests
# Make prediction
files = {'image': open('test.jpg', 'rb')}
data = {'project_name': 'my_project'}
response = requests.post('http://localhost:5000/api/predict', files=files, data=data)
print(response.json())- Check the main README.md for more details
- Open an issue on GitHub
- Review the code comments for technical details
Ready to classify? Start with your first project now! 🎉