Skip to content

morelab/c4a_activity_recognition

 
 

Repository files navigation

Repository for HARS, the activity recognition modules in City4Age.

Please cite the following paper when using this work: Gorka Azkune, Aitor Almeida. (2018) "A Scalable Hybrid Activity Recognition Approach for Intelligent Environments" In IEEE Access. vol. 6. p. 41745-41759. DOI: 10.1109/ACCESS.2018.2861004.

CONTENTS:

The following directories can be found here:

log_reader: Python classes to read and represent the information provided by the log-file of Activity Discovery (CASAS). An example of such a log-file can be found at test_files/test_dataset_log.txt. Class LogReader.py can be used to read those files and obtain clusters and patterns.

AD_pattern_filtering: a Python class to filter spurious patterns detected by AD using the information from the log-file. ADPatternFiltering uses LogReader to read the log and implements various filtering strategies.

pattern_model_matching: the main Python module of the repository, where the matching between patterns extracted by AD and Expert Activity Models is done. A class ExpertActivityModel is provided to represent those. Class PatternModelMatching loads EAMs, the patterns detected by AD, the log-file by AD and the context model (where sensors and actions are defined) to produce a new CSV file where all patterns are annotated with activities.

ar_evaluator: this module is prepared to evaluate the results obtained by PatternModelMatching. It produces a confusion matrix with all target activities. A class ConfusionMatrix is provided to build, update and visualize confusion matrices.

test_files: the files needed to technically test the Python modules, as well as their results:

  • context_model.json: definition of sensors, actions and their relationships.
  • eams.json: definition of Expert Activity Models.
  • groundtruth.csv: the groundtruth for evaluation, directly generated by synthetic_dataset_generator.
  • pm_output.csv: the file generated by PatternModelMatching (to be evaluated).
  • test_dataset.csv.annotated: the file generated by AD detecting the patterns in a modified groundtruth.csv (all activities are tagged as Other_Activity to make AD find patterns).
  • test_dataset_log.txt: the log-file generated by AD for the modified groundtruth.csv in the generation process of test_dataset.csv.annotated.

experiments: this directory contains the experiments done with real datasets, with the required files and scripts. More concretely, here can be found the experiments run on Kasteren House A, House B and House C, as well as Munguia-Tapia dataset. To run a specific experiment, go into the directory and just launch 'run_test.py'.

USAGE:

To run the PatternModelMatching with suitable files, just type (this assumes AD has been run on the action dataset):

python3 PatternModelMatching.py -e ../test_files/eams.json -a ../test_files/test_dataset.csv.annotated -l ../test_files/test_dataset_log.txt -c ../test_files/context_model.json -o ../test_files/pm_output.csv

To run AREvaluator and evaluate results obtained by PatternModelMatching, just type (this assumes PatternModelMatching has been run):

python3 AREvaluator.py -g ../test_files/groundtruth.csv -e ../test_files/pm_output.csv

ACKNOWLEDGEMENTS

This work was carried out with the financial support of H2020 project City4Age, grant agreement number 689731. Thanks to CASAS team in Washington State University for making their excellent software available to researchers and to Tim Van Kasteren for publishing the activity dataset for benchmarking purposes.

About

Activity recognition for the City4Age project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%