https://github.com/kaiyux/ctc-decoder
A cpp reimplementation for CTC decoder
https://github.com/kaiyux/ctc-decoder
cpp ctc decoder ocr speech
Last synced: 12 months ago
JSON representation
A cpp reimplementation for CTC decoder
- Host: GitHub
- URL: https://github.com/kaiyux/ctc-decoder
- Owner: kaiyux
- Created: 2021-03-14T08:18:23.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-15T11:43:49.000Z (about 5 years ago)
- Last Synced: 2025-03-28T13:44:28.345Z (about 1 year ago)
- Topics: cpp, ctc, decoder, ocr, speech
- Language: C++
- Homepage:
- Size: 192 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
mkdir cmake-build-release
cd cmake-build-release
/path/to/cmake -DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - Unix Makefiles" /path/to/CTC-decoder
/path/to/cmake --build /path/to/CTC-decoder/cmake-build-release --target ctcdecoder -- -j 4
```
Then scripts in Python
```Python
import sys
sys.path.append('/path/to/cmake-build-release')
import ctcdecoder
probs = np.random.rand(time_len, output_dim)
probs = probs / np.sum(probs, axis=1, keepdims=True)
probs = np.log(probs)
labels, score = ctcdecoder.decode(probs, 10, 0)
```