music art image-classification en dataset:ccmusic-database/music_genre license:mit region:us
---
license: mit
datasets:
- ccmusic-database/music_genre
language:
- en
metrics:
- accuracy
pipeline_tag: image-classification
tags:
- music
- art
---

The music genre classification model is fine-tuned based on a pre-trained model from the computer vision (CV) domain, aiming to classify audio data into different genres. During the pre-training phase, the model learns rich feature representations using a large-scale dataset from computer vision tasks. Through transfer learning, these learned features are applied to the music genre classification task to enhance the model's performance on audio data. In the fine-tuning phase, an audio dataset containing 16 music genre categories is utilized. These audio samples are first transformed into spectrograms, converting the temporal audio signal into a two-dimensional representation in the time and frequency dimensions. The spectrogram representation captures the temporal evolution of different audio frequencies, providing the model with rich information about the audio content. Through fine-tuning, adjustments are made to the pre-trained model to meet the requirements of the music genre classification task. The model learns to extract features from spectrograms that are relevant to music genre, enabling accurate classification of audio samples. This process enables the model to recognize and infer music genres, such as rock, classical, pop, among others. By combining a pre-trained model from the computer vision domain with an audio task, this approach leverages cross-modal knowledge transfer, demonstrating the adaptability and effectiveness of pre-trained models across different domains.

## Maintenance
```bash
GIT_LFS_SKIP_SMUDGE=1 git clone git@hf.co:ccmusic-database/music_genre
cd music_genre
```

## Results
A demo result of VGG19_BN fine-tuning:

<style>
  #pianos td {
    vertical-align: middle !important;
    text-align: center;
  }
  #pianos th {
    text-align: center;
  }
</style>
<table id="pianos">
    <tr>
        <th>Loss curve</th>
        <td><img src="https://huggingface.co/ccmusic-database/music_genre/resolve/main/vgg19_bn_cqt_16cls_2024-01-11_15-40-42/loss.jpg"></td>
    </tr>
    <tr>
        <th>Training and validation accuracy</th>
        <td><img src="https://huggingface.co/ccmusic-database/music_genre/resolve/main/vgg19_bn_cqt_16cls_2024-01-11_15-40-42/acc.jpg"></td>
    </tr>
    <tr>
        <th>Confusion matrix</th>
        <td><img src="https://huggingface.co/ccmusic-database/music_genre/resolve/main/vgg19_bn_cqt_16cls_2024-01-11_15-40-42/mat.jpg"></td>
    </tr>
</table>

## Mirror
<https://www.modelscope.cn/models/ccmusic/music_genre>

## Reference
[1] <https://github.com/monet-joe/ccmusic_eval>