Code Monkey home page Code Monkey logo

embedded-sound-classifier's Introduction

Embedded sound classifier

Overview

This application uses the on-board MEMS microphone to collect audio samples, analyze them using a pre-trained neural network and send their classification on the serial port. A desktop python script takes care of reading the results.

Requirements

  • STM32F4 Discovery board (project has been developed using STM32F407VGT6)
  • For sound clasification (normal usage):
    • Python 3. You can check your version with python --V
    • pyserial: pip install pyserial
    • A RS232-USB cable
  • For neural network training:
    • Python 3, pyserial and RS232-USB cable as in previous case
    • Keras 2.2.4: pip install keras==2.2.4
    • Tensorflow 2.0.0-alpha0: pip install tensorflow==2.0.0-alpha0
    • GCC
  • For pre-trained Keras model to C conversion:
    • STMCubeMX
    • X-CUBE-AI: can be installed from within STMCubeMX
  • For embedded software compilation:

How to use

  • For sound classification (normal usage):
    1. Connect the serial cable pins to PA2 (board TX) and PA3 (board RX)
    2. Connect the board through USB cable
    3. Launch the client with python client.py serial_port_name, replacing serial_port_name with the name of the serial port (i.e /dev/tty, COM1)
    4. Press the board user button, do the desired sounds and press again the button to stop recording
  • For neural network training:
    1. Compile the FFT extraction program with gcc FFT_extract.c -o FFT_extract
    2. Connect the cables as in previous case
    3. Launch the FFT reciever with python FFT_receive.py serial_port_name
    4. Press the user button, do the desired sounds and press again the button to stop recording
    5. The results will be in the file fft.csv. They must be manually classified according to what they are: one last column has to be added and it must contain value 0 for silence, 1 for whistle or 2 for clap
    6. Go into the neural-network folder, place the new data in training_data.csv and run python trainer.py. The pre-trained model will output to file model.h5
  • For pre-trained Keras model to C library conversion: everything is explained in the docs/x-cube-ai.pdf file, provided by ST.
  • For embedded software compilation: use command make in the miosix-kernel folder or compile using your preferred CMake compatible IDE

embedded-sound-classifier's People

Contributors

mscuttari avatar nikolicmarina 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  avatar  avatar  avatar

Watchers

 avatar  avatar

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.