Skip to content

Anomaly Detection and Classification

段双达 edited this page Apr 15, 2019 · 3 revisions

Data Collection

These services will be used to train models of skills. Such models may be either nominal or anomalous. Multimodal sensory data is used to train them. Which sensory modalities are used are optional, in our work we used: Joint angle positions, joint angle velocities, joint torques, Endeffector Cartesian coordinates, Endeffector FT values, Tactile Sensor input.

To select which sensor modalities you want to use, they need to be set within a python script called anomaly_detection_config.py. This file is located here: ./smach_based_introspection_framework/src/smach_based_introspection_framework/config/anomaly_detection_config.py.

Edit this file _constant.py for modifying the online (including data collection, online experimental test) working directory, e.g. introspection_data_folder = .../.../introspection_data_folder

If we want to evaluate the models offline with variable signal conbinations, we should copy the recorded data from online working directory to a rename directory.

e.g. 
1. cp ../introspection_data_folder ../introspection_data_folder.Offline_AC_test
2. Modify the working directory to the copied folder
i.e. open /home/birl-spai-ubuntu14/baxter_ws/src/SPAI/smach_based_introspection_framework/src/smach_based_introspection_framework/_constant.py  for modifying the online (including  data collection, online expermental test) working directory, 
../introspection_data_folder     ->        ../introspection_data_folder.Offline_AC_test 

Online -> Offline

For optimal (Anomaly detection/Classification) model selection by given filtering_scheme (signal combinations)

Anomaly Detection Model Training / Anomaly Classification Model Training

Move to the offline directory

cd /home/birl-spai-ubuntu14/baxter_ws/src/SPAI/smach_based_introspection_framework/src/smach_based_introspection_framework/offline_part/anomaly_detection_feature_selection

Define one or several signal combinations

emacs fliter_schemes.py for defining all the combinations by variable **fixed_filters=[]**

Extracte the data from saved rosbag and generate the successful and unsuccessful dataset

python generate_succ_and_unsucc_datasets.py

Train the introspection model, specifically, only for anomaly detecion model

python generate_introspection_models.py

Evaluate all trained model with the same successful/unsuccessful dataset (generated in previous two steps)

python collect_detection_statistics.py
python generate_human_readable_report.py 

** open the generated report.txt in current directory and choose the optimal filtering scheme for online implementation.**

Offline -> Online

copy the optimal trained models to the online working directory

/home/birl-spai-ubuntu14/baxter_ws/src/SPAI/smach_based_introspection_framework/introspection_data_folder/model_folder/latest/)

Modify the working directory to the online directory

 
 open /home/birl-spai-ubuntu14/baxter_ws/src/SPAI/smach_based_introspection_framework/src/smach_based_introspection_framework/_constant.py  for modifying the online (including  data collection, online expermental test) working directory, 
../introspection_data_folder.Offline_AC_test      ->        ../introspection_data_folder