This Instrument Classification project uses Convolutional Neural Networks (CNN) to classify musical instruments from audio data. .wav files are converted into spectrogram images, which serve as input to the CNN classifier. The model achieved a training accuracy of 99% and a validation accuracy of 74%.
- Dataset
- Features
- Tech Stack
- Installation
- Usage
- Project Structure
- Results
- Sample Spectrograms
- Contributing
- License
We used the IRMAS dataset for instrument recognition in musical audio signals. The dataset includes various instruments and provides labeled audio files (.wav) used for classification.
- Data Preprocessing: Converts .wav audio files into spectrogram images.
- CNN Model: A CNN-based classifier that trains on spectrograms to classify instruments.
- High Accuracy: Achieved 99% training accuracy and 74% validation accuracy.
- Framework: Python, Jupyter Notebook
- Deep Learning: TensorFlow/Keras (for CNN model)
- Environment Management: Conda
- Data: IRMAS dataset (converted into spectrograms)
Ensure you have the following installed:
- Anaconda for managing the environment.
-
Clone the repository:
git clone https://github.com/yourusername/instrument-classification.git cd instrument-classification
-
Create and activate the Conda environment:
conda env create -f environment.yml conda activate instrument-classification
-
Download the IRMAS dataset:
- Download the dataset from IRMAS on Zenodo.
- Place the dataset in the project’s data directory as instructed in the project structure.
-
Start Jupyter Notebook:
jupyter notebook
Open
instrument_classification.ipynb
in the Jupyter interface to view and run the code.
- Data Conversion: The notebook includes code to convert .wav files into spectrogram images.
- Model Training: Run the provided cells to train the CNN on the spectrograms.
- Classification: The model will classify new spectrograms with the trained CNN.
├── data # Folder for the IRMAS dataset
├── notebooks # Jupyter notebooks
│ └── instrument_classification.ipynb
├── models # Saved models (if any)
├── spectrograms # Generated spectrogram images
├── images # Folder for sample spectrogram images
├── environment.yml # Conda environment configuration
└── README.md # Project documentation
- Training Accuracy: 99%
- Validation Accuracy: 74%
- Model Performance: While training accuracy is high, validation accuracy can be improved with further tuning or data augmentation.
These images represent different instruments in the dataset, transformed from audio files to spectrogram format for the CNN model.
- Fork the repository.
- Create your branch:
git checkout -b feature/YourFeature
. - Commit your changes:
git commit -am 'Add new feature'
. - Push to the branch:
git push origin feature/YourFeature
. - Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.