All Projects → ahirner → room-glimpse

ahirner / room-glimpse

Licence: MIT license
Read what your Raspberry Pi sees (picamera + Azure Cognitive / IoT)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to room-glimpse

piCamBot
Security camera based on a raspberry pi and Telegram, controllable by smartphone
Stars: ✭ 43 (+186.67%)
Mutual labels:  motion, pi-camera
vue-motion-one
Animation library for Vue 3 based on Motion One.
Stars: ✭ 152 (+913.33%)
Mutual labels:  motion
virt-backup
Fully backup your KVM Virtual Machines
Stars: ✭ 27 (+80%)
Mutual labels:  snapshot
AppDynamics.DEXTER
Turn your APM data store into a Data Warehouse with advanced reporting, including entities, configuration, metrics, flowmaps, events, snapshots and call graph flame graphs
Stars: ✭ 79 (+426.67%)
Mutual labels:  snapshot
TextMood
A Xamarin + IoT + Azure sample that detects the sentiment of incoming text messages, performs sentiment analysis on the text, and changes the color of a Philips Hue lightbulb
Stars: ✭ 52 (+246.67%)
Mutual labels:  cognitive-services
dify
A fast pixel-by-pixel image comparison tool in Rust
Stars: ✭ 41 (+173.33%)
Mutual labels:  snapshot
Human body prior
VPoser: Variational Human Pose Prior
Stars: ✭ 244 (+1526.67%)
Mutual labels:  motion
WebCamCap
Motion capture tool for 2D/3D motion capture with LED markers.
Stars: ✭ 20 (+33.33%)
Mutual labels:  motion
resource-translator
A GitHub Action that automatically creates machine-translated PRs of translation files. Supported file formats include, .ini, .po, .restext, .resx, .xliff .json.
Stars: ✭ 44 (+193.33%)
Mutual labels:  cognitive-services
AI-on-Microsoft-Azure
Microsoft buduje i tworzy Polską Dolinę Cyfrową. W ramach tej inicjatywy podjęliśmy się wyzwania zbudowania chmurowych kompetencji wśród 150tys osób w Polsce. Jednym z elementów tej inicjatywy jest dedykowany kurs na studiach inzynierskich i magisterskich na Politechnice Warszawskiej poświęcony chmurze obliczeniowej oraz sztucznej inteligencji.
Stars: ✭ 11 (-26.67%)
Mutual labels:  cognitive-services
iot-workshop
A complete IoT Workshop
Stars: ✭ 42 (+180%)
Mutual labels:  cognitive-services
opensim-moco
Solve optimal control problems for musculoskeletal models using OpenSim and direct collocation.
Stars: ✭ 45 (+200%)
Mutual labels:  motion
OCRVisualizer
Microsoft Cognitive Services, Computer Vision API, OCR Visualizer on documents
Stars: ✭ 19 (+26.67%)
Mutual labels:  cognitive-services
Juicer
Juicer is a generic animation / motion library for macOS & iOS & tvOS written in Swift
Stars: ✭ 13 (-13.33%)
Mutual labels:  motion
GradleMavenPush
Helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories).
Stars: ✭ 21 (+40%)
Mutual labels:  snapshot
use-spring
Hooke's law hook
Stars: ✭ 53 (+253.33%)
Mutual labels:  motion
MaratonaBots
Códigos em Node.js da Maratona Bots
Stars: ✭ 29 (+93.33%)
Mutual labels:  cognitive-services
snapshot
Adds value / object / DOM element snapshot testing support to Cypress test runner
Stars: ✭ 114 (+660%)
Mutual labels:  snapshot
ReactZooApp
ReactZooApp
Stars: ✭ 33 (+120%)
Mutual labels:  motion
dynamic-motion
Provide additional functionality to Android MotionLayout.
Stars: ✭ 34 (+126.67%)
Mutual labels:  motion

A fun IoT app using a Raspberry Pi + camera. The app detects motion from the h264 encoder with little CPU drain. A first snapshot is taken once the total motion in the video stream exceeds a certain threshold. A second snapshot is taken after the scene becomes static again. Finally, the second snapshot is analyzed. Thus, this Thing of the Internet is a (wonky) surveillance camera and a selfie-machine at the same time --however you want to view it. The purpose was to demo Azure IoT and cognitive services on top of building an image acquisition framework for the RPi.

Automatic Image Captioning

The importance of (data) privacy grows daily, but having a NN talk about its observations might just be ok... Thus, snapshots get only persisted on the local file system. The gist of the second snapshot is extracted by Microsoft's computer vision API. This gist consists of tags, categories and a caption from the second snapshot. It is passed on to the cloud.

IoT Telemetry:

Next to the description and other features at the end of the scene, telemetry includes motion vectors for each frame during a scene. Learning gestures from this dataset would be even more fun! I wanted to try Azure's IoT Hub for data ingestion. All data mentioned above is forwarded via device-to-cloud-messages.

Example

I'm entering the living room from the left alt-text

The motion detector triggers the first snapshot to be stored on the RPi. At the same time, motion vector data from each video frame is forwarded to the cloud asynchronously.

I pause to complete the scene
alt-text

    caption: 'a man that is standing in the living room'
    confidence: 0.1240666986256891
    tags: 'floor', 'indoor', 'person', 'window', 'table', 'room', 'man', 'living', 'holding', 'young', 'black', 'standing', 'woman', 'dog', 'kitchen', 'remote', 'playing', 'white'

This is how the second snapshot is described by Azure's cognitive API. Fair enough... Unfortunately, the caption doesn't mention my awesome guitar performance. The description of the scene and meta-information like timestamps are dispatched whereas recording motion-data stops.

I leave the room after much applause 👏👏👏 (snapshot omitted)...

After no motion was detected for a set amount of time (0.75 secs in that case), another scene is analyzed.

Now it's just the the bare room
alt-text

    caption: 'a living room with hard wood floor'
    confidence: 0.9247661343688557
    tags: 'floor', 'indoor', 'room', 'living', 'table', 'building', 'window', 'wood', 'hard', 'wooden', 'sitting', 'television', 'black', 'furniture', 'kitchen', 'small', 'large', 'open', 'area', 'computer', 'view', 'home', 'white', 'modern', 'door', 'screen', 'desk', 'laptop', 'dog', 'refrigerator', 'bedroom'

This time, the description is pretty accurate (and confident).

Installation

  • Setup an Azure IoT Hub and add the RPi as a device.
  • git clone https://github.com/ahirner/room-glimpse.git
  • Create credentials.py in ./creds with the Azure Cognitive API key, the IoT device ID and a device connection string.
AZURE_COG_KEY= 'xxx'
AZURE_DEV_ID= 'yyy'
AZURE_DEV_CONNECTION_STRING='HostName=zzz.azure-devices.net;SharedAccessKeyName=zzz;SharedAccessKey=zzz='
  • Install missing modules (requirements.txt tbd)
  • Start with python3 room-glimpse.py

Only the HTTP API is used for now. The dedicated azure-iot-python SDK can control batching more effectively, use MQTT for less overhead but is not yet available via pip3 on Unix.

Configuration for the video stream, motion thresholds and cloud endpoints are in config.py.

More ideas

  1. Of course, nothing prevents you from running/training your own version of a talking NN. In fact, this project is a vantage point to try pushing computing on the edge. Sam maintains a pip wheel to install TensorFlow on the little RPi. Pete Warden has done amazing work recently to trim down NNs in a principled way (e.g. quantization for fixed point math).

  2. In general, make use of spare cores. Most of the time, the CPU idles at 15% (remember the h264 motion detection). So there is plenty of room left for beefier tasks on the edge.

  3. Overlay motion vectors in a live web view (there is a 2D vector for each 16x16 macro block).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].