Skip to content

Commit 3f4be0d

Browse files
Added Sound Detector & Sensor
1 parent b2a36b2 commit 3f4be0d

24 files changed

+739
-0
lines changed

audio_detect/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 adolf69
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

audio_detect/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
:exclamation::exclamation: **This repo will no longer be maintained, please visit https://github.com/milvus-io/bootcamp** :exclamation: :exclamation:
2+
3+
# Audio search system with Milvus
4+
5+
This project uses [PANNs](https://github.com/qiuqiangkong/audioset_tagging_cnn)(Large-Scale Pretrained Audio Neural Networks) for Audio Pattern Recognition to perform audio tagging and sound event detection, finally obtaining audio embeddings. Then this project uses [Milvus](https://milvus.io/docs/v0.11.0/overview.md) to search for similar audio clips.
6+
7+
## Local Deployment
8+
9+
### Requirements
10+
11+
- [Milvus 0.10.5](https://milvus.io/docs/v0.10.5/milvus_docker-cpu.md) (please note the Milvus version)
12+
- [MySQL](https://hub.docker.com/r/mysql/mysql-server)
13+
- [Python3](https://www.python.org/downloads/)
14+
15+
### Run Server
16+
17+
1. **Install python requirements**
18+
19+
```bash
20+
$ cd bootcamp/solutions/audio_search/webserver/
21+
$ pip install -r audio_requirements.txt
22+
```
23+
24+
2. **Modify configuration parameters**
25+
26+
Before running the script, please modify the parameters in **webserver/audio/common/config.py**:
27+
28+
| Parameter | Description | Default setting |
29+
| ------------ | ------------------------- | --------------- |
30+
| MILVUS_HOST | milvus service ip address | 127.0.0.1 |
31+
| MILVUS_PORT | milvus service port | 19530 |
32+
| MYSQL_HOST | mysql service ip | 127.0.0.1 |
33+
| MYSQL_PORT | mysql service port | 3306 |
34+
| MYSQL_USER | mysql user name | root |
35+
| MYSQL_PWD | mysql password | 123456 |
36+
| MYSQL_DB | mysql datebase name | mysql |
37+
| MILVUS_TABLE | default table name | milvus_audio |
38+
39+
3. **Star server**
40+
41+
```bash
42+
$ cd webserver
43+
$ python main.py
44+
```
45+
46+
## System Usage
47+
48+
Type `127.0.0.1:8002/docs` in your browser to see all the APIs.
49+
50+
![](./pic/all_API.png)
51+
52+
- Insert data.
53+
54+
Download the sample [game_sound.zip](https://github.com/shiyu22/bootcamp/blob/0.11.0/solutions/audio_search/data/game_sound.zip?raw=true) and upload it into the system.
55+
56+
> The sound data in the zip archive must be in wav format.
57+
58+
![](./pic/insert.png)
59+
60+
- Search for similar audio clips.
61+
62+
You can upload [test.wav](https://github.com/shiyu22/bootcamp/blob/0.11.0/solutions/audio_search/data/test.wav) to search for the most similar sound clips.
63+
64+
![](./pic/search.png)
65+
66+
Please refer to https://zilliz.com/demos/ to take a try in the front-end interface.

audio_detect/data/game_sound.zip

7.12 MB
Binary file not shown.

audio_detect/data/test.wav

31.5 KB
Binary file not shown.

audio_detect/pic/all_API.png

74.6 KB
Loading

audio_detect/pic/insert.png

91.4 KB
Loading

audio_detect/pic/search.png

96 KB
Loading

audio_detect/webserver/audio/__init__.py

Whitespace-only changes.

audio_detect/webserver/audio/common/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
from milvus import *
3+
4+
MILVUS_HOST = os.getenv("MILVUS_HOST", "127.0.0.1")
5+
MILVUS_PORT = os.getenv("MILVUS_PORT", 19530)
6+
VECTOR_DIMENSION = os.getenv("VECTOR_DIMENSION", 2048)
7+
METRIC_TYPE = os.getenv("METRIC_TYPE", MetricType.IP)
8+
TOP_K = os.getenv("TOP_K", 100)
9+
10+
UPLOAD_PATH = os.getenv("UPLOAD_PATH", "./tmp")
11+
DEFAULT_TABLE = os.getenv("DEFAULT_TABLE", "milvus_audio")
12+
13+
MYSQL_HOST = os.getenv("MYSQL_HOST", "127.0.0.1")
14+
MYSQL_PORT = os.getenv("MYSQL_PORT", 3306)
15+
MYSQL_USER = os.getenv("MYSQL_USER", "root")
16+
MYSQL_PWD = os.getenv("MYSQL_PWD", "123456")
17+
MYSQL_DB = os.getenv("MYSQL_DB", "mysql")

0 commit comments

Comments
 (0)