Coder Social home page Coder Social logo

biosensor's Introduction

Goal

Automated real-time detection and classification of multiple bird species in the form of a logical event stream.

process

Design

  1. Hardware. Output: photo/video/audio stream
  2. Object detection/classification
  3. Sharing/reporting

Run

Purchase Camera Components

Cost: ~$100

  1. rpi 3 or rpi 2 + usb wifi and power cable ~$50
  2. 32GB sdcard ~$10
  3. rpi camera module ~$25
  4. project box $6
  5. mini tripod, security camera mount or other stand ~$10

Get Camera Running

Cost: 1-2 hours

  1. Download Raspbian OS and install to sdcard
  2. Plug in network, power cable, sdcard and boot up rpi
  3. Associate rpi w/ local access point, reboot and make sure it connects
    ...in /etc/network/interfaces
    allow-hotplug wlan0
    iface wlan0 inet manual
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    ...in /etc/wpa_supplicant/wpa_supplicant.conf
    country=US
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
        ssid="yournetworkssidgoeshere"
        psk="passwordgoeshere"
    }
    
  4. Get latest software sudo apt-get update and sudo apt-get upgrade and reboot
  5. Enable camera sudo raspi-config select option 5 and reboot
  6. Test that camera works. TODO: explicit instructions

Assemble Camera Case and Mount

Cost: an afternoon

  1. Put Raspberry Pi in project box and figure out where all the holes go :)
  2. camera
  3. power cable
  4. mount
  5. Drill holes in project box
  6. Mount camera using padding and tape
  7. Run the power cable and test that Raspberry Pi boots up and camera works
  8. Screw in the mount and seal up the project box. Not too well, you may have to get back in there.
  9. Test that the camera works
  10. Place/mount camera where you want it
  11. Test it again. Repeat as necessary until mounted and tested successfully.

Install biosensor Service

Cost: 5 minutes

ssh [email protected]
mkdir -p ~/src && cd src/
git clone [email protected]:rflynn/biosensor.git && cd biosensor/
make install
sudo make /etc/init.d/biosensor
sudo reboot

Photo Review and Labelling

Cost: untold hours drawing boxes around birds

# sync biosensor photos to workstation
mkdir -p photos/
rsync -av [email protected]:src/biosensor/photos/ photos/

# set up labelImg app and classes
test -d ~/src/labelImg || git clone https://github.com/tzutalin/labelImg.git ~/src/labelImg
cat ~/src/labelImg/data/predefined_classes.txt

# run labelImg and manually label images
~/src/labelImg/labelImg.py

# xml labels -> cropped images
(cd detect/ && python gen_vid_tag_cropped.py)

# sync cropped images to aws
make vid-tag-sync

Build object detector/classifier using labelled images

Cost: unknown

TODO:

Hardware

echo disable_camera_led=1 >> /boot/config.txt

ref: http://shallowsky.com/blog/hardware/raspberry-pi-noir.html

# echo bcm2708_wdog | sudo tee -a /etc/modules
sudo modprobe bcm2835_wdt
sudo apt-get install -y watchdog
vim /etc/watchdog.conf  # edit 'ping' lines...
...edit /lib/systemd/system/watchdog.service and add line "WantedBy=multi-user.target" under [Install]
...edit sudo vim /etc/default/watchdog and change line to watchdog_module="bcm2835_wdt"
sudo systemctl enable watchdog.service
sudo systemctl start watchdog.service
echo "dtparam=watchdog=on" >> /boot/config.txt
sudo reboot

ref: http://blog.ricardoarturocabral.com/2013/01/auto-reboot-hung-raspberry-pi-using-on.html

rsync -av [email protected]:src/biosensor/photos/ photos/
(cd detect/ && python gen_vid_tag_cropped.py)

measure cpu/gpu temp:

cat /sys/class/thermal/thermal_zone0/temp  # cpu
vcgencmd measure_temp  # gpu

sunrise/sunset http://www.risacher.org/sunwait/

Detection/Classification

Images/Video

How do we identify stuff?

ref: https://www.quora.com/How-should-I-label-image-data-for-machine-learning

How should I label image data for machine learning? Train a classifier on only some of the frames. Then write a program that uses the classifier to display the location of the car in a movie. Use that movie to find failure frames and fix the labels for some of those frames. Then retrain the classifier. Repeat this a few times and your classifier will be pretty good (if you use a good algorithm).

find files with a given OS X color tag

mdfind 'kMDItemUserTags == Red'
# concatenate JPEGs into a video
ffmpeg -pattern_type glob -i '2016-10-20-09-*.jpg' -r 30 -c:v libx264 9am.mp4

# https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors
ffmpeg -flags2 +export_mvs -i 9am.mp4 -vf codecview=mv=pf+bf+bb 9am-motionvectors.mp4

# 
ffmpeg -i 9am.mp4 -vf "select=gt(scene\,0.01),setpts=N/(25*TB)" 9am-scenefilter-01.mp4
# helps filter out static shots, but isn't smart enough to deal with light-level changes. motion vectors would be preferred

# chain them both together...
ffmpeg -i 9am.mp4 -vf "select=gt(scene\,0.01),setpts=N/(25*TB)" -f h264 pipe:1 | ffmpeg -y -flags2 +export_mvs -i - -vf codecview=mv=pf+bf+bb 9am-scene-01-motionvectors.mp4

# what i want
ffmpeg -i 9am.mp4 -flags2 +export_mvs -vf "select=gt(mv\,1),setpts=N/(25*TB)" 9am-scene-01-motionvectors.mp4

Audio

How does one detect bird calls in an audio file?

  1. https://humblesoftwaredev.wordpress.com/2016/05/02/an-audio-dataset-and-ipython-notebook-for-training-a-convolutional-neural-network-to-distinguish-the-sound-of-foosball-goals-from-other-noises-using-tensorflow/
    1. https://github.com/dk1027/ConvolutionalNeuralNetOnFoosballSounds
  2. https://www.lunaverus.com/cnn
  3. https://www.kaggle.com/c/mlsp-2013-birds
  4. http://stackoverflow.com/questions/22471072/convolutional-neural-network-cnn-for-audio

Sharing/Reporting

...

References

  1. http://www.makeuseof.com/tag/raspberry-pi-camera-module/
  2. http://simplecv.org/
  3. https://web.wpi.edu/Pubs/E-project/Available/E-project-042910-001603/unrestricted/Bird_Call_Identification_MQP_2010.pdf
  4. http://csgrid.org/csg/wildlife/
  5. http://www.xeno-canto.org/explore/region
  6. https://en.wikipedia.org/wiki/Bioacoustics
  7. http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/

biosensor's People

Contributors

rflynn avatar

Watchers

 avatar  avatar  avatar

biosensor's Issues

at night the mo-cap triggers takes too many false positives

there's no motion at all in these photos taken at dusk:

screen shot 2016-12-30 at 4 53 27 pm

i'm guessing it's due to the reduced sensitivity in the camera triggering noise which triggers perceived large amounts of small perceived motion across the image.

at the moment we use a dumb set of total motion vector metadata to "sense" motion -- it may help to look at the locality of the vectors rather than just their number to tell the difference between an on-screen animal and the noise difference between 2 blurry low-light photos.

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.