-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 622d1c9
Showing
4,102 changed files
with
843,619 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
10,882 changes: 10,882 additions & 0 deletions
10,882
.ipynb_checkpoints/anomaly-detection-feature-analysis-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
938 changes: 938 additions & 0 deletions
938
.ipynb_checkpoints/anomaly-detection-training-autoencoder-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
671 changes: 671 additions & 0 deletions
671
.ipynb_checkpoints/anomaly-detection-training-mahalanobis-distance-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
TensorFlow Lite Anomaly Detection Example | ||
======== | ||
|
||
This project is an example demonstrating how to use Python to train two different machine learning models to detect anomalies in an electric motor. The first model relies on the classic machine learning technique of Mahalanobis distance. The second model is an autoencoder neural network created with TensorFlow and Keras. | ||
|
||
Data was captured using an ESP32 and MSA301 3-axis accelerometer taped to a ceiling fan. Each sample is about 200 samples of all 3 axes captured over the course of 1 second. Fan was run at multiple speeds (off, low, medium, high) with and without a weight. 1 "weight" is one US quarter taped to one of the fan's blades to create an offset motion. All raw data is stored in the ceiling-fan-dataset directory. | ||
|
||
The full articles that explain how these programs work and how to use them can be found here: | ||
**Coming Soon** | ||
|
||
Here are the accompanying videos that explain how to use these programs and some of the theory behind them: | ||
**Coming Soon** | ||
|
||
![ESP32 on ceiling fan for anomaly detection](https://raw.githubusercontent.com/ShawnHymel/tflite-speech-recognition/master/images/fan-anomaly-detection-cover.jpg) | ||
|
||
Prerequisites | ||
-------------- | ||
|
||
You will need to install TensorFlow, Keras, and Jupyter Notebook on your desktop or laptop. (This guide)[https://www.digikey.com/en/maker/projects/getting-started-with-machine-learning-using-tensorflow-and-keras/0746640deea84313998f5f95c8206e5b] will walk you through that process. | ||
|
||
Alternatively, you can use [Google Colab](https://colab.research.google.com/) to run a Jupyter Notebook instance in the cloud, however, loading files (e.g. training samples) will require you to upload them to Google Drive and write different code to import them into your program. [This guide](https://towardsdatascience.com/3-ways-to-load-csv-files-into-colab-7c14fcbdcb92) offers some tips on how to do that. | ||
|
||
If you plan to collect data yourself, you will need an [Adafruit Feather Huzzah32](https://www.digikey.com/product-detail/en/adafruit-industries-llc/3591/1528-2514-ND/8119805), [Adafruit MSA301 accelerometer breakout board](https://www.digikey.com/products/en/development-boards-kits-programmers/evaluation-boards-expansion-boards-daughter-cards/797?k=msa301), battery, breadboard, and jumper wires. | ||
|
||
Getting Started | ||
--------------- | ||
|
||
Download this repository. Open **anomaly-detection-feature-analysis** in Jupyter Notebook and run it. Carefully look at the various plots to determine which features can be used to best discriminate between normal and anomalous operation. | ||
|
||
|
||
|
||
License | ||
------- | ||
|
||
All code in this repository, unless otherwise specified, is for demonstration purposes and licensed under [Beerware](https://en.wikipedia.org/wiki/Beerware). | ||
|
||
Distributed as-is; no warranty is given. |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
0.047363, 0.246094, 0.973633 | ||
-0.065918, 0.157227, 0.959473 | ||
0.03418, 0.248535, 0.992676 | ||
-0.039063, 0.196289, 0.958008 | ||
-0.02002, 0.217285, 0.98584 | ||
0.015137, 0.221191, 0.98584 | ||
-0.051758, 0.201172, 0.961914 | ||
-0.012695, 0.206055, 0.979004 | ||
0.018555, 0.230957, 0.96875 | ||
-0.058594, 0.160156, 0.964356 | ||
0.044922, 0.255859, 0.986816 | ||
-0.046387, 0.173828, 0.961426 | ||
0.010742, 0.243164, 1.000977 | ||
-0.004883, 0.196289, 0.972168 | ||
-0.046387, 0.189941, 0.981934 | ||
0.044434, 0.234863, 0.997559 | ||
-0.060059, 0.15625, 0.967773 | ||
0.029785, 0.252441, 0.995117 | ||
-0.038574, 0.185059, 0.95752 | ||
-0.011719, 0.226563, 0.987793 | ||
0.008789, 0.207031, 0.993164 | ||
-0.045898, 0.187988, 0.969727 | ||
-0.019531, 0.220703, 0.989746 | ||
0.01709, 0.207031, 0.972656 | ||
-0.0625, 0.166992, 0.95752 | ||
0.051758, 0.261719, 1.001465 | ||
-0.054688, 0.163574, 0.962891 | ||
0.023926, 0.250977, 1.005371 | ||
-0.013672, 0.188477, 0.967285 | ||
-0.042969, 0.20166, 0.975098 | ||
0.053711, 0.251465, 0.996582 | ||
-0.072754, 0.14502, 0.952148 | ||
0.050293, 0.258789, 0.993652 | ||
-0.05127, 0.175781, 0.960938 | ||
-0.002441, 0.235352, 0.941895 | ||
0.009766, 0.252441, 1.002441 | ||
-0.058594, 0.190918, 0.958984 | ||
-0.020508, 0.211426, 0.983887 | ||
0.023438, 0.226074, 0.967285 | ||
-0.068359, 0.154785, 0.95752 | ||
0.061035, 0.260742, 1.004883 | ||
-0.066406, 0.166016, 0.958984 | ||
0.020508, 0.238281, 1.000977 | ||
-0.016113, 0.208008, 0.967773 | ||
-0.041992, 0.179688, 0.984375 | ||
0.058594, 0.242676, 0.995606 | ||
-0.074219, 0.153809, 0.960449 | ||
0.045898, 0.250488, 1.006348 | ||
-0.044434, 0.194336, 0.962891 | ||
-0.00293, 0.219238, 0.955566 | ||
0.012207, 0.229004, 0.995117 | ||
-0.021484, 0.203125, 0.95752 | ||
-0.01709, 0.208496, 0.983887 | ||
0.026367, 0.233398, 0.975098 | ||
-0.066406, 0.165039, 0.958496 | ||
0.057129, 0.252441, 0.992676 | ||
-0.062988, 0.170898, 0.951172 | ||
0.016602, 0.234375, 0.996582 | ||
-0.019043, 0.205566, 0.959961 | ||
-0.039063, 0.194336, 0.984863 | ||
0.054199, 0.240723, 0.997559 | ||
-0.080566, 0.149902, 0.960449 | ||
0.033203, 0.246094, 0.990234 | ||
-0.047852, 0.18457, 0.958008 | ||
-0.000977, 0.233398, 0.959473 | ||
0.008301, 0.248047, 0.996582 | ||
-0.050293, 0.200195, 0.966797 | ||
-0.009277, 0.221191, 0.996094 | ||
0.015625, 0.234863, 0.96875 | ||
-0.058594, 0.166016, 0.96582 | ||
0.056641, 0.255371, 1.000488 | ||
-0.05957, 0.162109, 0.962891 | ||
0.03125, 0.251953, 1.000977 | ||
-0.021973, 0.200195, 0.959961 | ||
-0.021484, 0.196777, 0.990234 | ||
0.040527, 0.242676, 0.98291 | ||
-0.074707, 0.150391, 0.960938 | ||
0.039063, 0.254883, 1 | ||
-0.057617, 0.174316, 0.956055 | ||
0.008789, 0.229004, 0.948731 | ||
-0.010742, 0.246094, 1.000488 | ||
-0.054688, 0.185059, 0.960449 | ||
-0.011719, 0.211914, 0.989746 | ||
0.018066, 0.245605, 0.971191 | ||
-0.05957, 0.168457, 0.96875 | ||
0.05127, 0.25, 0.98877 | ||
-0.05957, 0.166016, 0.958984 | ||
0.036621, 0.245117, 1.004395 | ||
-0.025879, 0.206055, 0.968262 | ||
-0.026367, 0.193848, 0.992676 | ||
0.041992, 0.243652, 0.984375 | ||
-0.060059, 0.158691, 0.961914 | ||
0.04834, 0.25293, 0.993164 | ||
-0.053223, 0.18457, 0.993164 | ||
0.00293, 0.181152, 0.960449 | ||
-0.002441, 0.250977, 0.999023 | ||
-0.056152, 0.183594, 0.951172 | ||
-0.013672, 0.217285, 0.985352 | ||
0.013184, 0.22998, 0.965332 | ||
-0.04834, 0.185547, 0.964356 | ||
0.036133, 0.253418, 0.979004 | ||
-0.062988, 0.156738, 0.950195 | ||
0.029297, 0.248535, 0.999512 | ||
-0.029785, 0.196777, 0.972168 | ||
-0.021973, 0.204102, 0.998535 | ||
0.031738, 0.22998, 0.983887 | ||
-0.052734, 0.157715, 0.970703 | ||
0.052246, 0.245605, 0.998535 | ||
-0.054199, 0.170898, 0.998047 | ||
0.008301, 0.147949, 0.96582 | ||
0.033691, 0.257324, 0.999023 | ||
-0.044922, 0.174805, 0.950195 | ||
-0.009766, 0.234375, 0.983398 | ||
0.015137, 0.217773, 0.976563 | ||
-0.054688, 0.178223, 0.964356 | ||
0.036133, 0.238281, 0.980469 | ||
-0.062012, 0.159668, 0.958008 | ||
0.026855, 0.26123, 0.999512 | ||
-0.029785, 0.192871, 0.963379 | ||
-0.018555, 0.223145, 0.986816 | ||
0.023926, 0.213379, 0.980957 | ||
-0.065918, 0.154297, 0.962402 | ||
0.049805, 0.262207, 0.997559 | ||
-0.06543, 0.164063, 0.98584 | ||
0.013672, 0.151367, 0.954102 | ||
0.059082, 0.256836, 1.005859 | ||
-0.057617, 0.162598, 0.954102 | ||
0.013672, 0.249023, 1.006348 | ||
0.010254, 0.220703, 0.973145 | ||
-0.054199, 0.165039, 0.966797 | ||
0.054688, 0.248047, 0.981445 | ||
-0.071289, 0.150879, 0.953125 | ||
0.046387, 0.26123, 1.004883 | ||
-0.039063, 0.189941, 0.959961 | ||
-0.012695, 0.206055, 0.98584 | ||
0.026367, 0.233398, 0.972656 | ||
-0.07373, 0.153809, 0.955566 | ||
0.063477, 0.266602, 0.995606 | ||
-0.070313, 0.164063, 0.984863 | ||
0.016602, 0.147949, 0.958496 | ||
0.051758, 0.255859, 0.998535 | ||
-0.063965, 0.180664, 0.958984 | ||
0.004883, 0.221191, 0.997559 | ||
0.01416, 0.23291, 0.976074 | ||
-0.053711, 0.165527, 0.96875 | ||
0.056152, 0.250488, 0.994629 | ||
-0.067871, 0.155273, 0.962891 | ||
0.034668, 0.241211, 0.998047 | ||
-0.022949, 0.200195, 0.972656 | ||
-0.015625, 0.206543, 0.989258 | ||
0.032227, 0.236816, 0.979981 | ||
-0.070313, 0.156738, 0.960449 | ||
0.055176, 0.244141, 0.990723 | ||
-0.062988, 0.231934, 0.98877 | ||
0.011719, 0.164063, 0.959961 | ||
0.046875, 0.263184, 0.991699 | ||
-0.056152, 0.178711, 0.943848 | ||
0.013672, 0.22998, 0.990234 | ||
-0.008789, 0.223633, 0.958984 | ||
-0.061035, 0.181152, 0.973145 | ||
0.045898, 0.242676, 0.992676 | ||
-0.070801, 0.161621, 0.956543 | ||
0.041504, 0.254883, 0.998047 | ||
-0.033203, 0.200684, 0.95752 | ||
-0.006836, 0.208984, 0.987305 | ||
0.022461, 0.22998, 0.982422 | ||
-0.061035, 0.168945, 0.975586 | ||
0.050293, 0.257813, 0.994629 | ||
-0.064453, 0.249023, 0.981445 | ||
-0.0625, 0.164063, 0.964356 | ||
0.050781, 0.257324, 0.993652 | ||
-0.059082, 0.171387, 0.952637 | ||
0.018066, 0.225586, 0.997559 | ||
-0.014648, 0.217285, 0.967773 | ||
-0.041016, 0.185059, 0.981934 | ||
0.038086, 0.246582, 0.979981 | ||
-0.06543, 0.157715, 0.955078 | ||
0.044434, 0.253418, 0.998047 | ||
-0.043457, 0.194336, 0.958008 | ||
-0.01416, 0.210449, 0.987305 | ||
0.009766, 0.234863, 0.971191 | ||
-0.044922, 0.169434, 0.976563 | ||
0.049316, 0.248047, 0.982422 | ||
-0.065918, 0.22168, 0.986328 | ||
-0.032715, 0.155762, 0.964356 | ||
0.053711, 0.254883, 1 | ||
-0.067383, 0.168945, 0.954102 | ||
0.018555, 0.226563, 0.999512 | ||
-0.006836, 0.213867, 0.973145 | ||
-0.041992, 0.176758, 0.988281 | ||
0.04248, 0.248535, 0.983887 | ||
-0.063965, 0.166016, 0.957031 | ||
0.044434, 0.247559, 0.995117 | ||
-0.041016, 0.185059, 0.960938 | ||
-0.020508, 0.219238, 0.979492 | ||
0.014648, 0.231445, 0.970703 | ||
-0.04541, 0.17627, 0.975098 | ||
0.045898, 0.243652, 0.980469 | ||
-0.067871, 0.225098, 0.974121 | ||
-0.041016, 0.174805, 0.964356 |
Oops, something went wrong.