# erikwijmans/pointnet2_pytorch architecture

> Architecture diagram of the GitHub repository erikwijmans/pointnet2_pytorch, 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/erikwijmans/pointnet2_pytorch
- Repository: https://github.com/erikwijmans/pointnet2_pytorch

## Overview

##### Project type and purpose
- This is a research-oriented PyTorch library/CLI for PointNet++ (3D point-cloud neural network) training and inference.
- The README confirms it implements PointNet2 in PyTorch, wraps custom CUDA ops, supports multi-GPU via PyTorch DataParallel, uses Hydra for configuration and PyTorch Lightning for training orchestration.

##### File structure
- Top-level:
- setup.py, pyproject.toml, requirements.txt: packaging and dependencies
- pointnet2/: the main Python package
- pointnet2_ops_lib/: the custom CUDA extension library
- tests/: unit tests for classification and semantic segmentation
- pointnet2/ subdirectories:
- config/: all Hydra YAML configs (global config.yaml, subfolders model/ task/ task_model/)
- data/: Python DataLoader classes and utilities
- models/: Python model definitions for SSG/MSG and cls/semseg variants
- train.py: the entry-point training script
- utils/: miscellaneous Python helpers
- pointnet2_ops_lib/:
- pointnet2_ops/: Python bindings and helpers
- _ext-src/: C++/CUDA source for sampling, grouping, interpolation, ball-query kernels
- setup.py: build/install script for the extension

##### README for additional insights
- Project uses:
- PyTorch ≥1.0
- CUDA for custom ops
- Hydra for experiment/config management
- PyTorch Lightning for training loops & multi-GPU
- Usage pattern:
- “pip install -e .” to install Python package
- “pip install pointnet2_ops_lib/” to build CUDA kernels
- “python pointnet2/train.py task=…” to launch experiments

##### Detail without over-fragmentation
- Test suite as a validation overlay or side component that imports & runs key modules.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Training Orchestration
    Train["Training Orchestrator\n(pointnet2/train.py)"]:::python

    %% Configuration Layer
    subgraph "Configuration Layer"
        Config["Hydra Config\n(pointnet2/config/)"]:::python
    end

    %% Data Ingestion Layer
    subgraph "Data Ingestion Layer"
        Loader1["ModelNet40Loader\n(pointnet2/data/ModelNet40Loader.py)"]:::python
        Loader2["Indoor3DSemSegLoader\n(pointnet2/data/Indoor3DSemSegLoader.py)"]:::python
        DataUtils["Data Utilities\n(pointnet2/data/data_utils.py)"]:::python
    end

    %% Model Layer
    subgraph "Model Layer"
        MSG_CLS["MSG Classification\n(pointnet2/models/pointnet2_msg_cls.py)"]:::python
        MSG_SEM["MSG Segmentation\n(pointnet2/models/pointnet2_msg_sem.py)"]:::python
        SSG_CLS["SSG Classification\n(pointnet2/models/pointnet2_ssg_cls.py)"]:::python
        SSG_SEM["SSG Segmentation\n(pointnet2/models/pointnet2_ssg_sem.py)"]:::python
    end

    %% Utilities
    subgraph "Utilities"
        Utils["Misc Helpers\n(pointnet2/utils/)"]:::python
    end

    %% Custom Operations Library
    subgraph "Custom Ops Library"
        OpsBind["Python Bindings\n(pointnet2_ops_lib/pointnet2_ops/)"]:::cuda
        OpsSrc["CUDA Source\n(pointnet2_ops_lib/pointnet2_ops/_ext-src/)"]:::cuda
    end

    %% External Dependencies
    subgraph "External Dependencies"
        PyTorch["PyTorch"]:::external
        CUDA["CUDA"]:::external
        HydraExt["Hydra"]:::external
        Lightning["PyTorch Lightning"]:::external
    end

    %% Test Suite
    subgraph "Test Suite"
        TestCls["Classification Tests\n(tests/test_cls.py)"]:::tests
        TestSem["Segmentation Tests\n(tests/test_semseg.py)"]:::tests
        Conftest["PyTest Config\n(tests/conftest.py)"]:::tests
    end

    %% Connections
    Config -->|"config dict"| Train
    Train -->|"loads data"| Loader1
    Train -->|"loads data"| Loader2
    Train -->|"uses utils"| DataUtils
    Train -->|"initializes models"| MSG_CLS
    Train -->|"initializes models"| MSG_SEM
    Train -->|"initializes models"| SSG_CLS
    Train -->|"initializes models"| SSG_SEM
    Train -->|"calls helpers"| Utils
    MSG_CLS <-->|"operation call"| OpsBind
    MSG_SEM <-->|"operation call"| OpsBind
    SSG_CLS <-->|"operation call"| OpsBind
    SSG_SEM <-->|"operation call"| OpsBind
    OpsBind -->|"native kernels"| OpsSrc
    Train -->|"orchestrates"| Lightning
    Train -->|"multi-GPU"| PyTorch
    Loader1 -->|"tensor ops"| PyTorch
    Loader2 -->|"tensor ops"| PyTorch
    OpsSrc -->|"compiled by"| CUDA
    Config -->|"managed by"| HydraExt

    %% Test connections
    TestCls -->|imports| Train
    TestCls -->|imports| MSG_CLS
    TestSem -->|imports| Train
    TestSem -->|imports| MSG_SEM
    Conftest -->|configures| TestCls
    Conftest -->|configures| TestSem

    %% Click Events
    click Config "https://github.com/erikwijmans/pointnet2_pytorch/tree/master/pointnet2/config/"
    click Loader1 "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/data/ModelNet40Loader.py"
    click Loader2 "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/data/Indoor3DSemSegLoader.py"
    click DataUtils "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/data/data_utils.py"
    click MSG_CLS "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/models/pointnet2_msg_cls.py"
    click MSG_SEM "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/models/pointnet2_msg_sem.py"
    click SSG_CLS "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/models/pointnet2_ssg_cls.py"
    click SSG_SEM "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/models/pointnet2_ssg_sem.py"
    click Train "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/pointnet2/train.py"
    click Utils "https://github.com/erikwijmans/pointnet2_pytorch/tree/master/pointnet2/utils/"
    click OpsBind "https://github.com/erikwijmans/pointnet2_pytorch/tree/master/pointnet2_ops_lib/pointnet2_ops/"
    click OpsSrc "https://github.com/erikwijmans/pointnet2_pytorch/tree/master/pointnet2_ops_lib/pointnet2_ops/_ext-src/"
    click TestCls "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/tests/test_cls.py"
    click TestSem "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/tests/test_semseg.py"
    click Conftest "https://github.com/erikwijmans/pointnet2_pytorch/blob/master/tests/conftest.py"

    %% Styles
    classDef python fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef cuda fill:#FADBD8,stroke:#922B21,color:#641E16;
    classDef external fill:#EBF5FB,stroke:#21618C,color:#1B2631,stroke-dasharray: 5 5;
    classDef tests fill:#EAFAF1,stroke:#1D8348,color:#145A32;
```
