Python library of edge-ml.org: end-to-end machine learning for embedded devices
Project description
Obtain data from edge-ml
from edgeml import DatasetReceiver
1. Create a project
This will also pull the metadata from the server. Here you need the read-key. Make sure there is not trailing / in your URL.
project = DatasetReceiver("https://edge-ml-beta.dmz.teco.edu", "8c051972b56e6b4ad6bd0bf573da580f")
print(project)
Dataset - Name: W_001, ID: 645a255bdd19d537f2a50126, Metadata: {}
Dataset - Name: W_004, ID: 645a255b7d9569d03843a12b, Metadata: {}
Dataset - Name: Square_003, ID: 645a255b2ce253c26b52426c, Metadata: {}
Dataset - Name: Square_004, ID: 645a255b1d6af5e7ed04575f, Metadata: {}
Dataset - Name: Square_002, ID: 645a255bc21261d4cbdc990d, Metadata: {}
Dataset - Name: W_002, ID: 645a255b3ebe0af02b211d5d, Metadata: {}
Dataset - Name: W_003, ID: 645a255b074737af782167e2, Metadata: {}
Dataset - Name: Square_001, ID: 645a255bbacf5ab8ff044304, Metadata: {}
Dataset - Name: edgemlDemo, ID: 64635a79a7a7513e8ac92d32, Metadata: {'langauge': 'python'}
Dataset - Name: edgemlDemo, ID: 64635a7b6fec1d2800b1cd06, Metadata: {'langauge': 'python'}
2. Actually obtain data
Until now, we only have metadata available. We need to pull the actual time-series data using one of the following methods:
We can load the data for a single timeSeries
project.datasets[0].timeSeries[0].loadData()
project.datasets[0].timeSeries[0].data.head()
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
time | x | |
---|---|---|
0 | 1970-01-01 00:10:23.339 | -823.0 |
1 | 1970-01-01 00:10:23.378 | -819.0 |
2 | 1970-01-01 00:10:23.418 | -770.0 |
3 | 1970-01-01 00:10:23.458 | -746.0 |
4 | 1970-01-01 00:10:23.497 | -783.0 |
For a single dataset
project.datasets[0].loadData()
project.datasets[0].data.head()
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
time | x | y | z | Gestures | |
---|---|---|---|---|---|
0 | 1970-01-01 00:10:23.339 | -823.0 | -45.0 | 4025.0 | |
1 | 1970-01-01 00:10:23.378 | -819.0 | -158.0 | 4075.0 | |
2 | 1970-01-01 00:10:23.418 | -770.0 | -255.0 | 4116.0 | |
3 | 1970-01-01 00:10:23.458 | -746.0 | -155.0 | 4059.0 | |
4 | 1970-01-01 00:10:23.497 | -783.0 | -104.0 | 3963.0 |
Or for all datasets in the project
project.loadData()
project.data[0].head()
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
time | x | y | z | Gestures | |
---|---|---|---|---|---|
0 | 1970-01-01 00:10:23.339 | -823.0 | -45.0 | 4025.0 | |
1 | 1970-01-01 00:10:23.378 | -819.0 | -158.0 | 4075.0 | |
2 | 1970-01-01 00:10:23.418 | -770.0 | -255.0 | 4116.0 | |
3 | 1970-01-01 00:10:23.458 | -746.0 | -155.0 | 4059.0 | |
4 | 1970-01-01 00:10:23.497 | -783.0 | -104.0 | 3963.0 |
Upload data to edge-ml
1. Upload data using timestamps from the device
Here you will need the write-key
from edgeml.edgeml import DatasetCollector
sender = DatasetCollector(url="https://edge-ml-beta.dmz.teco.edu", apiKey="4e6159c9c77124d71f298e93f1ed7254", name="edgemlDemo", useDeviceTime=True, timeSeries=["accX", "accY"], metaData={"langauge": "python"})
import time
for i in range (100):
await sender.addDataPoint(name="accX", value=i*0.1)
await sender.addDataPoint(name="accY", value=i*0.5)
time.sleep(0.01)
sender.onComplete()
True
2. Provide your own timestamps
from edgeml.edgeml import DatasetCollector
sender = DatasetCollector(url="https://edge-ml-beta.dmz.teco.edu", apiKey="4e6159c9c77124d71f298e93f1ed7254", name="edgemlDemo", useDeviceTime=False, timeSeries=["accX", "accY"], metaData={"langauge": "python"})
import time
for i in range (100):
await sender.addDataPoint(timestamp=i*1000, name="accX", value=i*0.1)
await sender.addDataPoint(timestamp=i*1000, name="accY", value=i*0.5)
time.sleep(0.01)
sender.onComplete()
True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
edge-ml-0.3.3.tar.gz
(6.6 kB
view details)
Built Distribution
File details
Details for the file edge-ml-0.3.3.tar.gz
.
File metadata
- Download URL: edge-ml-0.3.3.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6489b810d025c0aa0cfa606d14c7ce8a0dd2a6c3f7a7ff6ae038848e98a6a4ae |
|
MD5 | 5661403a9d4acfbb6f8f74a72ca3267b |
|
BLAKE2b-256 | f1a5713a016ed8addd0db7e7fc44dd23a56cdcaa6e4fc4751e209a9032330f68 |
File details
Details for the file edge_ml-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: edge_ml-0.3.3-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58cba0a52a86b53e1a98fb526384c1bb0e8f5e0c6617c908bf20ec316e6c150f |
|
MD5 | 39fe4f272a8cf2300f40a66be5f26a65 |
|
BLAKE2b-256 | 3e89810ab9d82641a3e6e9e872e92bd7436fe7bc118af438c3094eb0da95d088 |