This code is adapted from HOC-Search for generating views and instance segmentations for individual objects.
[Dislaimer] We don't maintain code in this subdirectory.
cdintoscannotate_preprocessingdirectory, assuming the current directory is the root of this repository :
cd scannotate_preprocessing- We suggest creating a new environment:
conda env create -f environment.yml
conda activate hoc_preprocessing- Install SAM
pip install git+https://github.com/facebookresearch/segment-anything.git- Download SAM weights:
defaultorvit_h: ViT-H SAM model.vit_l: ViT-L SAM model.vit_b: ViT-B SAM model.
-
Make sure you are in the
scannotate_preprocessingdirectory. -
Modify config script
config/0_Scannotate_masks.iniand adapt paths.
SCANNOTATE_PATH should point to the base of SCANnotate dataset.
out_folder is the folder containing SCANnotate annotations and where instance masks will be extracted. Structure should
be as follows:
├── <SCANNOTATE_PATH>
│ ├── annotations
│ │ ├── <scene_name>
│ │ │ ├── <scene_name>.pkl
│ │ ├── ...
SCANNET_base_path is the base path where ScanNet scenes are located with structure:
├── <SCANNET_base_path>
│ ├── <scene_name>
│ │ ├── color
│ │ ├── depth
│ │ ├── intrinsic
│ │ ├── pose
│ │ ├── <scene_name>.pkl
│ │ ├── ...
│ ├── ...
- Render all 2D masks from 3D:
python ScanNet_renderer/Render_Scannotate_masks.pyMasks will be saved to SCANNOTATE_PATH:
├── <SCANNOTATE_PATH>
│ ├── annotations
│ │ ├── <scene_name>
│ │ │ ├── <scene_name>.pkl
│ │ │ ├── all_inst_seg_2d
│ │ │ ├── mask2d_from_3d
│ │ ├── ...
- Finally, calculate SAM masks for each object:
python ScanNet_renderer/Scannotate_2d_mask_predictor.pyMasks will be saved to SCANNOTATE_PATH:
├── <SCANNOTATE_PATH>
│ ├── annotations
│ │ ├── <scene_name>
│ │ │ ├── <scene_name>.pkl
│ │ │ ├── all_inst_seg_2d
│ │ │ ├── mask2d_from_3d
│ │ │ ├── sam_results_path
│ │ │ ├── valid_maps
│ │ ├── ...