项目作者: SiriusKY

项目描述 :
A cpp reimplementation for CTC decoder
高级语言: C++
项目地址: git://github.com/SiriusKY/CTC-decoder.git
创建时间: 2021-03-14T08:18:23Z
项目社区:https://github.com/SiriusKY/CTC-decoder

开源协议:

下载


CTC-Decoder

A cpp reimplementation

This repo is a cpp reimplementation for Awni Hannun‘s version of CTC decoder. It runs 4.5x faster in my MacBook Pro & No extra dependency is needed.

Usage

Firstly

  1. mkdir cmake-build-release
  2. cd cmake-build-release
  3. /path/to/cmake -DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - Unix Makefiles" /path/to/CTC-decoder
  4. /path/to/cmake --build /path/to/CTC-decoder/cmake-build-release --target ctcdecoder -- -j 4

Then scripts in Python

  1. import sys
  2. sys.path.append('/path/to/cmake-build-release')
  3. import ctcdecoder
  4. probs = np.random.rand(time_len, output_dim)
  5. probs = probs / np.sum(probs, axis=1, keepdims=True)
  6. probs = np.log(probs)
  7. labels, score = ctcdecoder.decode(probs, 10, 0)