# liu-feng/pct-tensorflow architecture

> Architecture diagram of the GitHub repository liu-feng/pct-tensorflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liu-feng/pct-tensorflow
- Repository: https://github.com/liu-feng/pct-tensorflow

## Overview

##### Project type and purpose
- This is a machine-learning training framework in TensorFlow implementing PCT (Point Cloud Transformer) for 3D point cloud classification.
- It uses ModelNet40 as its dataset and provides both training (`train.py`) and evaluation (`test.py`) scripts.
- Custom high-performance TensorFlow ops (grouping, sampling, interpolation) are written in C++/CUDA under `tf_ops`.

##### File structure
- Top level
- README.md – project overview and usage
- model.py – definition of the PCT network (backbone + transformer layers)
- train.py / test.py – entry points for training and testing
- utils/ – helper modules (data provider, PointNet utilities, TF utilities)
- tf_ops/ – custom TF kernels, each under its own subdirectory:
– grouping/ (tf_grouping.cpp, CUDA sources, Python wrapper, tests)
– sampling/ (tf_sampling.cpp, CUDA sources, Python wrapper, compile scripts)
– interpolation/ (tf_interpolate.cpp, Python wrapper, tests, visualization script)
- Build/deploy
- Each tf_op has a `*_compile.sh` to build the shared library
- Test harnesses under each op’s `test/` directory

##### README for insights
- Describes classification task on ModelNet40
- Directs user to build tf_ops, place dataset in `datasets/modelnet40_ply_hdf5_2048/`
- Summarizes workflow: compile ops → `train.py` → `test.py`

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Data Layer"
        Dataset["ModelNet40 Dataset"]:::data
        Provider["Data Provider\n(utils/provider.py)"]:::data
    end

    subgraph "Preprocessing / Custom Ops"
        SamplingOp["tf_sampling Op"]:::ops
        GroupingOp["tf_grouping Op"]:::ops
        InterpolationOp["tf_interpolate Op"]:::ops
    end

    subgraph "Model Definition"
        PointNet["PointNet Feature Extractor\n(utils/pointnet_util.py)"]:::model
        TFUtil["TensorFlow Utils\n(utils/tf_util.py)"]:::model
        PCTModel["PCT Transformer + Backbone\n(model.py)"]:::model
    end

    subgraph "Pipelines"
        Train["Training Script\n(train.py)"]:::script
        Test["Evaluation Script\n(test.py)"]:::script
    end

    GPU["GPU / Runtime"]:::runtime
    README["README.md"]:::script

    Dataset --> Provider
    Provider --> SamplingOp
    Provider --> GroupingOp
    Provider --> InterpolationOp

    SamplingOp --> PointNet
    GroupingOp --> PointNet
    InterpolationOp --> PointNet

    PointNet --> PCTModel
    TFUtil --> PCTModel

    SamplingOp --> GPU
    GroupingOp --> GPU
    InterpolationOp --> GPU
    PCTModel --> GPU

    Train --> Provider
    Train --> SamplingOp
    Train --> GroupingOp
    Train --> InterpolationOp
    Train --> TFUtil
    Train --> PCTModel
    Train --> GPU

    Test --> Provider
    Test --> SamplingOp
    Test --> GroupingOp
    Test --> InterpolationOp
    Test --> TFUtil
    Test --> PCTModel
    Test --> GPU

    README --> SamplingOp
    README --> GroupingOp
    README --> InterpolationOp
    README --> Train
    README --> Test

    click Provider "https://github.com/liu-feng/pct-tensorflow/blob/main/utils/provider.py"
    click PointNet "https://github.com/liu-feng/pct-tensorflow/blob/main/utils/pointnet_util.py"
    click TFUtil "https://github.com/liu-feng/pct-tensorflow/blob/main/utils/tf_util.py"
    click PCTModel "https://github.com/liu-feng/pct-tensorflow/blob/main/model.py"
    click Train "https://github.com/liu-feng/pct-tensorflow/blob/main/train.py"
    click Test "https://github.com/liu-feng/pct-tensorflow/blob/main/test.py"
    click SamplingOp "https://github.com/liu-feng/pct-tensorflow/blob/main/tf_ops/sampling/tf_sampling.py"
    click GroupingOp "https://github.com/liu-feng/pct-tensorflow/blob/main/tf_ops/grouping/tf_grouping.py"
    click InterpolationOp "https://github.com/liu-feng/pct-tensorflow/blob/main/tf_ops/interpolation/tf_interpolate.py"
    click README "https://github.com/liu-feng/pct-tensorflow/blob/main/README.md"

    classDef data fill:#bbdefb,stroke:#1e88e5,stroke-width:2px
    classDef ops fill:#c8e6c9,stroke:#388e3c,stroke-width:2px
    classDef model fill:#ffe0b2,stroke:#f57c00,stroke-width:2px
    classDef script fill:#eeeeee,stroke:#9e9e9e,stroke-width:2px
    classDef runtime fill:#e1bee7,stroke:#8e24aa,stroke-width:2px
```
