GithubHelp home page GithubHelp logo

facebookresearch / nerf-det Goto Github PK

View Code? Open in Web Editor NEW
269.0 26.0 19.0 5.23 MB

[ICCV 2023] Code for NeRF-Det: Learning Geometry-Aware Volumetric Representation for Multi-View 3D Object Detection

Home Page: https://chenfengxu714.github.io/nerfdet/

License: Other

Python 63.45% Shell 0.04% Dockerfile 0.02% C++ 24.36% Cuda 11.96% Objective-C++ 0.11% C 0.06%

nerf-det's Introduction

NeRF-Det: Learning Geometry-Aware Volumetric Representation for Multi-View 3D Object Detection [ICCV 2023]

Chenfeng Xu, Bichen Wu, Ji Hou, Sam Tsai, Ruilong Li, Jialiang Wang, Wei Zhan, Zijian He, Peter Vajda, Kurt Keutzer, Masayoshi Tomizuka

[paper], [project page]

NeRF-Det is a novel method for 3D detection with posed RGB images as input. Our method makes novel use of NeRF in an end-to-end manner to explicitly estimate 3D geometry, thereby improving 3D detection performance. Specifically, to avoid the significant extra latency associated with per-scene optimization of NeRF, we introduce sufficient geometry priors to enhance the generalizability of NeRF-MLP. We subtly connect the detection and NeRF branches through a shared MLP, enabling an efficient adaptation of NeRF to detection and yielding geometry-aware volumetric representations for 3D detection. As a result of our joint-training design, NeRF-Det is able to generalize well to unseen scenes for object detection, view synthesis, and depth estimation tasks without per-scene optimization.

Inspired by our previous work SOLOFusion, we further advance our method with using long-frame-low-res images, which is more efficient and effective. We provide the checkpoints and configs with better performance below.

Method mAP@25 mAP@50 Checkpoint Config
NeRF-Det-R50 53.1 27.8 link config
NeRF-Det-R50* 52.4 29.2 link config
NeRF-Det-R101* 52.6 29.8 link config

If you find this work helpful, please cite:

Citation:

@inproceedings{
  xu2023nerfdet,
  title={NeRF-Det: Learning Geometry-Aware Volumetric Representation for Multi-View 3D Object Detection},
  author={Xu, Chenfeng and Wu, Bichen and Hou, Ji and Tsai, Sam and Li, Ruilong and Wang, Jialiang and Zhan, Wei and He, Zijian and Vajda, Peter and Keutzer, Kurt and Tomizuka, Masayoshi},
  booktitle={ICCV},
  year={2023},
}

@inproceedings{
park2023time,
title={Time Will Tell: New Outlooks and A Baseline for Temporal Multi-View 3D Object Detection},
author={Jinhyung Park and Chenfeng Xu and Shijia Yang and Kurt Keutzer and Kris M. Kitani and Masayoshi Tomizuka and Wei Zhan},
booktitle={The Eleventh International Conference on Learning Representations },
year={2023},
url={https://openreview.net/forum?id=H3HcEJA2Um}
}

Installation

For convenience, we provide a Dockerfile. Alternatively, you can install all required packages manually.

This implementation is based on mmdetection3d framework and ImVoxelNet. Please refer to the original installation guide install.md, replacing open-mmlab/mmdetection3d with saic-vul/imvoxelnet. Also, rotated_iou should be installed with these 4 commands.

Most of the NeRF-Det-related code locates in the following files: detectors/nerfdet.py, model_utils/render_ray.py, model_utils/projection.py, pipelines/multi_view.py, pipelines/formating.py.

Dataset

We provide the code of ScanNet experiments. Please follow instructions in scannet to prepare the dataset.

Getting Started

Please see getting_started.md for basic usage examples.

Testing

Test pre-trained model using dist_test with nerfdet configs:

bash tools/dist_test.sh configs/nerfdet/nerfdet_res50_2x_low_res.py \
    work_dirs/nerfdet_res50_2x_low_res/res50_2x_low_res.pth 4 --eval mAP

Visualization

If you want to render novel view, you can modify let "render_testing = True" in config. You can then get results like below.

if you want to have the bounding box visualization, you can run

python tools/test.py configs/nerfdet/nerfdet_res50_2x_low_res.py \
    work_dirs/nerfdet_res50_2x_low_res/latest.pth --show \
    --show-dir work_dirs/nerfdet_res50_2x_low_res

For better visualizations, you may set score_thr in configs to 0.15 or more:

Training

You can train your own model by the training script

bash tools/dist_train.sh configs/nerfdet/nerfdet_res50_2x_low_res.py 4

Acknowledgement

https://github.com/SamsungLabs/imvoxelnet

https://ibrnet.github.io

https://github.com/open-mmlab/mmdetection3d

License

The majority of Nerf-Det is licensed under CC-BY-NC, however portions of the project are available under separate license terms: https://github.com/SamsungLabs/imvoxelnet is licensed under the MIT license.

nerf-det's People

Contributors

sekunde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nerf-det's Issues

About the test results of the provided network model, and whether provide the weights of pure NeRF-Det?

I download the network weights you provided and load the test using your code. But the test performance is not consistent with what you reported (I tested it multiple times and the results are basically the same). I didn't change the seed and used the default value of 0. Maybe, during training, the seed is not 0? Or are other variables causing the different results?

| | You report | download and test |
| Method |mAP@25 | mAP@50 | mAP@25 | mAP@50 |
|NeRF-Det-R50 |53.1 | 27.8 | 53.08 | 26.58 |
|NeRF-Det-R50* |52.4 | 29.2 | 50.22 | 25.84 |
|NeRF-Det-R101* |52.6 | 29.8 | 51.29 | 27.42 |

And you only public the network weights that combines your another work SOLOFusion. Will you please public the weights of pure NeRF-Det?

Could you provide the processed pkl of scannet?

Could you please share the processed pkl files: scannet_infos_train.pkl, scannet_infos_val.pkl, scannet_infos_test.pkl? Not only can make it easier to obtain training data, but also aligns your input.

Env setup error(mmdet/mmpycocotools)

Running in wsl2 ubuntu18.04, cuda101, torch 1.6.0, mmcv-full==1.2.7

ERROR shows when trying to "pip install mmdet==2.10.0"(Don't have this mmpycocotools error when using higher version of mmdet, but seems the mmcv-full>=1.1.5, <=1.3 requirement won't satisfy):

Building wheels for collected packages: mmpycocotools
Building wheel for mmpycocotools (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/init.py -> build/lib.linux-x86_64-cpython-37/pycocotools
running build_ext
Compiling pycocotools/_mask.pyx because it changed.
[1/1] Cythonizing pycocotools/_mask.pyx
/home/zc/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-49xe8099/mmpycocotools_05b8a288530045d6a66fcac080670e25/pycocotools/_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
creating build/common
creating build/temp.linux-x86_64-cpython-37
creating build/temp.linux-x86_64-cpython-37/common
creating build/temp.linux-x86_64-cpython-37/pycocotools
gcc -pthread -B /home/zc/miniconda3/envs/open-mmlab/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/zc/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/numpy/core/include -Icommon -I/home/zc/miniconda3/envs/open-mmlab/include/python3.7m -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-37/../common/maskApi.o
gcc: error: ../common/maskApi.c: No such file or directory
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mmpycocotools
Running setup.py clean for mmpycocotools
Failed to build mmpycocotools
Installing collected packages: mmpycocotools, mmdet
Running setup.py install for mmpycocotools ... error
error: subprocess-exited-with-error

× Running setup.py install for mmpycocotools did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running install
/home/zc/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-37/pycocotools
copying pycocotools/init.py -> build/lib.linux-x86_64-cpython-37/pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-cpython-37
creating build/temp.linux-x86_64-cpython-37/common
creating build/temp.linux-x86_64-cpython-37/pycocotools
gcc -pthread -B /home/zc/miniconda3/envs/open-mmlab/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/zc/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/numpy/core/include -Icommon -I/home/zc/miniconda3/envs/open-mmlab/include/python3.7m -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-37/../common/maskApi.o
gcc: error: ../common/maskApi.c: No such file or directory
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mmpycocotools

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Training time cost

I was wondering the time cost for training, with specific configurations. Is the nerf-branch time-consuming?

About the dataset ARKitScenes

There is only the class of the monocular scannet dataset in the code base. Will the ARKitScenes class be made public? Or which code is referenced? Looking forward for your reply.

Dockerfile for modern GPUS

Describe the feature
Would be great to be able to run this on modern hardware. Current dockerfile targets 6.0, 6.1, 7.0 which is pre 20 series/ Turing(released 2018). To work with modern systems it would make sense to be compatible from 7.0 to 9.0/9.5.

Motivation
Current hardware target may not be available to purchase due to age and modern hardware is faster.

Related resources
Will have to update base pytorch container to have a CUDA version compatible with modern hardware as well.

Additional context
May find issues compiling on current versions of pytorch/cuda due to age of some of the libraries used.

Depth makes performance worse

The performance I implemented of nerfdet_res50_2x_low_res is 52.4, but nerfdet_res50_2x_low_res_depth_sp is 49.58. In the paper, the performance of nerfdet_res50_2x_low_res is 52.0, but nerfdet_res50_2x_low_res_depth_sp is 51.8. It seems the depth does not work and even disrupts the performance.

NCLL error and GPG error

I got NCLL error both in one gpu and multi gpus. For one gpu, it occurs in model.cuda(); for multi gpus, it occurs in self.backbone.init_weights(pretrained=pretrained).

The log is as follows:

2023-08-22 19:18:20,402 - mmdet - INFO - Environment info:
------------------------------------------------------------
sys.platform: linux
Python: 3.7.16 (default, Jan 17 2023, 22:20:44) [GCC 11.2.0]
CUDA available: True
GPU 0,1,2,3,4,5,6,7: NVIDIA A100-SXM4-80GB
CUDA_HOME: /mnt/lustre/share/cuda-10.1/
NVCC: Cuda compilation tools, release 10.1, V10.1.168
GCC: gcc (GCC) 5.4.0
PyTorch: 1.6.0
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.5.0 (Git Hash e2ac1fac44c5078ca927cb9b90e1b3066a0b2ed0)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.1
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=com$
ute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  - CuDNN 7.6.3
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK $
DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign$
compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarat$
ons -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitial$
zed -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLO$
=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 

TorchVision: 0.7.0
OpenCV: 4.8.0
MMCV: 1.2.7
MMCV Compiler: GCC 7.3
MMCV CUDA Compiler: 10.1
MMDetection: 2.10.0
MMDetection3D: 0.8.0+8684e1f
------------------------------------------------------------

2023-08-22 19:18:20,402 - mmdet - INFO - Distributed training: True
2023-08-22 19:18:21,312 - mmdet - INFO - Config: (...)

2023-08-22 19:18:21,312 - mmdet - INFO - Set random seed to 0, deterministic: False
2023-08-22 19:18:21,913 - mmdet - INFO - load model from: torchvision://resnet50
2023-08-22 19:18:21,913 - mmdet - INFO - Use load_from_torchvision loader

Depth makes the performance much worse

image
I ran the config with the depth simply use bash tools/dist_train.sh configs/nerfdet/nerfdet_res50_2x_low_res_depth_sp.py 4 , but I found its performance is much worse than without depth.
Do you have idea what caused this? Or maybe need some other steps?
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.