Giter Site home page Giter Site logo

jibin86 / audio-to-text-embedding Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 4.34 MB

An implementation of a deep learning model for embedding 2 seconds audio signals into text representations. This repository contains code for training models that convert audio data into text embeddings.

Python 100.00%

audio-to-text-embedding's Introduction

Audio-to-Text-Embedding

This is an implementation of a deep learning model for embedding 2-second audio signals into text representations. This repository contains code for training models that convert audio data into text embeddings.

This code can be useful for text-to-video generation models, as it converts audio into text embeddings by segmenting them into 2-second intervals.

Installation

Clone the repository:

git clone https://github.com/jibin86/Audio-to-Text-Embedding.git
cd Audio-to-Text-Embedding

Create and activate the conda environment:

conda env create --file env.yaml
conda activate audio_emb

Pretrained models

This code is built upon The Power of Sound(TPoS) and AudioGPT. Obtain the checkpoints for the audio extractor and audio detector.

  • Audio Extraction

    Pretrained weights can be found at the following link: link. Once downloaded, place the weights in the pretrained_models directory.

  • Audio Detection

    cd pretrained_models
    wget https://huggingface.co/Dongchao/pre_trained_model/resolve/main/audio_detection.pth
    

Usage

1. Download UnAV Dataset

cd unav_dataset/scripts
python video_download.py

2. Extract Audio from Videos

cd unav_dataset
python extract_audio.py

3. Split Audio into 2-Second Segments and Save as "Train" and "Test"

cd audio_encoder
python unav_segment_2sec.py

4. Convert Audio from Waveform to Mel-Spectrogram Format

cd audio_encoder
python unav_curate.py --train_or_test train
python unav_curate.py --train_or_test test

5. Generate Text Prompts (Audio Detection)

cd audio_detection
python make_prompt.py --audio_dir "../unav_dataset/data/unav100/audio_segments_2sec/train" --json_dir "../audio_encoder/text_prompt"
python make_prompt.py --audio_dir "../unav_dataset/data/unav100/audio_segments_2sec/test" --json_dir "../audio_encoder/text_prompt"

6. Train Audio Encoder

cd audio_encoder
python unav_train_audio_encoder_tpos.py

audio-to-text-embedding's People

Contributors

jibin86 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.