CNN to classify music notes
This is the main part of our pipeline in our Music Sheet Classifier
We take an inputted music sheet, and do the following process.
- We process the image, and ensure that it is a music sheet
- We normalize it through greyscale and other image processing techniques using our ImageProcessing repository.
- We use cv2 to help remove stafflines from the image, and then use cv2 to apply morphological closing to clean up the notes that were missing pixels.
- Then, using the reconnected image of the notes without staffs, we go through the possible groupings of boxes and box up notes, filtering out possible non-notes that are either too big or too small.
- Once we have isolated an individual note, then we input that image of the "note" into this CNN, where it is then classified into one of 5 classes.
- With that classification, we can then perform even more indepth analysis on the other structures of each note, as well as use it combined with every note to analyze the entire sheet
- Using this classification, we can also output sounds according to each note as well
[ FILES AND THEIR FUNCTIONS ]
- cnn_model.py -> This is the format of the CNN being used, it is here so that the evaluate.py file can import it easily without needing to change it distinctly
- main.py -> This is the main pipeline for the image-processing to CNN to output of the CNN file.
- train.py -> This is the main training file for the CNN, this is where the dataset is imported and then split into an 80/20
[ DATASET DETAILS ]
- The dataset being used in this training process is provided by Kaggle, and it is a dataset of 5000 music notes, 1000 of each class.
- The CNN is trained on 80% of this dataset, and that way the rest of it can be used for testing to see how accurate the CNN is.
[ DOCUMENTATION USED ]
- https://pytorch.org/
- https://docs.pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html
- https://www.geeksforgeeks.org/deep-learning/building-a-convolutional-neural-network-using-pytorch/
- https://analyticsvidhya.com/blog/2020/02/learn-image-classification-cnn-convolutional-neural-networks-3-datasets/