{"id":13829187,"url":"https://github.com/facebookresearch/PointContrast","last_synced_at":"2025-07-09T09:32:47.391Z","repository":{"id":39758232,"uuid":"291783473","full_name":"facebookresearch/PointContrast","owner":"facebookresearch","description":"Code for paper \u003cPointContrast: Unsupervised Pretraining for 3D Point Cloud Understanding\u003e","archived":true,"fork":false,"pushed_at":"2021-08-30T20:44:17.000Z","size":488,"stargazers_count":330,"open_issues_count":19,"forks_count":33,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-02-23T00:14:48.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookresearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-31T17:41:38.000Z","updated_at":"2025-02-06T19:11:31.000Z","dependencies_parsed_at":"2022-07-31T23:38:15.940Z","dependency_job_id":null,"html_url":"https://github.com/facebookresearch/PointContrast","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/facebookresearch/PointContrast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2FPointContrast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2FPointContrast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2FPointContrast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2FPointContrast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookresearch","download_url":"https://codeload.github.com/facebookresearch/PointContrast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2FPointContrast/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264431238,"owners_count":23607207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T10:00:23.969Z","updated_at":"2025-07-09T09:32:47.060Z","avatar_url":"https://github.com/facebookresearch.png","language":"Python","funding_links":[],"categories":["2020","Computer Vision"],"sub_categories":["3D Feature Learning"],"readme":"### [New Codebase Update] \nThis repo is *not* actively maintained. \n\nPlease checkout our new codebase **ContrastiveSceneContexts** that upgrades PointContrast with better representation learning capability and works better on data efficient benchmarks. \nhttps://github.com/facebookresearch/ContrastiveSceneContexts\n\n# PointContrast: Unsupervised Pre-training for 3D Point Cloud Understanding\n\nArguably one of the top success stories of deep learning is transfer learning. The finding that pre-training a network on a rich source set (e.g., ImageNet) can help boost performance once fine-tuned on a usually much smaller target set, has been instrumental to many applications in language and vision. Yet, very little is known about its usefulness in 3D point cloud understanding. We see this as an opportunity considering the effort required for annotating data in 3D. In this work, we aim at facilitating research on 3D representation learning. Different from previous works, we focus on high-level scene understanding tasks. To this end, we select a suite of diverse datasets and tasks to measure the effect of unsupervised pre-training on a large source set of 3D scenes. Our findings are extremely encouraging: using a unified triplet of architecture, source dataset, and contrastive loss for pre-training, we achieve improvement over recent best results in segmentation and detection across 6 different benchmarks for indoor and outdoor, real and synthetic datasets – demonstrating that the learned representation can generalize across domains. Furthermore, the improvement was similar to supervised pre-training, suggesting that future efforts should favor scaling data collection over more detailed nnotation. We hope these findings will encourage more research on unsupervised pretext task design for 3D deep learning.\n\n\n[[ECCV 2020 Paper]](https://arxiv.org/abs/2007.10985) [[Spotlight Talk]](https://www.youtube.com/watch?v=MSWfDnnQ8kg)\n\n\n![PointContrast](assets/point_contrast_pipeline.png)\n\n\n## Environment\nThis codebase was tested with the following environment configurations.\n- Ubuntu 14.04\n- CUDA 10.2\n- Python v3.7\n- Pytorch v1.5\n- [MinkowskiEngine](https://github.com/stanfordvl/MinkowskiEngine) v0.4.3 (Note: The original experiments were conducted with ME v0.3.3; ME v0.5 above might provide a substantial [speed up](https://github.com/chrischoy/MinkowskiEngineBenchmark) but it requires additional [migration](https://github.com/NVIDIA/MinkowskiEngine/wiki/Migration-Guide-from-v0.4.x-to-0.5.x).)\n\n\n## Installation \u0026 Dataset Processin\n\nWe use conda for the installation process:\n```\nconda create -n pc_env python=3.7\nconda activate pc_env\nconda install pytorch -c pytorch\nDownload code from https://github.com/NVIDIA/MinkowskiEngine/releases/tag/v0.4.3, compile and install MinkowskiEngine.\n```\n\n\nNext, download PointContrast git repository and install the requirement from the PointContrast root directory..\n\n```\ngit clone https://github.com/facebookresearch/PointContrast.git\ncd PointContrast\npip install -r requirements.txt\n```\n\n\nOur code also depends on [Hydra](https://github.com/facebookresearch/hydra), a framework for experiment configurations.\n```\n# Install Hydra by:\npip install hydra-core --upgrade\n```\n\nFor pre-training, a set of preprocessing tools are provided in PointContrast/pretrain/data_preprocess/. Follow the README file there to generate the ScanNet Pair Dataset. For *debugging purpose only*, we provide an example dataset that can be downloaded [here](https://www.dropbox.com/s/9ppm0s4veow0yst/data_f25.tar?dl=0). Extract the example dataset to ``example_dataset/``. The pair list for training is provided at ``example_dataset/overlap-30-50p-subset.txt``. This will help you walk through the training process though it can only offer dummy results.\n\nOur codebase enables multi-gpu training with distributed data parallel (DDP) module in pytorch. \nTo train PointContrast with 8 GPUs (batch_size=32, 4 per GPU) on a single server:\n```\ncd pretrain/pointcontrast\n./scripts/ddp_local.sh\n```\nYou should edit OUT_DIR and data.dataset_root_dir in the ddp_local.sh file, accoding to your local paths, before running the experiments.\nOur codebase also supports training on cluster with SLURM, see ``scripts/ddp_launch.sh`` for reference.\n\n\n## Finetuning: Segmentation and Detection\nWe also provide code for the segmentation and detection experiments conducted in our paper. The finetuning code for semantic segmentation is mostly a direct fork of [SpatioTemporalSegmentation](https://github.com/chrischoy/SpatioTemporalSegmentation) with modifications to support **multi-gpu training**.\n\nFor example, for Stanford 3D semantic segmentation task:\n- Download the stanford 3d dataset from the [website](http://buildingparser.stanford.edu/dataset.html).\n- Preprocess: Modify the input and output directory accordingly in ``lib/datasets/preprocessing/stanford.py`` and run ``python -m lib.datasets.preprocessing.stanford``\n- Train: \n    ```\n    # Edit relevant path variables and then run:\n    ./scripts/train_stanford3d.sh \n    ```\n## Pretrained PointContrast Model:\n- Pretrained with Hardest Contrastive Loss [[290M]](https://www.dropbox.com/s/la9ih2w2oavpp2z/hardest_contrastive.pth?dl=0)\n- Pretrained with PointInfoNCE Loss [[290M]](https://www.dropbox.com/s/uzr88m1lab0abbl/nce.pth?dl=0)\n\n\n## Citing PointContrast\n```\n@inproceedings{PointContrast2020,\n    author = {Saining Xie, Jiatao Gu, Demi Guo, Charles R. Qi, Leonidas Guibas, Or Litany},\n    title = {PointContrast: Unsupervised Pre-training for 3D Point Cloud Understanding},\n    booktitle = {ECCV},\n    year = {2020},\n}\n```\n\n## License\nPointContrast is relased under the MIT License. See the LICENSE file for more details.\n\n## Acknowledgements\nThis codebase was built on top of [FCGF]() and [MinkowskiEngine](), we thank Chris Choy for helping us setting up the codebase. \nWe thank [Ji Hou]() at TUM for helping with the Hydra setup and code migration to ME 0.4. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2FPointContrast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookresearch%2FPointContrast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2FPointContrast/lists"}