|
|
|
@ -16,9 +16,9 @@
|
|
|
|
|
|
|
|
|
|
namespace ppspeech {
|
|
|
|
|
|
|
|
|
|
using kaldi::BaseFloat;
|
|
|
|
|
using kaldi::Vector;
|
|
|
|
|
using kaldi::VectorBase;
|
|
|
|
|
using kaldi::BaseFloat;
|
|
|
|
|
using std::unique_ptr;
|
|
|
|
|
|
|
|
|
|
Assembler::Assembler(AssemblerOptions opts,
|
|
|
|
@ -51,9 +51,11 @@ bool Assembler::Compute(Vector<BaseFloat>* feats) {
|
|
|
|
|
Vector<BaseFloat> feature;
|
|
|
|
|
bool result = base_extractor_->Read(&feature);
|
|
|
|
|
if (result == false || feature.Dim() == 0) {
|
|
|
|
|
VLOG(1) << "result: " << result << " feature dim: " << feature.Dim();
|
|
|
|
|
VLOG(1) << "result: " << result
|
|
|
|
|
<< " feature dim: " << feature.Dim();
|
|
|
|
|
if (IsFinished() == false) {
|
|
|
|
|
VLOG(1) << "finished reading feature. cache size: " << feature_cache_.size();
|
|
|
|
|
VLOG(1) << "finished reading feature. cache size: "
|
|
|
|
|
<< feature_cache_.size();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
VLOG(1) << "break";
|
|
|
|
@ -69,7 +71,8 @@ bool Assembler::Compute(Vector<BaseFloat>* feats) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (feature_cache_.size() < receptive_filed_length_) {
|
|
|
|
|
VLOG(1) << "feature_cache less than receptive_filed_lenght. " << feature_cache_.size() << ": " << receptive_filed_length_;
|
|
|
|
|
VLOG(1) << "feature_cache less than receptive_filed_lenght. "
|
|
|
|
|
<< feature_cache_.size() << ": " << receptive_filed_length_;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -81,7 +84,8 @@ bool Assembler::Compute(Vector<BaseFloat>* feats) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int32 this_chunk_size = std::min(static_cast<int32>(feature_cache_.size()), frame_chunk_size_);
|
|
|
|
|
int32 this_chunk_size =
|
|
|
|
|
std::min(static_cast<int32>(feature_cache_.size()), frame_chunk_size_);
|
|
|
|
|
feats->Resize(dim_ * this_chunk_size);
|
|
|
|
|
VLOG(1) << "read " << this_chunk_size << " feat.";
|
|
|
|
|
|
|
|
|
@ -108,7 +112,7 @@ bool Assembler::Compute(Vector<BaseFloat>* feats) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Assembler::Reset() {
|
|
|
|
|
void Assembler::Reset() {
|
|
|
|
|
std::queue<kaldi::Vector<kaldi::BaseFloat>> empty;
|
|
|
|
|
std::swap(feature_cache_, empty);
|
|
|
|
|
nframes_ = 0;
|
|
|
|
|