.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "uwb/uwb_har_tutorial.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_uwb_uwb_har_tutorial.py: Tutorial for UWB Human Activity Recognition ============================================================== .. GENERATED FROM PYTHON SOURCE LINES 5-15 .. code-block:: Python import torch import torch.nn as nn import os from pysensing.uwb.datasets.get_dataloader import * from pysensing.uwb.models.get_model import * from pysensing.uwb.training.har import * from pysensing.uwb.inference.predict import * from pysensing.uwb.inference.embedding import * .. GENERATED FROM PYTHON SOURCE LINES 16-32 Download Data from Cloud Storage ----------------------------------- Open the following link in your browser to download HAR datasets: [Download Sleep_Pose_Net Dataset](https://pysensing.oss-ap-southeast-1.aliyuncs.com/data/uwb/sleep_pose_net_data.zip) \ [...]() Unzip the downloaded file and move to your data folder. For HAR, the data folder should look like this: ``` |---data |------|---HAR |------|------|---sleep_pose_net_data |------|------|------|---Dataset I |------|------|------|---Dataset II ``` .. GENERATED FROM PYTHON SOURCE LINES 34-64 Load the data ----------------------------------- Human action recognition dataset: Sleep Pose Net Dataset UWB size : n x 160 x 100 x_diff and x_wrtft size is depended on preprocessing parameters Dataset 1 - number of classes : 6 - train number : 623 - test number : 307 Dataset 2 - number of classes : 7 - train number : 739 - test number : 365 Dataset name choices are: - 'Sleepposenet_dataset1' - 'Sleepposenet_dataset2_session1_ceiling' - 'Sleepposenet_dataset2_session1_wall' - 'Sleepposenet_dataset2_session1_all' - 'Sleepposenet_dataset2_session2_ceiling' - 'Sleepposenet_dataset2_session2_wall' - 'Sleepposenet_dataset2_session2_all' - 'Sleepposenet_dataset2_sessionALL_ceiling' - 'Sleepposenet_dataset2_sessionALL_wall' - 'Sleepposenet_dataset2_sessionALL_all' .. GENERATED FROM PYTHON SOURCE LINES 64-75 .. code-block:: Python root = './data' train_loader, test_loader = load_har_dataset(root, 'Sleepposenet_dataset2_session1_all') device = torch.device("cuda" if torch.cuda.is_available() else "cpu") for data in train_loader: x_diff, x_wrtft, labels = data print(x_diff.size()) print(x_wrtft.size()) print(labels.size()) break .. rst-class:: sphx-glr-script-out .. code-block:: none Loading Sleep Pose Net Dataset 2 session 1 all ... 0%| | 0/739 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: uwb_har_tutorial.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_