RabbitMQ--VAD_AGC.py

mi_zy發表於2020-07-22

相關筆記:

1、http://192.168.1.90:9001/    Supervisor中 ASRFrame:語音識別程式;SLU:語義理解;

 ~/AIsafe/ASR/ASR和~/AIsafe/SLU/SLU目錄下授權檔案(cd ~/AIsafe/ASR/ASR
執行下./machin_mark.sh,顯示授權的機器碼):WISEATC_auth.release;WISEATC_key.en;WISEATC_pub.key(2020-7起授權2年)

SDI是航跡引接 ;SCA是相似航班號告警; CDP是指令提取;CAP是指令告警;TCW是戰/術衝突告警;SSS內部監控程式。

2、識別引擎電腦VAD-10問題:透過Supervisor啟動VAD-10有時候識別不到正確的音效卡號,導致讀不到語音資料,透過終端啟動VAD-10沒這個問題。

3、audio_hmi.exe的配置檔案E:\wisesoft\HMI\public\resource\config\config.ini和E:\wisesoft\HMI\PUBLICS\resource\ini\code_config.ini配置檔案與audio_hmi.exe中“席位”通道例如9,10的配置有關。hmi“席位”顯示的通道號例如9,10,是code_config.ini中相關sector的index_no序號(整數,可以改為頻率,例如12375,但是導致沒有對應識別語音,所以還是使用原序號),sector名稱內容需與config.ini中Room1_Sectors = 一室|| ZBYN-ACC01|ZBYN-APP名稱一致,這樣就可以透過HMI的“主任席設定”選擇通道,選擇後需重新開啟“席位”生效。

4、HMI地圖背景扇區名稱顯示配置檔案E:\wisesoft\HMI\PUBLICS\resource\basedata\sector_conf.json

    "SectorName":"太原管制APP扇區 119.55"

5、audio_hmi.exe中“席位”中管制員、飛行員圖示的配置使用絕對路徑:E:\wisesoft\HMI\hmi\TSD\bin\atcspeechdlg.html,可按需要修改:

            var controllerHead = "<img src=' E:/wisesoft/HMI/hmi/TSD/resource/res/image/controller.jpg' width='40px' heigth='40px'/>";
            var pilotHead = "<img src='E:/wisesoft/HMI/hmi/TSD/resource/res/image/pilot.jpg' width='40px' heigth='40px'/>";


主題:

RabbitMQ--VAD_AGC.py

VAD_AGC.py

python VAD_AGC.py -n 9    // proc_index對應關係:GRP1<>VADOUT<>IDX 9 <>PACK0<>PS

啟動日誌:

C:\Users\hp\PycharmProjects\audiospace\SDI_WIN\SDI\Scripts\python.exe "E:\JetBrains\PyCharm Community Edition 2019.3.1\plugins\python-ce\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 2826 --file E:/wisesoft/VAD/ASR/VAD/VAD_AGC.py
pydev debugger: process 5748 is connecting

Connected to pydev debugger (build 193.5662.61)
{'unit_name': 'ZBYN', u'db_host': u'192.168.1.90', 'file_name': './2018-11-10_09.wav', 'mq_pack': '0', u'mq_group': '1', u'db_usr': u'root', 'network_cfg': '192.168.1.90:12000:81920', 'mq_index': '1', 'mq_user': 'mqadmin', u'mq_server': u'server1', '20': {'sector': 'ZUUU-ACC20', 'group_no': '1', 'index_no': '20', 'package_index': '0'}, '21': {'sector': 'ZUUU-ACC21', 'group_no': '1', 'index_no': '21', 'package_index': '0'}, '22': {'sector': 'ZUUU-ACC22', 'group_no': '1', 'index_no': '22', 'package_index': '0'}, 'up_channel': False, 'audio_input_device': 0, 'proc_name': 'VAD', 'mq_config': '192.168.1.90:5672', '1': {'sector': 'ZBYN-ACC01', 'group_no': '1', 'index_no': '1', 'package_index': '0'}, '3': {'sector': 'ZBYN-ACC03', 'group_no': '1', 'index_no': '3', 'package_index': '0'}, '2': {'sector': 'ZBYN-ACC02', 'group_no': '1', 'index_no': '2', 'package_index': '0'}, '5': {'sector': 'ZUUU-ACC05', 'group_no': '1', 'index_no': '5', 'package_index': '0'}, '4': {'sector': 'ZBYN-ACC04', 'group_no': '1', 'index_no': '4', 'package_index': '0'}, '7': {'sector': 'ZUUU-ACC07', 'group_no': '1', 'index_no': '7', 'package_index': '0'}, '6': {'sector': 'ZUUU-ACC06', 'group_no': '1', 'index_no': '6', 'package_index': '0'}, '9': {'sector': 'ZUUU-ACC09', 'group_no': '1', 'index_no': '9', 'package_index': '0'}, 'data_savedir': './data', 'input_mode': 'audio', 'pub2mq': True, 'agc_proc': 'false', 're_rate': 'false', u'db_psw': u'123456', u'db_port': 3306, 'mq_password': 'wiseatc123', u'mq_cnf': u'E:/wisesoft/VAD/PUBLIC/mq/mq_config.json', '8': {'sector': 'ZUUU-ACC08', 'group_no': '1', 'index_no': '8', 'package_index': '0'}, 'mq_channel': 'VADOUT', '11': {'sector': 'ZUUU-ACC11', 'group_no': '1', 'index_no': '11', 'package_index': '0'}, '10': {'sector': 'ZUUU-ACC10', 'group_no': '1', 'index_no': '10', 'package_index': '0'}, '13': {'sector': 'ZUUU-ACC13', 'group_no': '1', 'index_no': '13', 'package_index': '0'}, '12': {'sector': 'ZUUU-ACC12', 'group_no': '1', 'index_no': '12', 'package_index': '0'}, '15': {'sector': 'ZUUU-ACC15', 'group_no': '1', 'index_no': '15', 'package_index': '0'}, '14': {'sector': 'ZUUU-ACC14', 'group_no': '1', 'index_no': '14', 'package_index': '0'}, '17': {'sector': 'ZUUU-ACC17', 'group_no': '1', 'index_no': '17', 'package_index': '0'}, '16': {'sector': 'ZUUU-ACC16', 'group_no': '1', 'index_no': '16', 'package_index': '0'}, '19': {'sector': 'ZUUU-ACC19', 'group_no': '1', 'index_no': '19', 'package_index': '0'}, '18': {'sector': 'ZUUU-ACC18', 'group_no': '1', 'index_no': '18', 'package_index': '0'}, '23': {'sector': 'ZUUU-ACC23', 'group_no': '1', 'index_no': '23', 'package_index': '0'}, u'db_dbname': u'voiceDatabase', 'channel_id': 0, 'proc_index': 1, 'save_rawdata': 'true', 'save_vaddata': 'true', 'use_default_device': 'true'}
('network receiving config', '192.168.1.90', 12000, '81920')
('PLATFORM type', 'WIN')
('versioninfo', 'VAD_1|    _20190910')
extract success!!!
calc features, cost=0.0s
('input mode:', 'audio')
2020-07-22 02:45:50,556|INFO   |(pika.adapters.base_connection)| Connecting to 192.168.1.90:5672
2020-07-22 02:45:50,566|INFO   |(pika.adapters.blocking_connection)|Created channel=1
2020-07-22 02:45:50,566|INFO   |(pika.adapters.base_connection)|Connecting to 192.168.1.90:5672
2020-07-22 02:45:50,576|INFO   |(pika.adapters.blocking_connection)|Created channel=2
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|send_channel:<pika.adapters.blocking_connection.BlockingChannel object at 0x06B400F0>
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|recv_channel:<pika.adapters.blocking_connection.BlockingChannel object at 0x06B40030>
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)| Mq client 0.0.1 initialized by process VAD...                
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|Receive message from []...
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|Send message to [u'VADOUT']...
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)| Mq server 192.168.1.90 initialized...
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|Mq server 192.168.1.90 initialized...
2020-07-22 02:45:50,576|INFO   |(VAD_AGC.py)|PS interface for emit message GRP1<>VADOUT<>IDX1<>PACK0<>PS declared...
('[2020-07-22 02:45:51] start fetching speech:', 2160, 0.21)
('[2020-07-22 02:45:51] done fetching speech:', 8880, 1.11)
 *: IDX1---其中1是proc_index

self.index_no if proc_index == -1 else proc_index,

------->E:\wisesoft\VAD\PUBLIC\mq\mq.py----配置檔案mq_config.json

from PUBLIC.mq import mq
#print('aaa', args['proc_name'],args['mq_group'],args['mq_index'],args['mq_pack'] )
channel = mq.mq_client(str_proc_name=args['proc_name'], group_no=args['mq_group'],
                            index_no=args['mq_index'], package_index = args['mq_pack'],
                            config=args['mq_cnf'], mq_server=args['mq_server'],
                            send_log=True)
class mq_client(object):
self._init_mq_message_routine() 
def _init_mq_message_routine( self ):
----->self.mq_pc.declare_emit_interface( msg_name )
def declare_emit_interface( self, str_msg_name ):
    #declare publish and subscribe interface ( 1 to many)
    self._handler_dict[str_msg_name] = self.send_channel
    str_msg_name = self.get_full_channel_mark( str_msg_name, 'PS', index_flag=True )  //GRP1<>VADOUT<>IDX1<>PACK0<>PS
    self.send_channel.exchange_declare(exchange=str_msg_name, exchange_type='fanout')
    logger.info( 'PS interface for emit message {} declared...'.format( str_msg_name ) )
    pass
    
def get_full_channel_mark( self, str_msg_name, mode, index_flag=False, proc_index=-1,):
    if index_flag:
        return 'GRP{}<>{}<>IDX{}<>PACK{}<>{}'.format(
            self.group_no, str_msg_name, self.index_no if proc_index == -1 else proc_index, self.package_index, mode )
    else:
        return 'GRP{}<>{}<>PACK{}<>{}'.format(
            self.group_no, str_msg_name, self.package_index, mode )

產生 GRP1<>VADOUT<>IDX1<>PACK0<>PS

1、讀取配置檔案

from public import config_parse
args = config_parse.read_ini(project_type = 'VAD',ini_path = 'VAD.ini')

E:\wisesoft\VAD\PUBLIC\mq\mq_config.json

[VAD]
proc_name = VAD
channel_id = 0
input_mode = audio
network_cfg = 192.168.1.90:12000:81920
audio_input_device = 0
file_name = ./2018-11-10_09.wav
unit_name = ZBYN
mq_config = 192.168.1.90:5672         
mq_user = mqadmin
mq_password = wiseatc123
mq_channel = VADOUT
agc_proc = false
re_rate = false
pub2mq = true
data_savedir = ./data
save_vaddata = true
save_rawdata = true
use_default_device = true

根據配置檔案連線RabbitMQ埠5672

Microsoft Windows [版本 6.1.7601]
C:\Users\hp>netstat -ano|findstr 5672
  TCP    192.168.1.91:2571      192.168.1.90:5672      ESTABLISHED     4568
  TCP    192.168.1.91:2572      192.168.1.90:5672      ESTABLISHED     4568


2、RabbitMQ

Channel:192.168.1.91:2571

channel.basic_publish(=args[]==pubstr)

exchange:

name :GRP1<>VADOUT<>IDX 1<>PACK0<>PS

type:fanout

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7970627/viewspace-2706118/,如需轉載,請註明出處,否則將追究法律責任。