All models

IMU-Transformer

A Transformer encoder that recognizes activities from two-second windows of accelerometer and gyroscope data.

Time series · 226 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (25 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
218.5K
Operations
226
Framework
PyTorch
Recurrent
No
Published
2021, IEEE Access
Cited by
113 (as of 5 October 2026)
Authors
Yoli Shavit, Itzik Klein
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m14389
Graph hash
5b8726000140b272370a55fe787d8806ad9d31c359b63a607a3c9bfedf12420d
Skeleton hash
ec5adbdfb255fee5060020f1fefdb4f115fb39d183470edc4e33bef981886886
Architecture hash
dcb1753a66f219d14eaf24367e16f356402b10357c3e49f5a003076eb9542589
Diagram SHA-256
c0a77d3261f963d4b49ac49fe4c800ed477cf93f6714129408aff8501ef0c44d
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

IMU-Transformer is a Transformer encoder that classifies what a person is doing, or where their phone is carried, from short windows of inertial sensor readings. Earlier learning-based approaches to this problem used convolutional or long short term memory networks; the paper brings in Transformers, which had been shown to beat those on sequence analysis tasks. The authors present it as the first Transformer-based architecture to serve as a general framework for both human activity recognition and smartphone location recognition.

A sample is a window of k inertial measurements with 6 channels; a series of four 1D convolutions with GELU non-linearity first embeds it in a higher dimension d. A class token is prepended to the embedded sequence, and a learned embedding for each position, including the class token, is added. A standard encoder of L layers follows, each a multi-head self-attention layer and an MLP of two fully connected layers with hidden dimension 2·d and GELU. The encoder output at the class token position is read as a temporally aware aggregation of the input sequence and classified from there. The member traced here uses the window of 50 samples that the paper selected, which at the slowest sampling rate corresponds to two seconds.

Evaluation covered several datasets with more than 27 hours of inertial recordings from 91 users, and the model consistently achieved better accuracy and generalized better across all of them. It was also more robust to smaller windows than the CNN baseline: shrinking the window cost the IMU-CNN more accuracy on average than the 1.9% lost by the IMU-Transformer. The official PyTorch repository ships both the Transformer classifier and the IMU-CNN baseline for comparison, with the hyperparameters, including window size and input dimension, set in a configuration file.

Key idea. A general Transformer encoder framework for inertial activity recognition, with a convolutional embedding, class token and learned positions, that improves accuracy and robustness over CNN and LSTM approaches.

  • IMU-Transformer
  • IMUTransformerEncoder
  • human activity recognition
  • HAR
  • smartphone location recognition
  • inertial sensors
  • accelerometer
  • gyroscope
  • wearable
  • Shavit
  • Klein

AI-written summary, checked automatically against its sources; not reviewed by a person. Corrections welcome.

Cite the paper

@article{Shavit_2021, title={Boosting Inertial-Based Human Activity Recognition With Transformers}, volume={9}, ISSN={2169-3536}, url={http://dx.doi.org/10.1109/ACCESS.2021.3070646}, DOI={10.1109/access.2021.3070646}, journal={IEEE Access}, publisher={Institute of Electrical and Electronics Engineers (IEEE)}, author={Shavit, Yoli and Klein, Itzik}, year={2021}, pages={53540–53547} }