# guptabhishekumar/picostep architecture

> Architecture diagram of the GitHub repository guptabhishekumar/picostep, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guptabhishekumar/picostep
- Repository: https://github.com/guptabhishekumar/picostep

## Overview

PicoStep is a tiny wearable step-counting product, delivered as both a Python INT8 inference library and an Android sensor application. The user-facing flow is sensor samples → buffered windows → preprocessing/features → model prediction → arm-swing rejection and step accumulation. The repository also contains a substantial acc_gyro model-training workflow; README-documented runtime capabilities are retained where their implementation was not sampled. Some Android stage internals and Python preprocessing/windowing code were not excerpted, so only documented or indexed relationships are shown.

Main entry points: [`android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt) (Step pipeline), [`training/acc_gyro/pipeline.py`](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/pipeline.py) (Training workflow), [`android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt`](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt) (Feature extraction), [`src/picostep/inference.py`](https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/inference.py) (Python counter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android runtime"]
  node_main["Counter app<br/>[MainActivity.kt]"]
  node_ring["Sample ring buffer<br/>[RingBuffer.kt]"]
  node_pipeline["Step pipeline<br/>[StepPipeline.kt]"]
  node_signal["Signal processing<br/>[SignalProcessor.kt]"]
  node_predictor["Step predictor<br/>[StepPredictor.kt]"]
  node_reject["Arm-swing rejection"]
  node_stages["Walking filters"]
  node_accumulate["Step accumulator<br/>[StepAccumulator.kt]"]
end

subgraph group_python["Python inference"]
  node_python_api["Python counter<br/>[inference.py]"]
  node_pyreject["Python rejector<br/>[rejection.py]"]
end

subgraph group_training["Model training"]
  node_trainpipe["Training workflow<br/>[pipeline.py]"]
  node_loader["Dataset loader<br/>[data_loader.py]"]
  node_labeler["Step labeling"]
  node_windowing["Training windows<br/>[windowing.py]"]
  node_trainfeatures["Training features"]
  node_modeltrain["Model fitting<br/>[model_training.py]"]
  node_selection["Feature selection"]
  node_evaluation["Model evaluation<br/>[evaluation.py]"]
  node_export["Model export<br/>[export.py]"]
end

subgraph group_features["Feature computation"]
  node_extract["Feature extraction"]
  node_bio["Biomechanical features"]
  node_fft["FFT<br/>[FFT.kt]"]
  node_wavelet["Wavelet transform"]
  node_pyfeatures["acc_gyro features"]
  node_pyonly["acc_only features<br/>[acc_only.py]"]
end

node_wearer(("Wearable user"))
node_imu(("IMU stream"))
node_count(("Step count"))
node_data[("Training datasets")]

node_wearer -->|"starts"| node_main
node_imu -->|"streams samples"| node_ring
node_main -->|"starts"| node_pipeline
node_pipeline -->|"reads windows"| node_ring
node_pipeline -->|"processes window"| node_signal
node_pipeline -->|"extracts features"| node_extract
node_extract -->|"uses"| node_fft
node_extract -->|"uses"| node_wavelet
node_extract -->|"uses"| node_bio
node_pipeline -->|"computes biomechanics"| node_bio
node_pipeline -->|"predicts steps"| node_predictor
node_pipeline -->|"filters prediction"| node_stages
node_pipeline -.->|"rejects arm swing"| node_reject
node_pipeline -->|"adds prediction"| node_accumulate
node_accumulate -->|"updates total"| node_count
node_python_api -->|"extracts features"| node_pyfeatures
node_python_api -->|"extracts features"| node_pyonly
node_python_api -->|"optionally rejects"| node_pyreject
node_data -.->|"supplies data"| node_trainpipe
node_trainpipe -->|"loads datasets"| node_loader
node_trainpipe -->|"labels steps"| node_labeler
node_trainpipe -->|"creates windows"| node_windowing
node_trainpipe -->|"extracts features"| node_trainfeatures
node_trainpipe -->|"fits models"| node_modeltrain
node_trainpipe -->|"selects features"| node_selection
node_trainpipe -->|"evaluates models"| node_evaluation
node_trainpipe -->|"exports models"| node_export

click node_main "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/MainActivity.kt"
click node_ring "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/core/RingBuffer.kt"
click node_pipeline "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt"
click node_signal "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/SignalProcessor.kt"
click node_extract "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt"
click node_bio "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/features/BiomechanicalFeatures.kt"
click node_fft "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/FFT.kt"
click node_wavelet "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/WaveletTransform.kt"
click node_predictor "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/ml/StepPredictor.kt"
click node_reject "https://github.com/guptabhishekumar/picostep/blob/main/android/Elegant5StageRejector.kt"
click node_stages "https://github.com/guptabhishekumar/picostep/tree/main/android/app/src/main/java/com/stepdetector/pipeline/stages"
click node_accumulate "https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/pipeline/stages/StepAccumulator.kt"
click node_python_api "https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/inference.py"
click node_pyfeatures "https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/features/_acc_gyro/feature_extraction.py"
click node_pyonly "https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/features/acc_only.py"
click node_pyreject "https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/rejection.py"
click node_trainpipe "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/pipeline.py"
click node_loader "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/data_loader.py"
click node_labeler "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/verisense_labeler.py"
click node_windowing "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/windowing.py"
click node_trainfeatures "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/feature_extraction.py"
click node_modeltrain "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/model_training.py"
click node_selection "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/feature_selection.py"
click node_evaluation "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/evaluation.py"
click node_export "https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/export.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_ring,node_pipeline,node_signal,node_predictor,node_reject,node_stages,node_accumulate,node_wearer toneBlue
class node_python_api,node_pyreject,node_data toneAmber
class node_trainpipe,node_loader,node_labeler,node_windowing,node_trainfeatures,node_modeltrain,node_selection,node_evaluation,node_export toneMint
class node_extract,node_bio,node_fft,node_wavelet,node_pyfeatures,node_pyonly toneRose
class node_imu,node_count toneIndigo
```

## Components

### Android runtime

- [Counter app](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/MainActivity.kt): `android/app/src/main/java/com/stepdetector/MainActivity.kt`
- [Sample ring buffer](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/core/RingBuffer.kt): `android/app/src/main/java/com/stepdetector/core/RingBuffer.kt`
- [Step pipeline](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt): `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`
- [Signal processing](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/SignalProcessor.kt): `android/app/src/main/java/com/stepdetector/dsp/SignalProcessor.kt`
- [Step predictor](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/ml/StepPredictor.kt): `android/app/src/main/java/com/stepdetector/ml/StepPredictor.kt`
- [Arm-swing rejection](https://github.com/guptabhishekumar/picostep/blob/main/android/Elegant5StageRejector.kt): `android/Elegant5StageRejector.kt`
- [Walking filters](https://github.com/guptabhishekumar/picostep/tree/main/android/app/src/main/java/com/stepdetector/pipeline/stages): `android/app/src/main/java/com/stepdetector/pipeline/stages`
- [Step accumulator](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/pipeline/stages/StepAccumulator.kt): `android/app/src/main/java/com/stepdetector/pipeline/stages/StepAccumulator.kt`

### Python inference

- [Python counter](https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/inference.py): `src/picostep/inference.py`
- [Python rejector](https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/rejection.py): `src/picostep/rejection.py`

### Model training

- [Training workflow](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/pipeline.py): `training/acc_gyro/pipeline.py`
- [Dataset loader](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/data_loader.py): `training/acc_gyro/data_loader.py`
- [Step labeling](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/verisense_labeler.py): `training/acc_gyro/verisense_labeler.py`
- [Training windows](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/windowing.py): `training/acc_gyro/windowing.py`
- [Training features](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/feature_extraction.py): `training/acc_gyro/feature_extraction.py`
- [Model fitting](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/model_training.py): `training/acc_gyro/model_training.py`
- [Feature selection](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/feature_selection.py): `training/acc_gyro/feature_selection.py`
- [Model evaluation](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/evaluation.py): `training/acc_gyro/evaluation.py`
- [Model export](https://github.com/guptabhishekumar/picostep/blob/main/training/acc_gyro/export.py): `training/acc_gyro/export.py`

### Feature computation

- [Feature extraction](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt): `android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt`
- [Biomechanical features](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/features/BiomechanicalFeatures.kt): `android/app/src/main/java/com/stepdetector/features/BiomechanicalFeatures.kt`
- [FFT](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/FFT.kt): `android/app/src/main/java/com/stepdetector/dsp/FFT.kt`
- [Wavelet transform](https://github.com/guptabhishekumar/picostep/blob/main/android/app/src/main/java/com/stepdetector/dsp/WaveletTransform.kt): `android/app/src/main/java/com/stepdetector/dsp/WaveletTransform.kt`
- [acc_gyro features](https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/features/_acc_gyro/feature_extraction.py): `src/picostep/features/_acc_gyro/feature_extraction.py`
- [acc_only features](https://github.com/guptabhishekumar/picostep/blob/main/src/picostep/features/acc_only.py): `src/picostep/features/acc_only.py`

### Other components

- **Wearable user**
- **IMU stream**
- **Step count**
- **Training datasets**

## Connections

- Wearable user → Counter app: starts (evidence: `README.md`)
- IMU stream → Sample ring buffer: streams samples (evidence: `README.md`)
- Counter app → Step pipeline: starts (evidence: `android/app/src/main/java/com/stepdetector/MainActivity.kt`)
- Step pipeline → Sample ring buffer: reads windows (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step pipeline → Signal processing: processes window (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step pipeline → Feature extraction: extracts features (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Feature extraction → FFT: uses (evidence: `android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt`)
- Feature extraction → Wavelet transform: uses (evidence: `android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt`)
- Feature extraction → Biomechanical features: uses (evidence: `android/app/src/main/java/com/stepdetector/features/FeatureExtractor.kt`)
- Step pipeline → Biomechanical features: computes biomechanics (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step pipeline → Step predictor: predicts steps (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step pipeline → Walking filters: filters prediction (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step pipeline → Arm-swing rejection: rejects arm swing
- Step pipeline → Step accumulator: adds prediction (evidence: `android/app/src/main/java/com/stepdetector/pipeline/StepPipeline.kt`)
- Step accumulator → Step count: updates total (evidence: `README.md`)
- Python counter → acc_gyro features: extracts features (evidence: `src/picostep/inference.py`)
- Python counter → acc_only features: extracts features (evidence: `src/picostep/inference.py`)
- Python counter → Python rejector: optionally rejects (evidence: `src/picostep/inference.py`)
- Training datasets → Training workflow: supplies data
- Training workflow → Dataset loader: loads datasets (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Step labeling: labels steps (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Training windows: creates windows (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Training features: extracts features (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Model fitting: fits models (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Feature selection: selects features (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Model evaluation: evaluates models (evidence: `training/acc_gyro/pipeline.py`)
- Training workflow → Model export: exports models (evidence: `training/acc_gyro/pipeline.py`)
