Skip to content

pis2016004-prog/SGS-3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SGS-3D: High-Fidelity 3D Instance Segmentation via Reliable Semantic Mask Splitting and Growing

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.

πŸ”§ Installation

Environment Requirements

The following installation guide assumes python=3.8, pytorch=1.12.1, cuda=11.3. You may adjust according to your system.

1. Create Environment

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

2. Install Core Dependencies

# 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'

3. Install Foundation Models

# Install GroundingDINO + SAM (for 2D mask extraction)
cd segmenter2d/
cd GroundingDINO/
pip install -e .
cd ../segment_anything
pip install -e .
cd ../../

4. Install Additional Dependencies

pip install scikit-image opencv-python open3d imageio plyfile
pip install -r requirements.txt

5. Download Pretrained Models

mkdir -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.pth

πŸ“ Data Preparation

SGS-3D focuses on ScanNet200 dataset. We also provide support for ScanNet++ and KITTI-360 for reference.

ScanNet200 (Primary Dataset)

Data Structure

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/

Data Preparation Steps

  1. Download ScanNet200 Dataset

  2. Generate RGB-D Images and Poses

  3. Generate Superpoints

  4. Generate 3D Features

    • Follow Mask3D
    • Generate high-dimension features of points

ScanNet++ (Reference)

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/
β”‚       └── ...

KITTI-360 (Reference)

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/

πŸš€ Quick Start

Option 1: Evaluate with Provided Results (Recommended)

We provide complete SGS-3D results for all 312 ScanNet200 validation scenes for anonymous review.

Download Required Files

For Reviewers: Please download the following files to reproduce our evaluation results:

  1. Ground Truth Data (Required for evaluation)

    • Download: groundtruth.zip
    • Extract to: data/scannet200/val/groundtruth/
    • Contains: 312 .pth files with ground truth annotations
  2. SGS-3D Results (Our method's predictions)

Setup Instructions

# 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 2D

Option 2: Run Complete Pipeline

If 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.yaml

Option 3: Demo Mode

python 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 demo

Anonymous Review Notes

What'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

πŸ“Š File Structure

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

πŸ“– Usage Examples

Quick Evaluation

# Evaluate with provided results
python tools/eval_classagnostic.py \
    --config configs/scannet200_sgs3d.yaml \
    --type 2D

Full Pipeline

# Complete pipeline
./run_full_pipeline.sh configs/scannet200_sgs3d.yaml

Step-by-Step

# 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.yaml

Anonymous Review Data

Important for Reviewers:

  • All data is provided via anonymous file sharing links

πŸ™ Acknowledgments

Our implementation is mainly based on the following repositories. Thanks to their authors:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors