boostcamp 4th NLP Final Project :
์์ ์ฝํ
์ธ ๋ง์ถคํ BGM ์์ฑ
๊น๊ฑด์ฐ
: ๋ชจ๋ธ ํ์ต, ํ์ดํ๋ผ์ธ ์ค๊ณ, Riffusion
๋ฐฑ๋จ์ต
: ๋ชจ๋ธ ์ค๊ณ ๋ฐ ๋ถ์, whisper
์์ฉ์ฐฌ
: ๋ชจ๋ธ ์ค๊ณ ๋ฐ ๋ถ์, ๊ฐ์ฑ๋ถ๋ฅ
์ด์ฌ๋
: Frontend, Backend, ์ํคํ
์ฒ, Riffusion
์ ์ํฌ
: Backend, ์ํคํ
์ฒ
1์ธ ๋ฏธ๋์ด ์์ฅ ๊ท๋ชจ๊ฐ ์ฑ์ฅํ๊ณ ์์ผ๋ฉฐ, ๋์์ ์ฝํ ์ธ ์ ์์ ๋น์ค์ด ๋๋ถ๋ถ์ด๊ณ ์ด์ ๋ฐ๋ผ BGM ์์ ๋ํ ์ฆ๊ฐํ๊ณ ์๋ค. ๊ทธ๋ฌ๋, ๋์ด๋๋ ๋์์ ์์์๋ ๋ฌ๋ฆฌ, ์์์ ์์ ํ์ฉ ๊ฐ๋ฅํ BGM ์ ๊ฒฝ์ฐ ์ ํ์ฌํญ(์ ์๊ถ ๋ถ์๊ณผ ๋ก์ดํฐ ๋น์ฉ ๋ฑ)์ด ๋ง์ด ์กด์ฌํ๋ฉฐ ์ด ๋ถ๋ถ์ ํด๊ฒฐํ๊ณ ์ AI ๊ธฐ๋ฐ ์์ ์์ฑ ๋ชจ๋ธ์ ํ์ฉํ์ฌ ์ ์๊ถ ์๋ BGM์ ์ ๊ณตํ๊ณ ์ ํ๋ค.
๋์์์ ์ ๋ ฅํ๋ฉด, ํด๋น ๋์์์ผ๋ก๋ถํฐ ๋ด์ฉ์ ์ถ์ถํ์ฌ ๊ฐ์ฑ ๋ถ์ ํ, ์ฝํ ์ธ ๋ด์ฉ์ ๋ง๋ ๊ฐ์ฑ์ ๋ถ๋ฅํ์ฌ ์ด๋ฅผ ๋ฐํ์ผ๋ก riffusion ๋ชจ๋ธ์ ์ ์ฉํ์ฌ BGM์ ์์ฑํ๊ณ ์ ํ๋ค.
Speech-to-Text
- Openai์ Whisper model์ ์ฌ์ฉํ์ฌ ์ ์ฒด ๋ฐํ ๋ด์ฉ์ ํ ์คํธ๋ก ์ถ์ถ.
WHISPER ๋ชจ๋ธ ์ฌ์ฉ ์ด์ :
- SPEECH RECOGNITION์์ SOTA๋ก ์ฌ์ฉ๋๋ wav2vec 2.0 ๋๋น ํ๊ท ์ ์ผ๋ก 55.2% ๋ฎ์ ์ค๋ฅ์จ์ด๋ผ๋ ์ฐ์ํ ์ฑ๋ฅ์ ๊ฐ์ก์.
- Any-to-English speech translation multitask ๊ธฐ๋ฅ์ ์ ๊ณตํ๊ธฐ์, STT์ ๋ฒ์ญ๊ธฐ๋ฅ์ ํจ๊ป ์ฌ์ฉํ ์ ์์ด ์ถํ ์๋ฌธ ๋ฐ์ดํฐ์ ํ์ฉ ๊ฐ๋ฅํ ์ฅ์ ์ ๊ฐ์ ธ ์ ํํ๊ฒ ๋จ.
Sentiment Classifier
- ์ ์ฒด ํ ์คํธ ๋ด์ฉ์ ์ ์ ์์ผ๋ฉด์ ๋ด์ฉ์ ํน์ง์ ์ด๋ฆด ์ ์๋๋ก, ํ ์คํธ ๊ตฌ๋ฌธ๋ณ๋ก ๊ฐ์ฑ ๋ถ๋ฅ๋ฅผ ์๋ํจ.
- ์ ์ฒด ํ
์คํธ์ ๋ํด ๊ตฌ๋ฌธ๋ณ๋ก ๊ฐ์ฑ ๋ถ์ํ์ฌ ํ๋ณต,์ฌํ,์ญ๊ฒจ์,๋ถ๋
ธ,๋๋,๋๋ ค์, ์ค๋ฆฝ 7๊ฐ์ง ๊ฐ์ ์ผ๋ก ๋ถ๋ฅํจ.
https://huggingface.co/j-hartmann/emotion-english-distilroberta-base
- ๊ตฌ๋ฌธ๋ณ ๊ฐ์ฑ๋ถ๋ฅ ํ, ๊ฐ์ ์ ์ง๊ธฐ๊ฐ์ด ์๊ณ๊ฐ ๋ณด๋ค ๋ฎ์ ๊ฒฝ์ฐ ํด๋น ๊ฐ์ ์ ๋ฌด์ํ์ผ๋ฉฐ, ๋ฌด์๋ ๊ฐ์ ์ ์๋ค๋ก ๊ฐ์ ๊ฐ์ ์ผ ๊ฒฝ์ฐ ๊ทธ ๊ฐ์ ๋ค๊ณผ ์ด์ด์ง๋ค๊ณ ํ๋จํ์ฌ ๋์ฒดํ๋ ํ์ฒ๋ฆฌ ๊ณผ์ ์ ์งํ.
- ๊ทธ ๊ฒฐ๊ณผ ํ์๋ผ์ธ์ ๋ฐ๋ผ ์์ ๋ ๊ฐ์ ์ ํ์ ํ ์ ์์๊ณ , ๋ฐ๋ผ์ Sentiment Classifier ๋ฐฉ์์ ์ฑํํจ.
Riffusion Model ํ์ฉ ๋ฐ ํ์ต
- ๋ฆฌํจ์ ์ ๋ํจ์ ๋ชจ๋ธ์ ์๋ฆฌ๋ ํ๋์ ์๊ฐํํ์ฌ ํ์ ํ๊ธฐ ์ํ ๋๊ตฌ์ธ ์คํํธ๋ก๊ทธ๋จ์ ํ์ตํ ๋ชจ๋ธ.
- Step2์์ ์ป์ด์ง ๊ฐ์ฑ ๋ถ๋ฅ ๊ฒฐ๊ณผ๋ฅผ prompt๋ก ํ์ฉํ์ฌ ๊ทธ ๊ฐ์ฑ๊ณผ ๊ฐ์ ๊ฐ์ฑ์ ์คํํธ๋ก๊ทธ๋จ์ seed image๋ก ์ฌ์ฉํจ.
- ์ฌ์ฉ์ ํธ์๋ฅผ ์ํด ๊ธฐ์กด ์์์์ ๋ง์๋ฆฌ๋ฅผ ์ ์ธํ ์์ ์ด๋ ๋ ธ์ด์ฆ๋ฅผ ์ญ์ ํ๊ณ ์์ฑ๋ BGM์ ํฉ์ณ์ ์ต์ข ๊ฒฐ๊ณผ๋ฌผ์ ์์ฑํจ.
- Model: JD97/Riffusion_sentiment_LoRA(huggingface)
https://huggingface.co/JD97/Riffusion_sentiment_LoRA
Input(Source data) โ ๋ฐ์ดํฐ ์ถ์ถ โ ๋ค์ด์ํ๋ง โ ๊ตฌ๊ฐ๋ถํ โ ์ ์ฒ๋ฆฌ โ Output(Spectrogram with caption)
(1) Source data๋ก ๋ถํฐ Sentiment classifier์ ์ ์ฌํ label ์ ์ ๋ฐ ์ถ์ถ(6680๊ฐ)
- Source_data: Chr0my/Epidemic_music(huggingface)
https://huggingface.co/datasets/Chr0my/Epidemic_music
- ์ ์ฌํ 7๊ฐ์ง label : angry, fear, funny, happy, quirky, sad, weird
(2) ์ถ์ถํ Music file ๋ค์ด์ํ๋ง(22.05khz โ 8khz)
(3) ๋ค์ด์ํ๋ง๋ Music file 10์ด ๊ตฌ๊ฐ๋ถํ (with Random sampling)
- Riffusion ๋ชจ๋ธ ํ์ต ๋ฐ์ดํฐ์ ์ ์ฌํ ์ํ ์์ฑ์ํด 10์ด ๊ตฌ๊ฐ ์ค์
- ๊ตฌ๊ฐ ๋ณํ์ ๊ฐ๊ฑดํ ๋ชจ๋ธ ํ์ต ์ํด Random sampling ์ํ
(4) ์ ์ฒ๋ฆฌ ์ํ
- STFT(Short time fourier transform) โ Griffin-Lim โ Mel scale
- Source data์ metadataTags, moods data ํ์ฉํ์ฌ caption ์์ฑ
(5) ์ต์ข dataset
- gwkim22/spectro_caption_dataset(huggingface)
https://huggingface.co/datasets/gwkim22/spectro_caption_dataset
.
|-- LoRA
| |-- README.md
| |-- text_to_image_lora.py
| `-- train.sh
|-- MLOPS
| |-- README.md
| |-- front
| |-- kubernetes
| `-- serving
|-- dataset
|-- model
| |-- README.md
| |-- _interpolation.py
| |-- _sum_by_sent.py
| |-- oneway_pipeline.py
| |-- pre_to_stt.py
| |-- pretrained_models
| |-- stt_to_rif.py
| `-- utils.py
|-- project_requirements.txt
|-- riffusion
|-- whisper
`-- README.md
Ubuntu 18.04.5 LTS
CPU : Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz x 8
GPU : Tesla V100-PCIE-32GB
Python Version 3.9
# Install project_requirements.txt
$pip install -r project_requirements.txt
# Install the following additional files:
$apt-get update
$sudo apt-get install ffmpeg
$conda install pyworld -c conda-forge
$apt-get install -y libsndfile1-dev
$pip install git+https://github.com/openai/whisper.git
$pip install git+https://github.com/huggingface/diffusers
- whisper: Radford, A., Kim, J. W., Xu, T., Brockman, G., McLeavey, C., & Sutskever, I. (2022). Robust speech recognition via large-scale weak supervision. arXiv preprint arXiv:2212.04356.
- LoRA: Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., ... & Chen, W. (2021). Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685.