How wangyueft/dgcnn works
Project Type and Purpose
• This project implements Dynamic Graph CNN (DGCNN) for learning on point clouds. It provides re-implementations of the original paper using both PyTorch and TensorFlow.
• The project supports multiple high-level tasks such as classification, semantic segmentation, and part segmentation of 3D point clouds.
• That the project structure borrows ideas from the PointNet codebase, which is evident both in the file tree and the README references.
Analyzing the File Structure
• There are two primary directories at the top level: “pytorch” and “tensorflow.” Each directory isolates the implementation for the respective deep learning framework.
• The PyTorch directory contains:
• core files like main.py, data.py, model.py, and util.py.
• A “pretrained” folder that includes pretrained model weights.
• The TensorFlow directory’s structure is more segmented:
• High-level scripts (e.g., train.py, provider.py, evaluate.py).
• Specialized subdirectories for tasks such as "part_seg" (part segmentation) and "sem_seg" (semantic segmentation).
• Additional directories including “models” under tensorflow for model definitions (e.g., dgcnn.py, transform_nets.py), “misc” for demos and supporting images, and “utils” for helper functions relating to data preparation, transformation, and point cloud utilities.
• Build/deployment artifacts (e.g., download_data.sh, test scripts, saved checkpoints) are also present primarily within TensorFlow subdirectories.
Use of Architectural Patterns
• There is a clear separation between different implementations — one branch for PyTorch and another for TensorFlow. Each branch’s internal structure reflects stages such as data loading, model architecture, training routines, evaluation scripts, and utility functions.
• Within the TensorFlow branch, the segmentation tasks (both semantic and part) have dedicated folders that isolate training routines, model definitions, data handling (e.g., download scripts, meta files), and evaluation.
• The design inherently utilizes modular programming by separating core functionalities into distinct files (for example, model.py vs. util.py in PyTorch, and distinct directories for different segmentation tasks in TensorFlow).
• Main components:
• Frontend/Client layer (if applicable): While this project is primarily focused on research experiments and training pipelines, you might represent the experimental/testing interface as a “User/Experiment” input.
• PyTorch Implementation:
• Data Loader (data.py)
• Model Definition (model.py, util.py)
• Main Training/Inference Engine (main.py)
• Pretrained Model Store (pretrained/)
• TensorFlow Implementation:
• Core Training Scripts (train.py, train_multi_gpu.py)
• Segmentation Modules:
▪ Part Segmentation (part_seg/ directory – including scripts for training, testing, and data download)
▪ Semantic Segmentation (sem_seg/ directory – with training, evaluation, data preparation)
• Model Definitions (models/ directory – containing dgcnn.py and transform_nets.py)
• Utility Functions and Data Handlers (utils/ directory and provider.py)
• Evaluation and Inference Modules (evaluate.py, batch_inference.py)
• External Dependencies & Data:
• Pre-trained models stored in pytorch/pretrained or checkpoints under tensorflow/part_seg/train_results for saving and loading models.
• External data sources referenced in download_data.sh scripts.
• How data flows from external sources (or a data repository) → preprocessing utilities (e.g., data.py, pc_util.py) → into the model architectures.
• Distinct sections for PyTorch and TensorFlow pipelines, noting that they share a high-level common purpose but implement it through different frameworks.
• Interconnections where similar functionalities (e.g., segmentation) follow similar design patterns in both implementations.
Important Architectural Patterns and Design Principles
• Modularity: Every major functionality (data handling, model definition, training, evaluation) has its own module.
• Separation of Concerns: Code separation between different tasks (classification, part segmentation, semantic segmentation) is clear.
1. The PyTorch implementation pipeline (highlighting main.py, model.py, data.py, pretrained models).
2. The TensorFlow pipeline with further subdivisions:
▪ A section for part segmentation (part_seg) with training, testing, and checkpoint storage.
▪ A section for semantic segmentation (sem_seg) with training, data meta-information, and evaluation.
3. Shared utility and helper modules (provider.py, utils) that underpin both pipelines.
• External data ingestion points.
• Connections between training routines and model evaluation.
• How utility functions are shared among multiple components.
• Scalability aspects (e.g., multi-GPU support in TensorFlow) and modular design.
• Keep the layout clean and structured so that every component, its label, and interaction is clearly visible.