HTK 3.5 decoding tool HVITE stand-alone project (implementation of Visual Studio Code)

Keywords: JSON Makefile shell

HTK3.5 supports DNN

HTK3.5 supports DNN, and originally wanted to make a model of HMM+DNN as a comparison of HMM+GMM.However, HTK does not support real-time HMM+DNN decoding.There are two reasons.

  1. HTK does not support real-time calculation of the features of MFCC_0_D_A_Z, that is, the mean of the feature space cannot be calculated in real-time.
  2. HTK does not support decoding of real-time DNN or HMM+DNN.
    So you can only do offline demos.To learn more about HVITE, I decided to compile the HVITE tools separately.

Source File Structure for HTK

  1. HTK source files are divided into lib and tool levels.There may be dependencies between lib files, while tool files are independent of each other.
  2. HTK has two main tools, HTK and HLM, the former for speech recognition and the latter for language model.
    This time you only need to extract all the files in the HTKLib folder and the HVITE files in the HTKTools.

Visual Studio Code

The following is not detailed and you can refer to this link.
https://code.visualstudio.com/docs/languages/cpp

  1. Visual studio code is a lightweight, cross-platform debugging tool.After installation, you need to install two plug-ins, C/C++, C++ intellisense.

  2. Then open the source file in workspace

  3. Compilation requires a GCC tool, and tasks.json, equivalent to a script, needs to be configured before compilation.
    1) Open Command Palette (Ctrl+Shift+P).
    2) Select Configure Task command
    3) Click Create tasks.json file from templates
    4) Select Others
    5)label is the name for this build task, here HVITE.
    6)command means compile instructions, since I use makefile, I just need to write make here.





{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "HVITE",
            "type": "shell",
            "command": "make",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  1. Debugging requires the GDB tool, and C++(GDB/LLDB) is chosen.You need to configure launch.json after selecting.
    1) Select Debug for the leftmost label and click Configure icon.
    2) Choose C++ (GDB/LLDB) and launch.json will pop up.
    3) The program parameter needs to be modified, which is the name previously set, "${workspaceFolder}/hvite".
    4)args refers to the parameters required for the HVITE function.
    5) In order to be able to compile before debugging, a parameter "preLaunchTask" needs to be added: "HVITE"




{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/hvite",
            "args" :[ "-A", "-D", "-T", "1", 
                      "-I", "reco.mlf", "-y", "lab",
                      "-H", "hmm2/hmm_nhxr", "-H", "hmm2/hmm_xxxx",
                      "-S", "./alldataset.scp", "-w", "net.slf", "dict.txt","hmmlist.txt"],
            // "args": ["-f", "-o", "W", "-i", "train.align", "-I", "reco.mlf", 
            //          "-y", "lab", "-H", "./epoch25/models",  "-S", "./alldataset.scp", 
            //          "-w", "net.slf", "dict.txt", "hmmlist.txt"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "HVITE"
        }
    ]
}
  1. Makefile
    Compiler CC is gcc, LDFLGAS is the library file to be included, need to be noted -lpthread -lm -lX11, otherwise the header file will be prompted for missing.
######################################
#
######################################
#source file
#Source files, automatically find all.c and.cpp files, and define the target as a.o file with the same name
SOURCE  := $(wildcard src/*.c) $(wildcard src/*.cpp)
OBJS    := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))
#target you can change test to what you want
#Target file name, enter any executable file name you want
TARGET  := hvite
#compile and lib parameter
#Compile parameters
CC      := gcc
LIBS    :=
LDFLAGS := -lpthread -lm -lX11
DEFINES :=
INCLUDE := -I. -Isrc/ 
CFLAGS := $(CFLAGS) -m64 -ansi -std=gnu99 -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -I. -DPHNALG
#CFLAGS  := -g -Wall -O3 $(DEFINES) $(INCLUDE)
CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H
#i think you should do anything here
#Basically nothing needs to be changed below
.PHONY : everything objs clean veryclean rebuild

everything : $(TARGET)

all : $(TARGET)

objs : $(OBJS)

rebuild: veryclean everything

clean :
	rm -fr src/*.so
	rm -fr src/*.o

veryclean : clean
	rm -fr $(TARGET)
$(TARGET) : $(OBJS)
	$(CC) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

Once these are ready, you can compile and debug the HVTIE separately and learn the decoding process.

Twenty-eight original articles have been published. 42. Visits 60,000+
Private letter follow

Posted by pieychpi on Sat, 04 Apr 2020 02:16:22 -0700