Skip to content

Commit

Permalink
fall-detect repo initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavikapanara committed Apr 21, 2021
1 parent ce3a1d9 commit fc2944b
Show file tree
Hide file tree
Showing 104 changed files with 10,255 additions and 0 deletions.
1 change: 1 addition & 0 deletions .peerjsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"peerId": "497c5e67-c347-4663-baec-fc7a0fa29a41"}
630 changes: 630 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at info@ambianic.ai. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# How to Contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://ambianic.ai/cla> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## Community Guidelines

This project follows [Google's Open Source Community
Guidelines](https://opensource.google.com/conduct/).
23 changes: 23 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| >= 1.0.0 | :white_check_mark: |
| < 1.0.0 | :x: |

## Reporting a Vulnerability

Please report vulnerabilities as a [new issue](https://github.com/ambianic/ambianic-edge/issues) using the BUG template with `security vulnerability` label.

<!--
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
-->
1 change: 1 addition & 0 deletions ai_models/pose_labels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 FALL
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions ambianic-attach.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
echo "Attaching shell to a running Ambianic docker image"
docker exec -it ambianic-edge-dev bash
2 changes: 2 additions & 0 deletions ambianic-deamon-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./start_ambianic.sh 1> ./data/out_err_log.txt 2>&1 &

43 changes: 43 additions & 0 deletions ambianic-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
set -ex

MY_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")
MY_DIR=$(dirname "${MY_PATH}")

# test if coral usb stick is available
USB_DIR=/dev/bus/usb

VIDEO_0=/dev/video0

if [ -d "$USB_DIR" ]; then
USB_ARG="--device $USB_DIR"
else
USB_ARG=""
fi


VC_SHARED_LIB=""
if grep -s -q "Raspberry Pi" /proc/cpuinfo;
then
VC_SHARED_LIB="-v /opt/vc:/opt/vc"
fi


if [ -e "$VIDEO_0" ]; then
VIDEO_ARG="--device $VIDEO_0"
else
VIDEO_ARG=""
fi

# check if there is an image update
docker pull ambianic/ambianic-edge:dev
# run dev image
docker run -it --rm \
--name ambianic-edge-dev \
--mount type=bind,source="$MY_DIR",target=/workspace \
$VC_SHARED_LIB \
--privileged \
--net=host \
$VIDEO_ARG \
$USB_ARG \
ambianic/ambianic-edge:dev
26 changes: 26 additions & 0 deletions ambianic-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -ex

MY_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")
MY_DIR=$(dirname "${MY_PATH}")

# test if coral usb stick is available
USB_DIR=/dev/bus/usb

if [ -d "$USB_DIR" ]; then
USB_ARG="--device $USB_DIR"
else
USB_ARG=""
fi

# check if there is an image update
docker pull ambianic/ambianic-edge:dev
# run dev image
docker run -it --rm \
--name ambianic-edge-dev \
--mount type=bind,source="$MY_DIR",target=/workspace \
-p 8778:8778 \
$USB_ARG \
ambianic/ambianic-edge:dev /workspace/src/run-dev.sh
# on Mac, --net=host doesnt work as expected
# --net=host \
41 changes: 41 additions & 0 deletions config.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Ambianic base config
dynaconf_merge: true
default:
data_dir: ./data

logging:
file: ./data/ambianic-log.txt
level: INFO

timeline:
event_log: ./data/timeline-event-log.yaml

notifications:
providers: {}
template:
title: "[Ambianic.ai] ${event} recognized"
body: >
${event} event has been recognized by the system.
Visit ${event_details_url} for more details.
sources: {}

ai_models:
image_detection:
model:
tflite: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_coco_quant_postprocess.tflite
edgetpu: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/coco_labels.txt
face_detection:
model:
tflite: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_face_quant_postprocess.tflite
edgetpu: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/coco_labels.txt
top_k: 2
fall_detection:
model:
tflite: /opt/ambianic-edge/ai_models/posenet_mobilenet_v1_100_257x257_multi_kpt_stripped.tflite
edgetpu: /opt/ambianic-edge/ai_models/posenet_mobilenet_v1_075_721_1281_quant_decoder_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/pose_labels.txt

pipelines: {}
98 changes: 98 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
######################################
# Ambianic main configuration file #
######################################
version: '2020.12.11'

# path to the data directory
data_dir: ./data

# Set logging level to one of DEBUG, INFO, WARNING, ERROR
logging:
file: ./data/ambianic-log.txt
level: INFO
# set a less noisy log level for the console output
# console_level: WARNING

# Store notifications provider configuration
# see https://github.com/caronc/apprise#popular-notification-services for syntax examples
# notifications:
# catch_all_email:
# include_attachments: true
# providers:
# - mailto://userid:pass@domain.com
# alert_fall:
# providers:
# - mailto://userid:pass@domain.com
# - json://hostname/a/path/to/post/to

# Pipeline event timeline configuration
timeline:
event_log: ./data/timeline-event-log.yaml

# Cameras and other input data sources
# Using Home Assistant conventions to ease upcoming integration
sources:

# direct support for raspberry picamera
picamera:
uri: picamera
type: video
live: true

# local video device integration example
webcam:
uri: /dev/video0
type: video
live: true

recorded_cam_feed:
uri: file:///workspace/tests/pipeline/avsource/test2-cam-person1.mkv
# type: video
# live: true

ai_models:
image_detection:
model:
tflite: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_coco_quant_postprocess.tflite
edgetpu: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/coco_labels.txt
face_detection:
model:
tflite: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_face_quant_postprocess.tflite
edgetpu: /opt/ambianic-edge/ai_models/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/coco_labels.txt
top_k: 2
fall_detection:
model:
tflite: /opt/ambianic-edge/ai_models/posenet_mobilenet_v1_100_257x257_multi_kpt_stripped.tflite
edgetpu: /opt/ambianic-edge/ai_models/posenet_mobilenet_v1_075_721_1281_quant_decoder_edgetpu.tflite
labels: /opt/ambianic-edge/ai_models/pose_labels.txt

# A named pipeline defines an ordered sequence of operations
# such as reading from a data source, AI model inference, saving samples and others.
pipelines:
# Pipeline names could be descriptive, e.g. front_door_watch or entry_room_watch.
area_watch:
- source: recorded_cam_feed
- detect_objects: # run ai inference on the input data
ai_model: image_detection
confidence_threshold: 0.6
# Watch for any of the labels listed below. The labels must be from the model trained label set.
# If no labels are listed, then watch for all model trained labels.
label_filter:
- person
- car
- save_detections: # save samples from the inference results
positive_interval: 300 # how often (in seconds) to save samples with ANY results above the confidence threshold
idle_interval: 6000 # how often (in seconds) to save samples with NO results above the confidence threshold
- detect_falls: # look for falls
ai_model: fall_detection
confidence_threshold: 0.6
- save_detections: # save samples from the inference results
positive_interval: 10
idle_interval: 600000
# notify: # notify a thirdy party service
# providers:
# - alert_fall


Empty file.
Empty file added data/ambianic-log.txt
Empty file.
Loading

0 comments on commit fc2944b

Please sign in to comment.