Skip to content

Commit

Permalink
Merge pull request #1 from konpsar/main
Browse files Browse the repository at this point in the history
Creation of GUI (PyQt5)
  • Loading branch information
konpsar committed May 19, 2021
2 parents 610c6ba + 6f1e33f commit 9a60a69
Show file tree
Hide file tree
Showing 18 changed files with 747 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

*.pyc
*.wav
*.txt
drafts/
documentation/
78 changes: 67 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,82 @@ After installation, "anaconda prompt" will show up in the program list.
successfully.
-----
## Running the algorithm on your data
The system should be ready to run by now. You can run the tool by calling "run_cough_detection.py" function.
The system should be ready to run by now. You can run the tool by calling "run_cough_detection.py" function for the command line version or "run_cough_detection_gui.py" for the GUI version.
1) Open anaconda prompt and navigate to the source code.
2) Run the code by passing as argument the path of the folder which contains the recordings to be analyzed.

<img src="doc/images/3.png" width="500">

2) 1) Run the command line version by passing as argument the path of the folder which contains the recordings to be analyzed.
For example, if the path is "D:/audio/saw_recordings/RP10", then we can simply type (in anaconda prompt):
```sh
python run_cough_detection.py D:/audio/domestic_recordings/
```
* The path of the folder which contains the recordings is the only mandatory input argument.
* An additional parameter is:
```sh
python run_cough_detection.py D:/audio/domestic_recordings/
```

<img src="doc/images/2.png" width="500">

* The path of the folder which contains the recordings is the only mandatory input argument.
* An additional parameter is:

* **Number of threads** to be used. For example, if we want to engage 8 threads, we can type:
```sh
python run_cough_detection.py D:/audio/domestic_recordings/ -t 8
```

* After waiting an amount of time a proportionate to the number of input files, execution will be completed and you will see results printed in anaconda prompt. If you finished the analysis, you can quit anaconda prompt.

<img src="doc/images/9.png" width="500">

2) Run the graphical version of the tool by running:
```sh
python run_cough_detection_gui.py
```
<!-- - ![First Ui Screen](doc/images/6.PNG) -->
<img src="doc/images/6.png" width="400">

* Click «Select directory» to choose the directory which contains the input files for the algorithm. A file dialog will open and you can navigate through your drives to find desired folder. (Note: Apart from the selected root directory, .wav files from all the subdirectories will also be included.

* After choosing the desired directory, .wav files that are going to be processed will appear in the text box «Files to be processed» and button "Run" will be activated. In case you have selected wrong directory, you can change by clicking «Change directory». You can also choose the number of threads to be used for the execution.

<img src="doc/images/7.png" width="400">

* After clicking "Run", GUI will disappear and execution continues on command prompt.

<img src="doc/images/8.png" width="500">

* When execution finishes, GUI will appear again presenting the results.

<img src="doc/images/11.png" width="400">

* Click "Select file" to activate the dropdown menu and navigate through results.
<img src="doc/images/12.png" width="400">

* When you select a file, all cough detections in this file will be presented in the followed text box. The three columns correspond to index, onset time, confident (How "sure" was the classifier about this detection). You can listen all cough detections from this wav file (merged) by clicking "Click to listen detections".

* If you click "Save as .txt", "Save as .xlsx", current showing results will be saved in the corresponding filetype and a message with the directory and the filename of the saved file will pop up.

<img src="doc/images/13.png" width="400">

* An example of an excel file exported through the tool:

<img src="doc/images/14.png" width="200">

* In case the following screen appeared after execution of the tool, no cough segments were detected through the analysis.

<img src="doc/images/10nores.png" width="400">



## OUTPUT

In both command line and GUI version of the tool, the output files are the same.
A folder named `CoughDetections` is created and all results are stored there. For each `.wav` file in the input folder, if one or more coughs are detected:
1) A `.txt` file will be exported which contains each cough instance's timestamp as well as the corresponding level of confidence the classifier has.
2) Additionaly a `.wav` file containing all the cough detections concatenated, is exported.
1. A `.txt` file will be exported which contains each cough instance's timestamp as well as the corresponding level of confidence the classifier has.
2. Additionaly a `.wav` file containing all the cough detections concatenated, is exported.
3. In the case of the GUI version, depending on user choices in the last step, output files could be more (e.g. one .xlsx file for each .wav file or extra .txt files for each recording)

-----


## License
MIT

Expand All @@ -48,7 +103,7 @@ Copyright (c) 2021 **Nikonas Simou, Nikolaos Stefanakis, Konstantinos Psaroulaki
--------
### How to reference
If you find any of this library useful for your research, please give cite as:
Nikonas Simou; Nikolaos Stefanakis; Panagiotis Zervas, ["A Universal System for Cough Detection in Domestic Acoustic Environments"](https://ieeexplore.ieee.org/document/9287659) in EUSIPCO 2020.
Nikonas Simou; Nikolaos Stefanakis; Panagiotis Zervas, ["A Universal System for Cough Detection in Domestic Acoustic Environments"] in EUSIPCO 2020.


#### Important notes:
Expand All @@ -61,3 +116,4 @@ The default value for `maxDur` is set to 600 seconds.


[anaconda]: <https://anaconda.org/>
["A Universal System for Cough Detection in Domestic Acoustic Environments"]: <https://ieeexplore.ieee.org/document/9287659>
Binary file added doc/images/10nores.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
argparse
audioread
soundfile
playsound
pandas
openpyxl
librosa
tensorflow >= 2.0
PyQt5
Binary file added resources/forth_disk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9a60a69

Please sign in to comment.