A deep learning project that classifies images of Indian classical dance forms using transfer learning with ResNet50.
Dataset: https://www.kaggle.com/datasets/somnath796/indian-dance-form-recognition
- About
- Dance Forms
- Installation
- Dataset Structure
- Usage
- Project Structure
- Results
- Resources
- Troubleshooting
This project uses deep learning to automatically classify images of Indian classical dance forms. It employs transfer learning with a pre-trained ResNet50 model, fine-tuned on a dataset of dance images.
Key Features:
- π¨ Classifies 8 different Indian classical dance forms
- π Uses transfer learning (ResNet50 pre-trained on ImageNet)
- π Includes data exploration and visualization tools
- π Beginner-friendly with extensive documentation
- π Achieves ~85%+ accuracy on test set
The model can classify the following 8 Indian classical dance forms:
- Bharatanatyam - From Tamil Nadu
- Kathak - From Northern India
- Kathakali - From Kerala
- Kuchipudi - From Andhra Pradesh
- Manipuri - From Manipur
- Mohiniyattam - From Kerala
- Odissi - From Odisha
- Sattriya - From Assam
- Python 3.8 or higher
- pip package manager
- (Optional) CUDA-capable GPU for faster training
git clone https://github.com/harshi-puli/Classical-indian-dance-classifier.git
cd Classical-indian-dance-classifier# Create virtual environment
python -m venv natyam
# Activate it
source natyam/bin/activate # On Mac/Linux
# OR
natyam\Scripts\activate # On Windowspip install -r requirements.txtManual installation:
pip install torch torchvision tqdm pandas numpy matplotlib seaborn scikit-learn pillowYour project directory should look like this:
Classical-indian-dance-classifier/
βββ dataset/
β βββ train/ # Training images
β β βββ 1.jpg
β β βββ 2.jpg
β β βββ ...
β βββ test/ # Test images (optional)
β β βββ 501.jpg
β β βββ ...
β βββ train.csv # Training labels
β βββ test.csv # Test labels (optional)
βββ dance_classifier.py # Main training script
βββ explore_data.py # Data exploration
βββ predict.py # Prediction script
βββ requirements.txt # Python dependencies
βββ README.md # This file
CSV Format:
Image,target
1.jpg,kathak
2.jpg,bharatanatyam
3.jpg,odissiFirst, run the exploration script to understand your data:
python explore_data.pyThis will:
- β Show class distribution
- β Check for missing images
- β Analyze image dimensions
- β Generate visualization plots
- β Create sample image grids
Output:
train_class_distribution.pngtest_class_distribution.pngsample_images.png
Run the main training script:
python dance_classifier.pyTraining Process:
- Loads and preprocesses images
- Splits data into train/validation sets (if needed)
- Trains ResNet50 model for 25 epochs
- Saves the best model automatically
- Generates training history plots
Expected Training Time:
- With GPU: ~15-30 minutes
- With CPU: ~2-4 hours
Output:
best_dance_model.pth- Trained model weightstraining_history.png- Loss and accuracy curvesconfusion_matrix.png- Model performance breakdown
Use the trained model to classify new dance images:
python predict.py --image path/to/your/image.jpgExample:
python predict.py --image test/508.jpgOutput:
Prediction: Odissi
Confidence: 92.5%
Top 3 predictions:
1. Odissi - 92.5%
2. Bharatanatyam - 4.2%
3. Kuchipudi - 2.1%
Batch Prediction:
python predict.py --folder test/This will classify all images in the folder and save results to predictions.csv.
βββ dance_classifier.py # Main training script
βββ explore_data.py # Data exploration and visualization
βββ predict.py # Prediction script for new images
βββ prepare_test_csv.py # Helper to create proper train/test split
βββ BEGINNERS_GUIDE.py # Detailed explanations for beginners
βββ VISUAL_GUIDE.py # Visual diagrams and concepts
βββ requirements.txt # Python package dependencies
βββ .gitignore # Git ignore file
βββ README.md # This file
| Metric | Score |
|---|---|
| Training Accuracy | ~95% |
| Validation Accuracy | ~85% |
| Test Accuracy | ~85% |
The model performs best on:
- β Kathak (90%+ accuracy)
- β Odissi (88%+ accuracy)
- β Bharatanatyam (87%+ accuracy)
Common confusions:
- Kathakali β Kuchipudi (similar costumes)
- Mohiniyattam β Bharatanatyam (similar poses)
If you're new to deep learning, check out these guides:
- BEGINNERS_GUIDE.py - Detailed explanations of every concept
- VISUAL_GUIDE.py - Visual diagrams showing how everything works
- What is image classification?
- Neural networks and deep learning
- Transfer learning with ResNet50
- Data augmentation
- Training vs validation vs test sets
Customize training by editing dance_classifier.py:
# Training parameters
BATCH_SIZE = 32 # Reduce if out of memory
NUM_EPOCHS = 25 # Increase for better accuracy
LEARNING_RATE = 0.001 # Adjust learning rateOut of Memory Error
# Reduce batch size in dance_classifier.py
BATCH_SIZE = 16 # or 8Slow Training
# Use smaller model
model = models.resnet18(pretrained=True)Low Accuracy
- Train for more epochs (50-100)
- Add more training data
- Try different learning rates
Module Not Found
source natyam/bin/activate
pip install -r requirements.txtContributions welcome! Areas for improvement:
- Adding more dance forms
- Improving model accuracy
- Creating web interface
- Better visualizations
MIT License - see LICENSE file for details.
Harshini Pulivarthi
- GitHub: @harshi-puli
- Project: Classical-indian-dance-classifier
Made with β€οΈ for preserving Indian classical dance heritage through AI