conette

CoNeTTE: An efficient Audio Captioning system leveraging multiple datasets with Task Embedding

https://github.com/labbeti/conette-audio-captioning

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, ieee.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

audio-captioning automated-audio-captioning
Last synced: 6 months ago · JSON representation ·

Repository

CoNeTTE: An efficient Audio Captioning system leveraging multiple datasets with Task Embedding

Basic Info
Statistics
  • Stars: 20
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 11
Topics
audio-captioning automated-audio-captioning
Created over 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

# CoNeTTE model for Audio Captioning [![]()](https://www.python.org/) [![]()](https://pytorch.org/get-started/locally/) [![](https://img.shields.io/badge/code%20style-black-black.svg?style=for-the-badge&labelColor=gray)](https://black.readthedocs.io/en/stable/) [![](https://img.shields.io/github/actions/workflow/status/Labbeti/conette-audio-captioning/inference.yaml?branch=main&style=for-the-badge&logo=github)](https://github.com/Labbeti/conette-audio-captioning/actions)

CoNeTTE is an audio captioning system, which generate a short textual description of the sound events in any audio file. The architecture and training are explained in the corresponding paper on IEEE (you can also find an older pre-print version on arXiv here). The model has been developped by me (Étienne Labbé :) ) during my PhD. A simple interface to test CoNeTTE is available on the HuggingFace website.

Training

Requirements

  • Intended for Ubuntu 20.04 only. Requires java < 1.13, ffmpeg, yt-dlp, and zip commands.
  • Recommanded GPU: NVIDIA V100 with 32GB VRAM.
  • WavCaps dataset might requires more than 2 TB of disk storage. Other datasets requires less than 50 GB.

Installation

By default, only the pip inference requirements are installed for conette. To install training requirements you need to use the following command: bash python -m pip install conette[train] If you already installed conette for inference, it is highly recommanded to create another environment before installing conette for training.

Download external models and data

These steps might take a while (few hours to download and prepare everything depending on your CPU, GPU and SSD/HDD).

First, download the ConvNeXt, NLTK and spacy models : bash conette-prepare data=none default=true pack_to_hdf=false csum_in_hdf_name=false pann=false

Then download the 4 datasets used to train CoNeTTE : ```bash commonargs="data.download=true packtohdf=true audiot=resamplemeanconvnext audiot.pretrainpath=cnextbl75 posthdfname=bl pretag=cnextbl75"

conette-prepare data=audiocaps audiot.srcsr=32000 ${commonargs} conette-prepare data=clotho audiot.srcsr=44100 ${commonargs} conette-prepare data=macs audiot.srcsr=48000 ${commonargs} conette-prepare data=wavcaps audiot.srcsr=32000 ${commonargs} datafilter.minaudiosize=0.1 datafilter.maxaudiosize=30.0 datafilter.sr=32000 ```

Train a model

CNext-trans (baseline) on CL only (~3 hours on 1 GPU V100-32G) bash conette-train expt=[clotho_cnext_bl] pl=baseline

CoNeTTE on AC+CL+MA+WC, specialized for CL (~4 hours on 1 GPU V100-32G) bash conette-train expt=[camw_cnext_bl_for_c,task_ds_src_camw] pl=conette

CoNeTTE on AC+CL+MA+WC, specialized for AC (~3 hours on 1 GPU V100-32G) bash conette-train expt=[camw_cnext_bl_for_a,task_ds_src_camw] pl=conette

Note 1: any training using AC data cannot be exactly reproduced because a part of this data is deleted from the YouTube source, and I cannot share my own audio files. Note 2: paper results are averaged scores over 5 seeds (1234-1238). The default training only uses seed 1234.

Inference only (without training)

Installation

bash python -m pip install conette[test]

Usage with command line

Simply use the command conette-predict with --audio PATH1 PATH2 ... option. You can also export results to a CSV file using --csv_export PATH.

bash conette-predict --audio "/your/path/to/audio.wav"

Usage with python

```py from conette import CoNeTTEConfig, CoNeTTEModel

config = CoNeTTEConfig.frompretrained("Labbeti/conette") model = CoNeTTEModel.frompretrained("Labbeti/conette", config=config)

path = "/your/path/to/audio.wav" outputs = model(path) candidate = outputs["cands"][0] print(candidate) ```

The model can also accept several audio files at the same time (list[str]), or a list of pre-loaded audio files (list[Tensor]). In this second case you also need to provide the sampling rate of this files:

```py import torchaudio

path1 = "/your/path/to/audio1.wav" path2 = "/your/path/to/audio2.wav"

audio1, sr1 = torchaudio.load(path1) audio2, sr2 = torchaudio.load(path2)

outputs = model([audio1, audio2], sr=[sr1, sr2]) candidates = outputs["cands"] print(candidates) ```

The model can also produces different captions using a Task Embedding input which indicates the dataset caption style. The default task is "clotho".

```py outputs = model(path, task="clotho") candidate = outputs["cands"][0] print(candidate)

outputs = model(path, task="audiocaps") candidate = outputs["cands"][0] print(candidate) ```

Performance

The model has been trained on AudioCaps (AC), Clotho (CL), MACS (MA) and WavCaps (WC). The performance on the test subsets are :

| Test data | SPIDEr (%) | SPIDEr-FL (%) | FENSE (%) | Vocab | Outputs | Scores | | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | | AC-test | 44.14 | 43.98 | 60.81 | 309 | Link | Link | | CL-eval | 30.97 | 30.87 | 51.72 | 636 | Link | Link |

This model checkpoint has been trained with focus on the Clotho dataset, but it can also reach a good performance on AudioCaps with the "audiocaps" task.

Limitations

  • The model expected audio sampled at 32 kHz. The model automatically resample up or down the input audio files. However, it might give worse results, especially when using audio with lower sampling rates.
  • The model has been trained on audio lasting from 1 to 30 seconds. It can handle longer audio files, but it might require more memory and give worse results.

Citation

The final version of the paper describing CoNeTTE is available on IEEExplore: https://ieeexplore.ieee.org/document/10603439. A preprint version of the paper is also available on arXiv: https://arxiv.org/pdf/2309.00454.pdf.

Final version recommanded for citation (IEEE): bibtex @article{labbe2023conetteieee, title = {CoNeTTE: An Efficient Audio Captioning System Leveraging Multiple Datasets With Task Embedding}, author = {Labbé, Étienne and Pellegrini, Thomas and Pinquier, Julien}, year = 2024, journal = {IEEE/ACM Transactions on Audio, Speech, and Language Processing}, volume = 32, number = {}, pages = {3785--3794}, doi = {10.1109/TASLP.2024.3430813}, url = {https://ieeexplore.ieee.org/document/10603439}, keywords = {Decoding;Task analysis;Transformers;Training;Convolutional neural networks;Speech processing;Tagging;Audio-language task;automated audio captioning;dataset biases;task embedding;deep learning} }

Preprint version (arXiv): bibtex @misc{labbe2023conettearxiv, title = {CoNeTTE: An efficient Audio Captioning system leveraging multiple datasets with Task Embedding}, author = {Étienne Labbé and Thomas Pellegrini and Julien Pinquier}, year = 2023, journal = {arXiv preprint arXiv:2309.00454}, url = {https://arxiv.org/pdf/2309.00454.pdf}, eprint = {2309.00454}, archiveprefix = {arXiv}, primaryclass = {cs.SD} }

Additional information

  • CoNeTTE stands for ConvNeXt-Transformer with Task Embedding.
  • Raw model weights are available on HuggingFace: https://huggingface.co/Labbeti/conette
  • The weights of the encoder part of the architecture is based on a ConvNeXt model for audio classification, available here: https://zenodo.org/records/10987498 under the filename "convnexttiny465mAPBLAC_75kit.pth".

Contact

Maintainer: - Étienne Labbé "Labbeti": labbeti.pub@gmail.com

Owner

  • Name: Labbeti
  • Login: Labbeti
  • Kind: user
  • Location: Toulouse, France
  • Company: IRIT

PhD student at IRIT (Institut de Recherche en Informatique de Toulouse), working mainly on Automated Audio Captioning.

Citation (CITATION.cff)

# -*- coding: utf-8 -*-

cff-version: 1.2.0
message: If you use this software, please cite it as below.
title: conette
authors:
  - given-names: Etienne
    family-names: Labbé
    affiliation: IRIT
    orcid: 'https://orcid.org/0000-0002-7219-5463'
url: https://github.com/Labbeti/conette-audio-captioning

preferred-citation:
  authors:
    - family-names: Labbé
      given-names: Étienne
      affiliation: IRIT
      orcid: 'https://orcid.org/0000-0002-7219-5463'
    - family-names: Pellegrini
      given-names: Thomas
      affiliation: IRIT
      orcid: 'https://orcid.org/0000-0001-8984-1399'
    - family-names: Pinquier
      given-names: Julien
      affiliation: IRIT
      orcid: https://orcid.org/0000-0003-1556-1284
  doi: "10.1109/TASLP.2024.3430813"
  journal: "IEEE/ACM Transactions on Audio, Speech, and Language Processing"
  title: "CoNeTTE: An efficient Audio Captioning system leveraging multiple datasets with Task Embedding"
  type: article
  url: "https://ieeexplore.ieee.org/document/10603439"
  year: 2024

GitHub Events

Total
  • Release event: 1
  • Watch event: 8
  • Push event: 3
  • Create event: 1
Last Year
  • Release event: 1
  • Watch event: 8
  • Push event: 3
  • Create event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 12
  • Total Committers: 1
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Labbeti e****1@g****m 12

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 4
  • Total pull requests: 0
  • Average time to close issues: 5 days
  • Average time to close pull requests: N/A
  • Total issue authors: 3
  • Total pull request authors: 0
  • Average comments per issue: 3.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • LittleFlyingSheep (2)
  • MoayedHajiAli (1)
  • XinMing0411 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 113 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
  • Total maintainers: 1
pypi.org: conette

CoNeTTE is an audio captioning system, which generate a short textual description of the sound events in any audio file.

  • Documentation: https://conette.readthedocs.io/
  • License: MIT License Copyright (c) 2024 Labbeti Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.3.2
    published about 1 year ago
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 113 Last month
Rankings
Dependent packages count: 9.9%
Forks count: 29.9%
Average: 36.6%
Stargazers count: 38.9%
Dependent repos count: 67.8%
Maintainers (1)
Last synced: 6 months ago