Comments (3)
Thanks for taking an interest in the activity classifier!
Below is the piece of code used to produce hapt_data.sframe
from the raw data found here.
This follows the instructions in the README.txt file available with the raw data.
from glob import glob
import turicreate as tc
def find_label_for_containing_interval(intervals, index):
containing_interval = intervals[:, 0][(intervals[:, 1] <= index) & (index <= intervals[:, 2])]
if len(containing_interval) == 1:
return containing_interval[0]
# Load labels
labels = tc.SFrame.read_csv('./HAPT Data Set/RawData/labels.txt', delimiter=' ', header=False, verbose=False)
labels = labels.rename({'X1': 'exp_id', 'X2': 'user_id', 'X3': 'activity_id', 'X4': 'start', 'X5': 'end'})
# Load data
data = tc.SFrame()
acc_files = glob('./HAPT Data Set/RawData/acc_*.txt')
gyro_files = glob('./HAPT Data Set/RawData/gyro_*.txt')
files = zip(sorted(acc_files), sorted(gyro_files))
for acc_file, gyro_file in files:
exp_id = int(acc_file.split('_')[1][-2:])
user_id = int(acc_file.split('_')[2][4:6])
# Load accel data
sf = tc.SFrame.read_csv(acc_file, delimiter=' ', header=False, verbose=False)
sf = sf.rename({'X1': 'acc_x', 'X2': 'acc_y', 'X3': 'acc_z'})
sf['exp_id'] = exp_id
sf['user_id'] = user_id
# Load gyro data
gyro_sf = tc.SFrame.read_csv(gyro_file, delimiter=' ', header=False, verbose=False)
gyro_sf = gyro_sf.rename({'X1': 'gyro_x', 'X2': 'gyro_y', 'X3': 'gyro_z'})
sf = sf.add_columns(gyro_sf)
# Calc labels
exp_labels = labels[labels['exp_id'] == exp_id][['activity_id', 'start', 'end']].to_numpy()
sf = sf.add_row_number()
sf['activity_id'] = sf['id'].apply(lambda x: find_label_for_containing_interval(exp_labels, x))
sf = sf.remove_columns(['id', 'exp_id'])
data = data.append(sf)
target_map = {
1.: 'walking',
2.: 'climbing_upstairs',
3.: 'climbing_downstairs',
4.: 'sitting',
5.: 'standing',
6.: 'laying'
}
# Use the same labels used in the experiment
data = data.filter_by(target_map.keys(), 'activity_id')
data['activity'] = data['activity_id'].apply(lambda x: target_map[x])
data = data.remove_column('activity_id')
data.save('hapt_data.sframe')
from turicreate.
@alonpal We can't host this dataset but we can add code that creates this into the user guide. Can we add simplified code above into the user guide?
from turicreate.
Looks fixed with #71.
from turicreate.
Related Issues (20)
- Object detection - Segfault after a large number of iterations
- available data sets in turicreate
- Mac M2 model.export_coreml('.mlmodel') Unable to export model HOT 1
- TuriCreate still doesn't work on M1 using rosetta terminal HOT 7
- While training object_detector in colab randomly Using CPU/GPU to create model.
- Trying to create a model on a larger dataset - Loss stuck at the same number and not moving, resulting model predictions detect nothing
- Support Python 3.9 HOT 1
- pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
- Simple Image Classification Model gives different confidence level (Between Coreml UI and iOS App)
- pip dependency conflicts: conda-repo-cli 1.0.20 requires nbformat==5.4.0, but you have nbformat 5.7.3 which is incompatible. HOT 1
- AttributeError: module 'numpy' has no attribute 'typeDict' HOT 1
- Cannot install and import TuriCreate HOT 1
- Columns and DataType Not Explicitly Set on line 611 of sgraph.py
- Error While Installing Turicreate to my Windows via WSL HOT 1
- Benzinga error
- when you planning run it on windows natively (not wsl)
- MacOS ,When install dydx-python ,encounter some ERRORS , how to solve the problem? A lot thanks.
- Can't run DreamBooth in Gcolab
- Converting sframe to csv
- TuriCreate: Human Activity Classifier Model Deployment and result on unseen test dataset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turicreate.