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
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: gsolersanz
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 7.11 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 12 months ago · Last pushed 8 months 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: Guillem Soler
  • Login: gsolersanz
  • Kind: user

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
  • Push event: 1
  • Public event: 1
Last Year
  • Push event: 1
  • Public event: 1

Dependencies

.github/workflows/inference.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v4 composite
.github/workflows/training.yaml actions
  • actions/cache v3 composite
  • actions/checkout v2 composite
  • actions/setup-python v4 composite
pyproject.toml pypi
requirements-dev.txt pypi
  • black ==23.12.1 development
  • flake8 ==6.1.0 development
  • ipykernel ==6.27.1 development
  • pre-commit ==3.7.0 development
  • pytest ==7.4.3 development
  • twine ==4.0.1 development
requirements-train.txt pypi
  • Babel ==2.13.1
  • Brotli ==1.1.0
  • Jinja2 ==3.1.2
  • Mako ==1.3.0
  • Markdown ==3.5.1
  • MarkupSafe ==2.1.3
  • Pillow ==10.1.0
  • PyYAML ==6.0.1
  • Pygments ==2.17.2
  • QtPy ==2.4.1
  • SQLAlchemy ==2.0.23
  • Send2Trash ==1.8.2
  • Werkzeug ==3.0.1
  • aac-datasets ==0.4.1
  • aac-metrics ==0.5.4
  • absl-py ==2.0.0
  • aiohttp ==3.9.1
  • aiosignal ==1.3.1
  • alembic ==1.13.0
  • antlr4-python3-runtime ==4.9.3
  • anyio ==4.1.0
  • argon2-cffi ==23.1.0
  • argon2-cffi-bindings ==21.2.0
  • arrow ==1.3.0
  • asttokens ==2.4.1
  • async-lru ==2.0.4
  • async-timeout ==4.0.3
  • attrs ==23.1.0
  • audiomentations ==0.34.1
  • audioread ==3.0.1
  • autopage ==0.5.2
  • beautifulsoup4 ==4.12.2
  • bert-score ==0.3.13
  • black ==23.12.1
  • bleach ==6.1.0
  • blis ==0.7.11
  • bokeh ==3.3.2
  • cachetools ==5.3.2
  • catalogue ==2.0.10
  • certifi ==2023.11.17
  • cffi ==1.16.0
  • charset-normalizer ==3.3.2
  • click ==8.1.7
  • cliff ==4.4.0
  • cloudpathlib ==0.16.0
  • cmaes ==0.10.0
  • cmd2 ==2.4.3
  • colorlog ==6.8.0
  • comm ==0.2.0
  • confection ==0.1.4
  • contourpy ==1.2.0
  • cycler ==0.12.1
  • cymem ==2.0.8
  • daal ==2024.0.1
  • daal4py ==2024.0.1
  • debugpy ==1.8.0
  • decorator ==5.1.1
  • deepspeed ==0.9.5
  • defusedxml ==0.7.1
  • exceptiongroup ==1.2.0
  • executing ==2.0.1
  • fastjsonschema ==2.19.0
  • filelock ==3.13.1
  • flake8 ==6.1.0
  • fonttools ==4.46.0
  • fqdn ==1.5.1
  • frozenlist ==1.4.0
  • fsspec ==2023.12.2
  • gensim ==4.3.2
  • google-auth ==2.25.2
  • google-auth-oauthlib ==1.1.0
  • greenlet ==3.0.2
  • grpcio ==1.60.0
  • h5py ==3.10.0
  • hjson ==3.1.0
  • huggingface-hub ==0.19.4
  • hydra-colorlog ==1.2.0
  • hydra-core ==1.3.2
  • hydra-optuna-sweeper ==1.2.0
  • idna ==3.6
  • imageio ==2.33.1
  • importlib-metadata ==7.0.0
  • inflate64 ==1.0.0
  • iniconfig ==2.0.0
  • intel-extension-for-pytorch ==2.1.0
  • ipykernel ==6.27.1
  • ipython ==8.18.1
  • ipywidgets ==8.1.1
  • isoduration ==20.11.0
  • jedi ==0.19.1
  • joblib ==1.3.2
  • json5 ==0.9.14
  • jsonpointer ==2.4
  • jsonschema ==4.20.0
  • jsonschema-specifications ==2023.11.2
  • julius ==0.2.7
  • jupyter ==1.0.0
  • jupyter-console ==6.6.3
  • jupyter-events ==0.9.0
  • jupyter-lsp ==2.2.1
  • jupyter_client ==8.6.0
  • jupyter_core ==5.5.0
  • jupyter_server ==2.12.1
  • jupyter_server_terminals ==0.5.0
  • jupyterlab ==4.0.9
  • jupyterlab-widgets ==3.0.9
  • jupyterlab_pygments ==0.3.0
  • jupyterlab_server ==2.25.2
  • kiwisolver ==1.4.5
  • langcodes ==3.3.0
  • language-tool-python ==2.7.1
  • lazy_loader ==0.3
  • librosa ==0.10.1
  • lightning-utilities ==0.10.0
  • llvmlite ==0.41.1
  • matplotlib ==3.8.2
  • matplotlib-inline ==0.1.6
  • mccabe ==0.7.0
  • mistune ==3.0.2
  • msgpack ==1.0.7
  • multidict ==6.0.4
  • multivolumefile ==0.2.3
  • murmurhash ==1.0.10
  • mypy-extensions ==1.0.0
  • nbclient ==0.9.0
  • nbconvert ==7.12.0
  • nbformat ==5.9.2
  • nest-asyncio ==1.5.8
  • networkx ==3.2.1
  • ninja ==1.11.1.1
  • nltk ==3.8.1
  • nnAudio ==0.3.2
  • notebook ==7.0.6
  • notebook_shim ==0.2.3
  • numba ==0.58.1
  • numpy ==1.26.2
  • nvidia-cublas-cu11 ==11.10.3.66
  • nvidia-cuda-nvrtc-cu11 ==11.7.99
  • nvidia-cuda-runtime-cu11 ==11.7.99
  • nvidia-cudnn-cu11 ==8.5.0.96
  • oauthlib ==3.2.2
  • omegaconf ==2.3.0
  • optuna ==2.10.1
  • overrides ==7.4.0
  • packaging ==23.2
  • pandas ==2.1.4
  • pandocfilters ==1.5.0
  • parso ==0.8.3
  • pathspec ==0.12.1
  • pbr ==6.0.0
  • pexpect ==4.9.0
  • platformdirs ==4.1.0
  • pluggy ==1.3.0
  • pooch ==1.8.0
  • preshed ==3.0.9
  • prettytable ==3.9.0
  • prometheus-client ==0.19.0
  • prompt-toolkit ==3.0.41
  • protobuf ==4.23.4
  • psutil ==5.9.6
  • ptyprocess ==0.7.0
  • pure-eval ==0.2.2
  • py-cpuinfo ==9.0.0
  • py7zr ==0.20.8
  • pyasn1 ==0.5.1
  • pyasn1-modules ==0.3.0
  • pybcj ==1.0.2
  • pycodestyle ==2.11.1
  • pycparser ==2.21
  • pycryptodomex ==3.19.0
  • pydantic ==1.10.13
  • pyemd ==1.0.0
  • pyflakes ==3.1.0
  • pyparsing ==3.1.1
  • pyperclip ==1.8.2
  • pyppmd ==1.1.0
  • pytest ==7.4.3
  • python-dateutil ==2.8.2
  • python-json-logger ==2.0.7
  • pytorch-lightning ==1.9.5
  • pytorch-ranger ==0.1.1
  • pytz ==2023.3.post1
  • pyzmq ==25.1.2
  • pyzstd ==0.15.9
  • qtconsole ==5.5.1
  • referencing ==0.32.0
  • regex ==2023.10.3
  • requests ==2.31.0
  • requests-oauthlib ==1.3.1
  • resampy ==0.2.2
  • rfc3339-validator ==0.1.4
  • rfc3986-validator ==0.1.1
  • rpds-py ==0.13.2
  • rsa ==4.9
  • safetensors ==0.4.1
  • scikit-image ==0.22.0
  • scikit-learn ==1.3.2
  • scikit-learn-intelex ==2024.0.1
  • scipy ==1.11.4
  • sentence-transformers ==2.2.2
  • sentencepiece ==0.1.99
  • six ==1.16.0
  • smart-open ==6.4.0
  • sniffio ==1.3.0
  • soundfile ==0.12.1
  • soupsieve ==2.5
  • soxr ==0.3.7
  • spacy ==3.7.2
  • spacy-legacy ==3.0.12
  • spacy-loggers ==1.0.5
  • srsly ==2.4.8
  • stack-data ==0.6.3
  • stevedore ==5.1.0
  • tbb ==2021.11.0
  • tensorboard ==2.15.1
  • tensorboard-data-server ==0.7.2
  • terminado ==0.18.0
  • texttable ==1.7.0
  • thinc ==8.2.1
  • threadpoolctl ==3.2.0
  • tifffile ==2023.12.9
  • timm ==0.9.12
  • tinycss2 ==1.2.1
  • tokenizers ==0.13.3
  • tomli ==2.0.1
  • torch ==1.13.1
  • torch-optimizer ==0.3.0
  • torchaudio ==0.13.1
  • torchlibrosa ==0.1.0
  • torchmetrics ==1.2.1
  • torchopenl3 ==1.0.1
  • torchtext ==0.14.1
  • torchvision ==0.14.1
  • tornado ==6.4
  • tqdm ==4.66.1
  • traitlets ==5.14.0
  • transformers ==4.30.2
  • typer ==0.9.0
  • types-python-dateutil ==2.8.19.14
  • typing_extensions ==4.9.0
  • tzdata ==2023.3
  • uri-template ==1.3.0
  • urllib3 ==2.1.0
  • wasabi ==1.1.2
  • wcwidth ==0.2.12
  • weasel ==0.3.4
  • webcolors ==1.13
  • webencodings ==0.5.1
  • websocket-client ==1.7.0
  • widgetsnbextension ==4.0.9
  • xyzservices ==2023.10.1
  • yarl ==1.9.4
  • zipp ==3.17.0
requirements.txt pypi
  • PyYAML ==6.0.1
  • nltk ==3.8.1
  • omegaconf ==2.3.0
  • pytorch-lightning ==1.9.5
  • setuptools ==67.7.2
  • spacy ==3.7.2
  • tensorboard ==2.15.1
  • torch ==1.13.1
  • torchaudio ==0.13.1
  • torchlibrosa ==0.1.0
  • torchoutil *
  • transformers ==4.30.2
setup.py pypi
src/conette/huggingface/setup.py pypi
src/conette/pipeline/requirements.txt pypi
  • librosa >=0.10.0
  • numpy >=1.21.0
  • onnx >=1.14.0
  • onnxruntime >=1.15.0
  • psutil >=5.9.0
  • pytest >=7.0.0
  • soundfile >=0.12.0
  • torch >=2.0.0
  • tqdm >=4.64.0
  • transformers >=4.20.0