-
大小: 65KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-05-13
- 語言: 其他
- 標(biāo)簽: tensorflow??語音識別??
資源簡介
完整的tensorflow語音識別代碼,親測可用,從訓(xùn)練到識別

代碼片段和文件信息
#?Copyright?2017?The?TensorFlow?Authors.?All?Rights?Reserved.
#
#?Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
#?you?may?not?use?this?file?except?in?compliance?with?the?License.
#?You?may?obtain?a?copy?of?the?License?at
#
#?????http://www.apache.org/licenses/LICENSE-2.0
#
#?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
#?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
#?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
#?See?the?License?for?the?specific?language?governing?permissions?and
#?limitations?under?the?License.
#?==============================================================================
r“““Converts?a?trained?checkpoint?into?a?frozen?model?for?mobile?inference.
Once?you‘ve?trained?a?model?using?the?‘train.py‘?script?you?can?use?this?tool
to?convert?it?into?a?binary?GraphDef?file?that?can?be?loaded?into?the?Android
iOS?or?Raspberry?Pi?example?code.?Here‘s?an?example?of?how?to?run?it:
bazel?run?tensorflow/examples/speech_commands/freeze?--?\
--sample_rate=16000?--dct_coefficient_count=40?--window_size_ms=20?\
--window_stride_ms=10?--clip_duration_ms=1000?\
--model_architecture=conv?\
--start_checkpoint=/tmp/speech_commands_train/conv.ckpt-1300?\
--output_file=/tmp/my_frozen_graph.pb
One?thing?to?watch?out?for?is?that?you?need?to?pass?in?the?same?arguments?for
‘sample_rate‘?and?other?command?line?variables?here?as?you?did?for?the?training
script.
The?resulting?graph?has?an?input?for?WAV-encoded?data?named?‘wav_data‘?one?for
raw?PCM?data?(as?floats?in?the?range?-1.0?to?1.0)?called?‘decoded_sample_data‘
and?the?output?is?called?‘labels_softmax‘.
“““
from?__future__?import?absolute_import
from?__future__?import?division
from?__future__?import?print_function
import?argparse
import?os.path
import?sys
import?tensorflow?as?tf
from?tensorflow.contrib.framework.python.ops?import?audio_ops?as?contrib_audio
import?input_data
import?models
from?tensorflow.python.framework?import?graph_util
FLAGS?=?None
def?create_inference_graph(wanted_words?sample_rate?clip_duration_ms
???????????????????????????clip_stride_ms?window_size_ms?window_stride_ms
???????????????????????????dct_coefficient_count?model_architecture):
??“““Creates?an?audio?model?with?the?nodes?needed?for?inference.
??Uses?the?supplied?arguments?to?create?a?model?and?inserts?the?input?and
??output?nodes?that?are?needed?to?use?the?graph?for?inference.
??Args:
????wanted_words:?Comma-separated?list?of?the?words?we‘re?trying?to?recognize.
????sample_rate:?How?many?samples?per?second?are?in?the?input?audio?files.
????clip_duration_ms:?How?many?samples?to?analyze?for?the?audio?pattern.
????clip_stride_ms:?How?often?to?run?recognition.?Useful?for?models?with?cache.
????window_size_ms:?Time?slice?duration?to?estimate?frequencies?from.
????window_stride_ms:?How?far?apart?time?slices?should?be.
????dct_coefficient_count:?Number?of?frequency?bands?to?analyze.
????model_architecture:?Name?of?th
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????562??2018-05-09?11:52??speech_commands\.idea\inspectionProfiles\Project_Default.xm
?????文件????????301??2018-05-09?11:52??speech_commands\.idea\misc.xm
?????文件????????282??2018-05-08?08:29??speech_commands\.idea\modules.xm
?????文件????????398??2018-05-08?08:31??speech_commands\.idea\speech_commands.iml
?????文件??????29967??2018-05-24?09:54??speech_commands\.idea\workspace.xm
?????文件???????5262??2018-05-08?06:19??speech_commands\accuracy_utils.cc
?????文件???????2359??2018-05-08?06:19??speech_commands\accuracy_utils.h
?????文件???????2298??2018-05-08?06:19??speech_commands\accuracy_utils_test.cc
?????文件???????5134??2018-05-08?06:19??speech_commands\BUILD
?????文件???????6965??2018-05-08?06:19??speech_commands\freeze.py
?????文件???????1474??2018-05-08?06:19??speech_commands\freeze_test.py
?????文件??????10939??2018-05-08?06:19??speech_commands\generate_streaming_test_wav.py
?????文件???????1416??2018-05-08?06:19??speech_commands\generate_streaming_test_wav_test.py
?????文件??????23683??2018-05-08?06:19??speech_commands\input_data.py
?????文件??????18132??2018-05-08?11:22??speech_commands\input_data.pyc
?????文件???????8418??2018-05-08?06:19??speech_commands\input_data_test.py
?????文件???????6334??2018-05-08?06:19??speech_commands\label_wav.cc
?????文件???????4683??2018-05-08?06:19??speech_commands\label_wav.py
?????文件???????4842??2018-05-08?06:19??speech_commands\label_wav_dir.py
?????文件???????2298??2018-05-08?06:19??speech_commands\label_wav_test.py
?????文件??????21786??2018-05-08?06:19??speech_commands\models.py
?????文件??????15571??2018-05-08?14:36??speech_commands\models.pyc
?????文件???????3874??2018-05-08?06:19??speech_commands\models_test.py
?????文件????????185??2018-05-08?06:19??speech_commands\README.md
?????文件???????5282??2018-05-08?06:19??speech_commands\recognize_commands.cc
?????文件???????3472??2018-05-08?06:19??speech_commands\recognize_commands.h
?????文件???????3824??2018-05-08?06:19??speech_commands\recognize_commands_test.cc
?????文件??????12670??2018-05-08?06:19??speech_commands\test_streaming_accuracy.cc
?????文件??????16646??2018-05-08?06:19??speech_commands\train.py
?????目錄??????????0??2018-05-23?14:24??speech_commands\.idea\inspectionProfiles
............此處省略5個文件信息
評論
共有 條評論