Giter Club home page Giter Club logo

laugh-finder's Introduction

Laugh Finder

A machine learning program for human laughter detection.

Setup

  1. Install Python 3.4.3 or later
  2. Install Python's SciPy package and related NumPy package
  • If using Windows, access NumPy and SciPy wheels here
    • Note your version of Python and architecture (i.e., 32-bit v. 64-bit)
  1. Install WEKA

Using the Programs

Training

Generate .arff File for WEKA

  1. Run main.py under the python-training folder
  2. In the GUI, click "Browse" next to "File with laughter audio file names"
  3. Select the file containing a series of paths to laughter training files
  4. Click "Browse" next to "File with non-laughter audio file names"
  5. Select the file containing a series of paths to non-laughter training files
  6. Click "Prepare" to generate a wekaFile.arff file within the same directory as main.py

Using WEKA

  1. Run WEKA using the following command:
  • java -Xmx512m -classpath /location/of/weka/jar/weka.jar weka.gui.GUIChooser
  1. In the GUI, click the "Explorer" button
  2. Under the "Preprocess" tab, click the "Open file..." button
  3. Select the wekaFile.arff file generated earlier
  4. Under the "Classify" tab, select "Choose" under "Classifier"
  5. To use K-nearest neigbors algorithm: under "lazy", select "IBk"
  6. Press "Start"
  7. After the classification is finished, right-click the output in "Result List" and click "Save Model"

Testing

  1. Run main.py under the python-testing folder
  • Include the following params:
    • --phase 0; for testing algorithm
    • --audio /path/to/audio.wav; the audio file you want to examine
      • .wav files only, not 24 bit depth (limitation of SciPy)
    • --arff /path/to/arff/result.arff; the result .arff file from training

Re-Training

  1. Change file paths in Constants.java accordingly, relative to the values of your machine
  2. Compile and run the WavReader main class (include the weka.jar to your classpath)
  3. Run the main Java file
  4. In the GUI, select the audio file containig the laughter segments to be identified
  5. Click the "Get Laughter Segments" button
  6. You will be presented with a series of snippets identified as laughter, select each one that is correctly identified
  7. Click the retrain model process
  8. The re-trained model will be placed in the same directory as the old model (see Constants.java)

Useful Commands

ffmpeg

If you are using a Macintosh, you can install ffmpeg using Homebrew

  • brew install ffmpeg

Using that application, you can do the following:

  • Split a wav file into segments

    • ffmpeg -i audio.wav -f segment -segment_time 0.5 -c copy parts/out%03d.wav
  • Find the exact duration of a wav file

    • ffmpeg -i audio.wav 2>&1 | grep Duration | awk '{print $2}' | tr -d ,
  • Cut for a given duration of a wav file

    • ffmpeg -i audio.wav -ss 00:00:07.100 -t 00:00:01.1 audio.wav
  • Convert .mp4 to .wav

    • ffmpeg -i sourcefile.mp4 destination.wav

Reading

laugh-finder's People

Contributors

milesdowe avatar milesdowe-hal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laugh-finder's Issues

Symbol not found: ___addtf3

Hi Guys,

Anyone seen this error ? How did u fix it?

ImportError: dlopen(/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/_fblas.cpython-36m-darwin.so, 2): Symbol not found: ___addtf3
Referenced from: /Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/../.dylibs/libquadmath.0.dylib
Expected in: /usr/local/lib/libgcc_s.1.dylib
in /Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/../.dylibs/libquadmath.0.dylib
(laughenv) rockmac:python-training rock$ python3 main.py
Traceback (most recent call last):
File "main.py", line 6, in
from file_feature_extraction import file_feature_extraction
File "/Users/rock/laugh/laugh-finder/python-training/file_feature_extraction.py", line 1, in
import scipy.io.wavfile as wavfile
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/io/init.py", line 97, in
from .matlab import loadmat, savemat, whosmat, byteordercodes
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/io/matlab/init.py", line 13, in
from .mio import loadmat, savemat, whosmat
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 12, in
from .miobase import get_matfile_version, docfiller
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/io/matlab/miobase.py", line 22, in
from scipy.misc import doccer
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/misc/init.py", line 53, in
from scipy.interpolate._pade import pade
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/interpolate/init.py", line 176, in
from .interpolate import *
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 20, in
import scipy.linalg
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/init.py", line 175, in
from .misc import *
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/misc.py", line 5, in
from .blas import get_blas_funcs
File "/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/blas.py", line 155, in
from scipy.linalg import _fblas
ImportError: dlopen(/Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/_fblas.cpython-36m-darwin.so, 2): Symbol not found: ___addtf3
Referenced from: /Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/../.dylibs/libquadmath.0.dylib
Expected in: /usr/local/lib/libgcc_s.1.dylib
in /Users/rock/laugh/laugh-finder/python-training/laughenv/lib/python3.6/site-packages/scipy/linalg/../.dylibs/libquadmath.0.dylib

Thanks
Rock

ValueError: embedded null character

Try to prepare files with README:

  1. Run main.py under the python-training folder
  2. In the GUI, click "Browse" next to "File with laughter audio file names"
  3. Select the file containing a series of paths to laughter training files
  4. Click "Browse" next to "File with non-laughter audio file names"
  5. Select the file containing a series of paths to non-laughter training files
  6. Click "Prepare" to generate a wekaFile.arff file within the same directory as main.py.

But I have an error:

File "C:\Users\...\Python\Python37\lib\site-packages\scipy\io\wavfile.py", line 544, in read
    fid = open(filename, 'rb')
ValueError: embedded null character.

How can I solve this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.