This repository contains the implementation of SGS-3D, our novel 3D instance segmentation method submitted for anonymous review. SGS-3D introduces significant improvements in 3D instance generation from 2D masks, with a focus on ScanNet200 dataset.
The following installation guide assumes python=3.8, pytorch=1.12.1, cuda=11.3. You may adjust according to your system.
conda create -n SGS3D python=3.8
conda activate SGS3D
conda install pytorch==1.12.1 torchvision==0.13.1 cudatoolkit=11.3 -c pytorch# Install spconv
pip3 install spconv-cu113==2.1.25
# Install torch_scatter (version must match your python version)
# Visit https://data.pyg.org/whl/torch-1.12.1+cu113.html for the correct version
pip install torch_scatter-2.1.0+pt112cu113-cp38-cp38-linux_x86_64.whl
# Install Detectron2
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'# Install GroundingDINO + SAM (for 2D mask extraction)
cd segmenter2d/
cd GroundingDINO/
pip install -e .
cd ../segment_anything
pip install -e .
cd ../../pip install scikit-image opencv-python open3d imageio plyfile
pip install -r requirements.txtmkdir -p pretrains/foundation_models
cd pretrains/foundation_models
# Grounding DINO and Segment Anything models
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
wget https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pthSGS-3D focuses on ScanNet200 dataset. We also provide support for ScanNet++ and KITTI-360 for reference.
data/
βββ Scannet200/
β βββ Scannet200_2D/
β β βββ val/
β β β βββ scene0011_00/
β β β β βββ color/ # RGB images
β β β β β βββ 00000.jpg
β β β β β βββ ...
β β β β βββ depth/ # Depth images
β β β β β βββ 00000.png
β β β β β βββ ...
β β β β βββ pose/ # Camera poses
β β β β β βββ 00000.txt
β β β β β βββ ...
β β β β βββ intrinsic.txt # Camera intrinsics
β β β β βββ intrinsic_depth.txt
β β β βββ ...
β β βββ train/
β β βββ test/
β βββ Scannet200_3D/ # 3D point clouds and annotations
β βββ val/
β β βββ original_ply_files/ # Original PLY files
β β β βββ scene0011_00.ply
β β β βββ ...
β β βββ groundtruth/ # Ground truth annotations
β β β βββ scene0011_00.pth
β β β βββ ...
β β βββ superpoints/ # Superpoint segmentation
β β β βββ scene0011_00.pth
β β β βββ ...
β β βββ dc_feat_scannet200/ # Deep features (optional)
β β βββ scene0011_00.pth
β β βββ ...
β βββ train/
β βββ test/
-
Download ScanNet200 Dataset
- Download from ScanNetV2 official website
- Follow ScanNet license requirements
-
Generate RGB-D Images and Poses
- Use ScanNet SensReader
- Extract with 5-frame interval for efficiency
-
Generate Superpoints
- Follow ScanNet preprocessing
- Generate superpoint segmentation
-
Generate 3D Features
- Follow Mask3D
- Generate high-dimension features of points
Similar structure to ScanNet200:
data/
βββ Scannetpp/
β βββ Scannetpp_2D/
β β βββ val/
β β β βββ 0d2ee665be/
β β β β βββ color/
β β β β βββ depth/
β β β β βββ pose/
β β β β βββ intrinsic/ # Per-frame intrinsics
β β β β βββ ...
β β β βββ ...
β βββ Scannetpp_3D/
β βββ val/
β β βββ original_ply_files/
β β βββ groundtruth/
β β βββ superpoints/
β β βββ dc_feat_scannetpp/
β βββ ...
For outdoor scene evaluation:
data/
βββ Kitti360/
β βββ Kitti360_2D/
β β βββ val/
β β β βββ 0010_sync_0000002756_0000002920/
β β β β βββ color/ # RGB images
β β β β β βββ 0000002756.png
β β β β β βββ 0000002759.png
β β β β β βββ ...
β β β β βββ depth/ # Depth images
β β β β β βββ 0000002756.png
β β β β β βββ 0000002759.png
β β β β β βββ ...
β β β β βββ pose/ # Camera poses
β β β β β βββ 0000002756.txt
β β β β β βββ 0000002759.txt
β β β β β βββ ...
β β β β βββ intrinsic.txt # Camera intrinsics
β β β βββ ...
β β βββ train/
β β βββ test/
β βββ Kitti360_3D/ # 3D point clouds and annotations
β βββ val/
β β βββ original_ply_files/ # Original PLY files
β β β βββ 0010_sync_0000002756_0000002920.ply
β β β βββ ...
β β βββ groundtruth/ # Ground truth annotations
β β β βββ 0010_sync_0000002756_0000002920.pth
β β β βββ ...
β β βββ superpoints/ # Superpoint segmentation
β β β βββ 0010_sync_0000002756_0000002920.pth
β β β βββ ...
β β βββ dc_feat_kitti360/ # Deep features
β β βββ 0010_sync_0000002756_0000002920.pth
β β βββ ...
β βββ train/
β βββ test/
We provide complete SGS-3D results for all 312 ScanNet200 validation scenes for anonymous review.
For Reviewers: Please download the following files to reproduce our evaluation results:
-
Ground Truth Data (Required for evaluation)
- Download: groundtruth.zip
- Extract to:
data/scannet200/val/groundtruth/ - Contains: 312
.pthfiles with ground truth annotations
-
SGS-3D Results (Our method's predictions)
- Download: scannet200_312_scenes_results.zip
- Extract to:
results/scannet200_312_scenes/ - Contains: 312
.pthfiles with our predictions
# 1. Create directories
mkdir -p data/scannet200/val/groundtruth
mkdir -p results/scannet200_312_scenes
# 2. Download and extract ground truth
# Download groundtruth.zip from https://gofile.io/d/uac9DT
unzip groundtruth.zip -d data/scannet200/val/groundtruth/
# 3. Download and extract results
# Download scannet200_312_scenes.zip from https://gofile.io/d/xhX1eX
unzip scannet200_312_scenes.zip -d results/
# 4. Run evaluation
python tools/eval_classagnostic.py \
--config configs/scannet200_sgs3d.yaml \
--type 2DIf you have ScanNet200 data prepared:
# Run full pipeline
./run_full_pipeline.sh configs/scannet200_sgs3d.yaml
# Or step by step:
sh scripts/extract_2d_masks.sh configs/scannet200_sgs3d.yaml
sh scripts/generate_3d_inst.sh configs/scannet200_sgs3d.yaml
sh scripts/eval_classagnostic.sh configs/scannet200_sgs3d.yamlpython demo.py --mode full # Complete pipeline demo
python demo.py --mode 2d # 2D mask extraction demo
python demo.py --mode 3d # 3D instance generation demo
python demo.py --mode eval # Evaluation demoWhat's Included:
- β Complete working pipeline with simplified algorithms
- β Full evaluation framework with class-agnostic metrics
- β Complete results for all 312 ScanNet200 scenes
- β Reproducible evaluation using provided results
What's Simplified:
- π Core clustering algorithms (simplified for review)
- π Advanced filtering techniques (basic version provided)
- π Optimization strategies (performance optimizations hidden)
Full Version Promise: Upon paper acceptance, we will release:
- Complete implementation with all optimizations
- Detailed experimental code and configurations
- Pre-trained models and processed datasets
- Comprehensive documentation and tutorials
SGS-3D/
βββ README.md # This comprehensive guide
βββ configs/scannet200_sgs3d.yaml # Main configuration
βββ results/scannet200_312_scenes/ # Complete results (312 scenes)
βββ tools/
β βββ extract_2d_masks.py # 2D mask extraction
β βββ generate_3d_inst.py # 3D instance generation
β βββ eval_classagnostic.py # Evaluation script
βββ scripts/ # Shell scripts for each step
βββ src/clustering/ # Clustering algorithms (simplified)
βββ util2d/ # 2D processing utilities
βββ evaluation/ # Evaluation framework
βββ dataset/ # Dataset loaders (ScanNet200 focus)
βββ demo.py # Demo and testing
# Evaluate with provided results
python tools/eval_classagnostic.py \
--config configs/scannet200_sgs3d.yaml \
--type 2D# Complete pipeline
./run_full_pipeline.sh configs/scannet200_sgs3d.yaml# Step 1: Extract 2D masks
sh scripts/extract_2d_masks.sh configs/scannet200_sgs3d.yaml
# Step 2: Generate 3D instances
sh scripts/generate_3d_inst.sh configs/scannet200_sgs3d.yaml
# Step 3: Evaluate results
sh scripts/eval_classagnostic.sh configs/scannet200_sgs3d.yamlImportant for Reviewers:
- All data is provided via anonymous file sharing links
Our implementation is mainly based on the following repositories. Thanks to their authors: