Code Monkey home page Code Monkey logo

sharpflow's People

Contributors

dimstudio avatar hansbambel avatar

Stargazers

 avatar

Watchers

 avatar  avatar

sharpflow's Issues

Add counter examples for action classification

The idea is to create fake intervals as counter example to the intervals. For example we have 120 ping pong strokes as time intervals. We generate from the same dataset 120 non-strokes from the same dataset. Here is my attempt:

# add fake intervals adding random time offset

import random
xm = dfAnn.duration.median()
dfAnnFake = dfAnn.copy()
format = lambda x: x + pd.DateOffset(seconds=float(random.randint(-int(xm*100), int(xm*100)))/100)
dfAnnFake.start = dfAnn.start.map(format)
dfAnnFake.end = dfAnnFake.start + pd.to_timedelta(dfAnnFake.duration, unit='s')

Multiclass classifier

What is the actual meaning of the Multiclass Classifier?
As I understand it combines the results of 3 classes into one. How can it make it boolean?

For instance models/model_classRate_classDepth_classRelease.h5('Test accuracy:', 0.527339)
('Test loss:', -42.63868981288386).

Error with TennisTable dataset

Hi @HansBambel
when I try to train a model using the TableTennis500 dataset I get this error, is the same for you?

Traceback (most recent call last):
  File "/Users/daniele/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3325, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-d8916166bc74>", line 1, in <module>
    runfile('/Users/daniele/Documents/research/SharpFlow/model_training_pytorch.py', wdir='/Users/daniele/Documents/research/SharpFlow')
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/daniele/Documents/research/SharpFlow/model_training_pytorch.py", line 387, in <module>
    train_test_model()
  File "/Users/daniele/Documents/research/SharpFlow/model_training_pytorch.py", line 383, in train_test_model
    batchsize=batch_size)
  File "/Users/daniele/Documents/research/SharpFlow/model_training_pytorch.py", line 336, in test_model
    f"Target-class: {tar_class} Accuracy: {acc[i]:.5f} Precision: {precision[i]:.5f} Recall: {recall[i]:.5f} F1-Score: {f1[i]}")
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Real-time classification - main.py

In main.py single intervals (e.g. chest compressions or strokes) will be flowing-in one at a time via a TCP connection. This means that we will get smaller datafiles. We need to make sure the transformation on this data (in terms of rescaling, resampling, min-max normalization) is exactely the same as the one in model_training.py since the processed intervals will be classified with the learned models.

Current performances

Dataset: CPR_experiment
Target: classRate
loss: -92.4418 - accuracy: 0.3706
('Test accuracy:', 0.3705954)
('Test loss:', -92.46426220102414)

Target: classDepth
loss: -65.9041 - accuracy: 0.6015
('Test accuracy:', 0.6014581)
('Test loss:', -50.17492101954371)

Target: classRelease
loss: 1.4347 - accuracy: 0.7242
('Test accuracy:', 0.7241798)
('Test loss:', 1.718166751821015)

Dataset: CPR_test
Target: classRate
0s 173us/sample - loss: 0.8667 - accuracy: 0.7978
('Test accuracy:', 0.7978142)
('Test loss:', 1.2019080369850326)

Target: classDepth
loss: 1.1676 - accuracy: 0.7049
('Test accuracy:', 0.704918)
('Test loss:', 1.364527590939256)

Target: classRelease
loss: 1.1262 - accuracy: 0.7049
('Test accuracy:', 0.704918)
('Test loss:', 1.290114411565124)

Target: armsLocked + bodyWeight
loss: 0.1122 - accuracy: 0.9781
('Test accuracy:', 0.9781421)
('Test loss:', 0.09334265835623924)

Target: armsLocked
loss: 0.3258 - accuracy: 0.9617
('Test accuracy:', 0.96174866)
('Test loss:', 0.15740652211631337)

Target: bodyWeight
loss: 0.1594 - accuracy: 0.9781
('Test accuracy:', 0.9781421)
('Test loss:', 0.1251428161233745)

Dataset: Tennistable_strokes batch size: (240, 50, 6)
Target: correct_strokes (with Kinect)
loss: 0.7990 - accuracy: 0.7500
('Test accuracy:', 0.75)
('Test loss:', 0.8324083089828491)

Target: correct_strokes (without Kinect)
loss: 0.8000 - accuracy: 0.8000
('Test accuracy:', 0.8)
('Test loss:', 0.7873132824897766)

Parameter to exclude certain sensors files

The idea of Sharpflow is that it has to be general, using the zip dataformat, not for a specific sensors so we should try not to hardcode information regarding Kinect e.g. ignoreKinect=ignoreKinect but have something like
exclude_files = ['kinect']
which along with
to_exclude = ['Ankle', 'Hip']
and
target_classes = ["correct_stroke"]

need to be parameters of the function call

Hold-one-participant-out testing to prevent overfitting

Introduce a new functionality in which the neural network can handle a dataset in which we record multiple users. For this particular purpose, we can use the CPR_experiment dataset containing 2 sessions x 11 users = 22 sessions in total. For each user, there are 2 sessions (two zip folders).
The target classes are:
targets = ['classRate', 'classDepth', 'classRelease'

The approach should be the following:

  1. learn a single (or stacked LSTM) merging the sessions together
  2. test it with the 70/30 hold out training
  3. NEW: hold-one-user-out testing

in this way, we can check how well the model does with the data of one "unseen" user.

Easily load MLT JSON data

Dear @HansBambel,
I am trying to use the library to train a model with the MLT-JSON data format (similar to the CPR Tutor).
How can I change the current load of CSV files into MLT-JSON?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.