mrfakename commited on
Commit
a89fd96
·
verified ·
1 Parent(s): c14c4fe

Mirror wlc952/FunASR-bmodel from ModelScope

Browse files
Files changed (1) hide show
  1. README.md +81 -0
README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: unknown
3
+ ---
4
+
5
+ > Mirror of [wlc952/FunASR-bmodel](https://www.modelscope.cn/models/wlc952/FunASR-bmodel) from ModelScope. All credit to the original authors. Not an official release from them. No license was declared at the source; all rights remain with the original authors.
6
+
7
+ # FunASR-bmodel for monitor
8
+
9
+ ## 快速开始
10
+
11
+ ```sh
12
+ git lfs install
13
+ git clone https://www.modelscope.cn/wlc952/FunASR-bmodel.git
14
+
15
+ cd FunASR-bmodel
16
+ uv sync
17
+ source .venv/bin/activate
18
+
19
+ cd bmodel # 注意工作目录是 ./bmodel
20
+ python monitor.py --rtsp rtsp://127.0.0.1:8554/stream1 --system-audio ../system_ref.wav --system-phrases ../system_phrases.txt --chunk-seconds 10
21
+ ```
22
+
23
+ ## 说明
24
+
25
+ 1. 本python项目使用uv管理,请先安装uv。参考安装方式:
26
+
27
+ ```bash
28
+ # 推荐方式
29
+ curl -LsSf https://astral.sh/uv/install.sh | sh
30
+
31
+ # pipx 安装
32
+ sudo apt install pipx
33
+ pipx install uv
34
+ pipx ensurepath
35
+ ```
36
+
37
+ 2. 虚拟环境创建/同步
38
+
39
+ ```bash
40
+ uv sync
41
+ source .venv/bin/activate
42
+ ```
43
+
44
+ 3. 关键文件
45
+
46
+ - 模型测试脚本 `bmodel/offline.py` ,直接运行即可。
47
+
48
+ ```bash
49
+ cd bmodel
50
+ python offline.py
51
+ ```
52
+
53
+ - 对话监测脚本 `bmodel/monitor.py` ,运行方式如下
54
+
55
+ ```bash
56
+ cd bmodel
57
+ python monitor.py --rtsp rtsp://172.24.64.225:8554/stream1 --system-audio ../system_ref.wav --system-phrases ../system_phrases.txt --chunk-seconds 10
58
+ ```
59
+
60
+ 相关参数说明:
61
+
62
+ ```python
63
+ parser = argparse.ArgumentParser(description="监控场景下非系统人声检测与上报")
64
+ parser.add_argument("--rtsp", required=True, help="RTSP 地址,例如 rtsp://user:pass@ip:554/Streaming/Channels/101")
65
+ parser.add_argument(
66
+ "--system-audio",
67
+ default="../system_ref.wav",
68
+ help="系统参考音频,作为前置拼接,系统说话人 spk=0",
69
+ )
70
+ parser.add_argument("--out-dir", default="/data/alarms", help="告警本地保存目录 (已由 nginx 映射到 /static)")
71
+ parser.add_argument("--chunk-seconds", type=int, default=10, help="检测窗口秒数,默认 10s")
72
+ parser.add_argument(
73
+ "--system-phrases",
74
+ default="../system_phrases.txt",
75
+ help="系统提示词文本库(每行一条),用于过滤系统播报文本。如果系统声音错误上报,请将对应的识别文本加入到该文件。",
76
+ )
77
+ ```
78
+
79
+ 还有一些参数需要直接修改代码:
80
+ - ip修改:搜索并修改`get_local_ip_fallback()`
81
+ - POST信息修改:搜索并修改`def post_alert(safety_url: str, when: str, timeout: int = 2)`