Code Monkey home page Code Monkey logo

chinesettstflite's Introduction

Chinese TTS TF Lite

Issue Star

介绍

使用Kotlin + JetPack Compose + Tensorflow Lite开发的TTS引擎,可以完全离线使用。

可选两种模型:FastSpeech和Tacotron,这两种模型均来自TensorFlowTTS

文字转拼音方法来自:TensorflowTTS_chinese

因为是实时推理输出音频,故对设备性能有一定要求。

其中FastSpeech速度较快,但生成的音频拟人效果较差,可以用于普通中端以上手机。

而Tacotron对性能要求较高,虽然总体效果更好,但因为速度很慢,故目前实用价值不大,仅供测试。

手动编译说明

  1. Android Studio 2021.2.1
  2. 从下面的模型下载地址,下载models-tflite.7z,把如下4个文件解压到对应目录
  3. 从下面的aar下载地址,下载裁剪版TensorFlow Lite的aar,把2个aar文件放到app/libs
├─app/src/main/assets
│      baker_mapper.json
│      fastspeech2_quan.tflite
│      mb_melgan.tflite
│      tacotron2_quan.tflite
  1. 编译
./gradlew assembleRelease

模型下载

下载地址

  • models-tf.7z : 原始TensorflowTTS模型,一般用于PC端
  • models-tflite.7z : 转换后的TFLite模型,一般用于移动端

模型查看

netron

裁剪TensorFlow Lite

缩减TensorFlow Lite二进制文件大小

裁剪后aar下载

裁剪前后的arr文件大小对比:

  • tensorflow-lite-2.8.0.aar: 5.4MB -> 3.7MB (68.5%)
  • tensorflow-lite-select-tf-ops-2.8.0.aar: 109.6MB -> 14.8MB (13.5%)

参考资料

TensorFlowTTS

TensorflowTTS_chinese

tensorflow指南

参考tf测试

参考tflite转换

Google Pico TTS Source

模型测试&转换

转换环境配置

  • Ubuntu: 20.04 LTS
  • Python: 3.8
$ git clone https://github.com/TensorSpeech/TensorFlowTTS.git
$ cd TensorFlowTTS
$ pip install .
$ pip install git+https://github.com/repodiac/german_transliterate.git

解压models-tf.7z

TF模型测试

$ cd models-tf
$ python test-h5.py

TF模型转TFLite

$ python convert-tflite.py

APP界面截图

avatar

chinesettstflite's People

Contributors

benjaminwan 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.