# hehefan/pst-transformer architecture

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

- Interactive diagram: https://gitdiagram.com/hehefan/pst-transformer
- Repository: https://github.com/hehefan/pst-transformer

## Overview

This repository implements PST-Transformer for point-cloud video classification, with training and evaluation entry points for MSR-Action3D and NTU60. The workflow loads sampled clips, embeds local spatio-temporal point neighborhoods, applies a transformer, and classifies the resulting representation; training scripts evaluate video-level predictions and manage optimization. The README also documents CUDA PointNet++ layers for furthest-point sampling and radius-neighbor search. Relationships among unsampled subsystems are shown only where imports or documentation support them; the CUDA implementation’s runtime callers are not established by the excerpts.

Main entry points: [`train-msr-small.py`](https://github.com/hehefan/pst-transformer/blob/main/train-msr-small.py) (MSR training), [`train-ntu60.py`](https://github.com/hehefan/pst-transformer/blob/main/train-ntu60.py) (NTU training), [`models/sequence_classification.py`](https://github.com/hehefan/pst-transformer/blob/main/models/sequence_classification.py) (Sequence classifier), [`modules/pointnet2_utils.py`](https://github.com/hehefan/pst-transformer/blob/main/modules/pointnet2_utils.py) (PointNet++ utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Datasets"]
  node_msr["MSR clips<br/>[msr.py]"]
  node_ntu["NTU60 clips<br/>[ntu60.py]"]
end

subgraph group_workflow["Training workflow"]
  node_msrtrain["MSR training<br/>[train-msr-small.py]"]
  node_ntutrain["NTU training<br/>[train-ntu60.py]"]
  node_schedule["LR schedule<br/>[scheduler.py]"]
  node_trainutils["Training utilities<br/>[utils.py]"]
end

subgraph group_network["PST model"]
  node_classifier["Sequence classifier"]
  node_p4d["4D convolution"]
  node_transformer["Spatio-temporal transformer<br/>[transformer_v1.py]"]
end

subgraph group_ops["Point operations"]
  node_pointmodules["PointNet++ modules"]
  node_pointutils["PointNet++ utilities<br/>[pointnet2_utils.py]"]
  node_torchutils["PyTorch utilities<br/>[pytorch_utils.py]"]
  node_cudaops["CUDA point operators"]
end

node_user(("Research user"))

node_user -->|"starts training"| node_msrtrain
node_user -->|"starts training"| node_ntutrain
node_msrtrain -->|"loads clips"| node_msr
node_ntutrain -->|"loads clips"| node_ntu
node_msrtrain -->|"constructs model"| node_classifier
node_ntutrain -->|"constructs model"| node_classifier
node_msrtrain -->|"uses schedule"| node_schedule
node_ntutrain -->|"uses schedule"| node_schedule
node_msrtrain -->|"logs and saves"| node_trainutils
node_ntutrain -->|"logs and saves"| node_trainutils
node_classifier -->|"embeds points"| node_p4d
node_classifier -->|"models features"| node_transformer
node_p4d -->|"samples and groups"| node_pointutils
node_pointmodules -->|"uses operations"| node_pointutils
node_pointutils -->|"uses helpers"| node_torchutils
node_user -.->|"builds CUDA layers"| node_cudaops

click node_msr "https://github.com/hehefan/pst-transformer/blob/main/datasets/msr.py"
click node_ntu "https://github.com/hehefan/pst-transformer/blob/main/datasets/ntu60.py"
click node_msrtrain "https://github.com/hehefan/pst-transformer/blob/main/train-msr-small.py"
click node_ntutrain "https://github.com/hehefan/pst-transformer/blob/main/train-ntu60.py"
click node_schedule "https://github.com/hehefan/pst-transformer/blob/main/scheduler.py"
click node_trainutils "https://github.com/hehefan/pst-transformer/blob/main/utils.py"
click node_classifier "https://github.com/hehefan/pst-transformer/blob/main/models/sequence_classification.py"
click node_p4d "https://github.com/hehefan/pst-transformer/blob/main/modules/point_4d_convolution.py"
click node_transformer "https://github.com/hehefan/pst-transformer/blob/main/modules/transformer_v1.py"
click node_pointmodules "https://github.com/hehefan/pst-transformer/blob/main/modules/pointnet2_modules.py"
click node_pointutils "https://github.com/hehefan/pst-transformer/blob/main/modules/pointnet2_utils.py"
click node_torchutils "https://github.com/hehefan/pst-transformer/blob/main/modules/pytorch_utils.py"
click node_cudaops "https://github.com/hehefan/pst-transformer/tree/main/modules/_ext_src"

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_msr,node_ntu,node_user toneBlue
class node_msrtrain,node_ntutrain,node_schedule,node_trainutils toneAmber
class node_classifier,node_p4d,node_transformer toneMint
class node_pointmodules,node_pointutils,node_torchutils,node_cudaops toneRose
```

## Components

### Datasets

- [MSR clips](https://github.com/hehefan/pst-transformer/blob/main/datasets/msr.py): `datasets/msr.py`
- [NTU60 clips](https://github.com/hehefan/pst-transformer/blob/main/datasets/ntu60.py): `datasets/ntu60.py`

### Training workflow

- [MSR training](https://github.com/hehefan/pst-transformer/blob/main/train-msr-small.py): `train-msr-small.py`
- [NTU training](https://github.com/hehefan/pst-transformer/blob/main/train-ntu60.py): `train-ntu60.py`
- [LR schedule](https://github.com/hehefan/pst-transformer/blob/main/scheduler.py): `scheduler.py`
- [Training utilities](https://github.com/hehefan/pst-transformer/blob/main/utils.py): `utils.py`

### PST model

- [Sequence classifier](https://github.com/hehefan/pst-transformer/blob/main/models/sequence_classification.py): `models/sequence_classification.py`
- [4D convolution](https://github.com/hehefan/pst-transformer/blob/main/modules/point_4d_convolution.py): `modules/point_4d_convolution.py`
- [Spatio-temporal transformer](https://github.com/hehefan/pst-transformer/blob/main/modules/transformer_v1.py): `modules/transformer_v1.py`

### Point operations

- [PointNet++ modules](https://github.com/hehefan/pst-transformer/blob/main/modules/pointnet2_modules.py): `modules/pointnet2_modules.py`
- [PointNet++ utilities](https://github.com/hehefan/pst-transformer/blob/main/modules/pointnet2_utils.py): `modules/pointnet2_utils.py`
- [PyTorch utilities](https://github.com/hehefan/pst-transformer/blob/main/modules/pytorch_utils.py): `modules/pytorch_utils.py`
- [CUDA point operators](https://github.com/hehefan/pst-transformer/tree/main/modules/_ext_src): `modules/_ext_src`

### Other components

- **Research user**

## Connections

- Research user → MSR training: starts training (evidence: `train-msr-small.py`)
- Research user → NTU training: starts training (evidence: `train-ntu60.py`)
- MSR training → MSR clips: loads clips (evidence: `train-msr-small.py`)
- NTU training → NTU60 clips: loads clips (evidence: `train-ntu60.py`)
- MSR training → Sequence classifier: constructs model (evidence: `train-msr-small.py`)
- NTU training → Sequence classifier: constructs model (evidence: `train-ntu60.py`)
- MSR training → LR schedule: uses schedule (evidence: `train-msr-small.py`)
- NTU training → LR schedule: uses schedule (evidence: `train-ntu60.py`)
- MSR training → Training utilities: logs and saves (evidence: `train-msr-small.py`)
- NTU training → Training utilities: logs and saves (evidence: `train-ntu60.py`)
- Sequence classifier → 4D convolution: embeds points (evidence: `models/sequence_classification.py`)
- Sequence classifier → Spatio-temporal transformer: models features (evidence: `models/sequence_classification.py`)
- 4D convolution → PointNet++ utilities: samples and groups (evidence: `modules/point_4d_convolution.py`)
- PointNet++ modules → PointNet++ utilities: uses operations (evidence: `modules/pointnet2_modules.py`)
- PointNet++ utilities → PyTorch utilities: uses helpers (evidence: `modules/pointnet2_utils.py`)
- Research user → CUDA point operators: builds CUDA layers (evidence: `README.md`)
