Git Product home page Git Product logo

planercnn's Introduction

License CC BY-NC-SA 4.0 Python 3.7

PlaneRCNN: 3D Plane Detection and Reconstruction from a Single Image

alt text

By Chen Liu, Kihwan Kim, Jinwei Gu, Yasutaka Furukawa, and Jan Kautz

This paper will be presented (Oral) in IEEE CVPR 2019.

Introduction

This paper proposes a deep neural architecture, PlaneR-CNN, that detects arbitrary number of planes, and reconstructs piecewise planar surfaces from a single RGB image. For more details, please refer to our paper and video, or visit project website. The code is implemented using PyTorch.

Project members

License

Copyright (c) 2018 NVIDIA Corp. All Rights Reserved. This work is licensed under the Creative Commons Attribution NonCommercial ShareAlike 4.0 License.

Getting Started

Clone repository:

git clone https://github.com/NVlabs/planercnn.git

Please use Python 3. Create an Anaconda environment and install the dependencies:

conda create --name planercnn
conda activate planercnn
conda install -y pytorch=0.4.1
conda install pip
pip install -r requirements.txt

Equivalently, you can use Python virtual environment to manage the dependencies:

pip install virtualenv
python -m virtualenv planercnn
source planercnn/bin/activate
pip install -r requirements.txt

Now, we compile nms and roialign as explained in the installation section of pytorch-mask-rcnn. To be specific, you can build these two functions using the following commands with the right --arch option:

GPU arch
TitanX sm_52
GTX 960M sm_50
GTX 1070 sm_61
GTX 1080 (Ti), Titan XP sm_61

More details of the compute capability are shown in NVIDIA

cd nms/src/cuda/
nvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../


cd roialign/roi_align/src/cuda/
nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../../

Please note that, the Mask R-CNN backbone does not support cuda10.0 and gcc versions higher than 7. If you have troubles compiling these two libraries, try to downgrade PyTorch to 0.4.0 before compilation and upgrade back to 0.4.1 after compilation. You might also want to find more information on their original repository.

Models

Models are saved under checkpoint/. You can download our trained model from here, and put it under checkpoint/ if you want to fine-tune it or run inferences.

Plane representation

In this project, plane parameters are of absolute scale (in terms of meters). Each plane has three parameters, which equal to plane_normal * plane_offset. Suppose plane_normal is (a, b, c) and plane_offset is d, every point (X, Y, Z) on the plane satisfies, aX + bY + cZ = d. Then plane parameters are (a, b, c)*d. Since plane normal is a unit vector, we can extract plane_normal and plane_offset from their multiplication.

Run the inference code with an example

python evaluate.py --methods=f --suffix=warping_refine --dataset=inference --customDataFolder=example_images

Results are saved under "test/inference/". Besides visualizations, plane parameters (#planes x 3) are saved in "*_plane_parameters_0.npy" and plane masks (#planes x 480 x 640) are saved in "*_plane_masks_0.npy".

Run the inference code with custom data

Please put your images (.png or .jpg files), and camera intrinsics under a folder ($YOUR_IMAGE_FOLDER). The camera parameters should be put under a .txt file with 6 values (fx, fy, cx, cy, image_width, image_height) separately by a space. If the camera intrinsics is the same for all images, please put these parameters in camera.txt. Otherwise, please add a separate intrinsics file for each image, and name it the same with the image (changing the file extension to .txt). And then run:

python evaluate.py --methods=f --suffix=warping_refine --dataset=inference --customDataFolder=$YOUR_IMAGE_FOLDER

Training

Training data preparation

Please first download the ScanNet dataset (v2), unzip it to "$ROOT_FOLDER/scans/", and extract image frames from the .sens file using the official reader.

Then download our plane annotation from here, and merge the "scans/" folder with "$ROOT_FOLDER/scans/". (If you prefer other locations, please change the paths in datasets/scannet_scene.py.)

After the above steps, ground truth plane annotations are stored under "$ROOT_FOLDER/scans/scene*/annotation/". Among the annotations, planes.npy stores the plane parameters which are represented in the global frame. Plane segmentation for each image view is stored under segmentation/.

To generate such training data on your own, please refer to data_prep/parse.py. Please refer to the README under data_prep/ for compilation.

Besides scene-specific annotation under each scene folder, please download global metadata from here, and unzip it to "$ROOT_FOLDER". Metadata includes the normal anchors (anchor_planes_N.npy) and invalid image indices caused by tracking issues (invalid_indices_*.txt).

Training with custom data

To train on custom data, you need a list of planes, where each plane is represented using three parameters (as explained above) and a 2D binary mask. In our implementation, we use one 2D segmentation map where pixels with value i belong to the ith plane in the list. The easiest way is to replace the ScanNetScene class with something interacts with your custom data. Note that, the plane_info, which stores some semantic information and global plane index in the scene, is not used in this project. The code is misleading as global plane indices are read from plane_info here, but they are used only for debugging purposes.

Training script

python train_planercnn.py --restore=2 --suffix=warping_refine

options:

--restore:
- 0: training from scratch (not tested)
- 1 (default): resume training from saved checkpoint
- 2: training from pre-trained mask-rcnn model

--suffix (the below arguments can be concatenated):
- '': training the basic version
- 'warping': with the warping loss
- 'refine': with the refinement network
- 'refine_only': train only the refinement work
- 'warping_refine_after': add the warping loss after the refinement network instead of appending both independently

--anchorType:
- 'normal' (default): regress normal using 7 anchors
- 'normal[k]' (e.g., normal5): regress normal using k anchors, normal0 will regress normal directly without anchors
- 'joint': regress final plane parameters directly instead of predicting normals and depthmap separately

Temporary results are written under test/ for debugging purposes.

Evaluation

To evaluate the performance against existing methods, please run:

python evaluate.py --methods=f --suffix=warping_refine

Options:

--methods:
- f: evaluate PlaneRCNN (use --suffix and --anchorType to specify configuration as explained above)
- p: evaluate PlaneNet
- e: evaluate PlaneRecover
- t: evaluate MWS (--suffix=gt for MWS-G)

Statistics are printed in terminal and saved in logs/global.txt for later analysis.

Note that PlaneNet and PlaneRecover are under the MIT license.

To evaluate on the NYU Depth dataset, please first download the labeled dataset from the official website, and the official train/test split from here. Put them under the same folder "$NYU_FOLDER". To evaluate, please run,

python evaluate.py --methods=f --suffix=warping_refine --dataset=nyu --dataFolder="$NYU_FOLDER"

Note that the numbers are off with the provided model. We retrained the model after cleaning up the code, which is different from the model we tested for the publication.

Contact

If you have any questions, please contact the primary author Chen Liu <[email protected]>, or Kihwan Kim <[email protected]>.

Acknowledgement

Our implementation uses the nms/roialign from the Mask R-CNN implementation from pytorch-mask-rcnn, which is licensed under MIT License

planercnn's People

Contributors

art-programmer avatar kihwan23 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

planercnn's Issues

what is plane_info?

Dear authors,
I have tried to run the code, however I can not figure out what is the "plane_info" in your annotations, could you give more details of it? Thanks!
Best,
Johan

RuntimeError: CuDNN error: CUDNN_STATUS_SUCCESS

Hi,
I am getting the following error when I try to run evaluate.py:

(planercnn) tanu.sharma@gnode45:~/planercnn/planercnn$ python evaluate.py --methods=f --suffix=warping_refine --dataset=inference --customDataFolder=example_images the number of images 3 0%| | 0/3 [00:00<?, ?it/s]specified_suffix: warping_refine /home/tanu.sharma/planercnn/planercnn/models/model.py:1473: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_. nn.init.xavier_uniform(m.weight) rm: cannot remove 'test/inference/*_final.png': No such file or directory Traceback (most recent call last): File "evaluate.py", line 664, in <module> evaluate(args) File "evaluate.py", line 575, in evaluate detection_pair = detector.detect(sample) File "evaluate.py", line 96, in detect rpn_class_logits, rpn_pred_bbox, target_class_ids, mrcnn_class_logits, target_deltas, mrcnn_bbox, target_mask, mrcnn_mask, target_parameters, mrcnn_parameters, detections, detection_masks, detection_gt_parameters, detection_gt_masks, rpn_rois, roi_features, roi_indices, depth_np_pred = self.model.predict([images, image_metas, gt_class_ids, gt_boxes, gt_masks, gt_parameters, camera], mode='inference_detection', use_nms=2, use_refinement=True) File "/home/tanu.sharma/planercnn/planercnn/models/model.py", line 1658, in predict [p2_out, p3_out, p4_out, p5_out, p6_out] = self.fpn(molded_images) File "/home/tanu.sharma/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__ result = self.forward(*input, **kwargs) File "/home/tanu.sharma/planercnn/planercnn/models/model.py", line 121, in forward x = self.C1(x) File "/home/tanu.sharma/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__ result = self.forward(*input, **kwargs) File "/home/tanu.sharma/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/home/tanu.sharma/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__ result = self.forward(*input, **kwargs) File "/home/tanu.sharma/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 301, in forward self.padding, self.dilation, self.groups) RuntimeError: CuDNN error: CUDNN_STATUS_SUCCESS

My anaconda environment is :
_libgcc_mutex 0.1 main
blas 1.0 mkl
ca-certificates 2020.1.1 0
certifi 2020.4.5.1 py37_0
cffi 1.11.5 pypi_0 pypi
cloudpickle 1.4.0 pypi_0 pypi
cudatoolkit 9.0 h13b8566_0
cudnn 7.6.5 cuda9.0_0
cycler 0.10.0 pypi_0 pypi
dask 2.15.0 pypi_0 pypi
decorator 4.4.2 pypi_0 pypi
intel-openmp 2019.4 243
kiwisolver 1.2.0 pypi_0 pypi
ld_impl_linux-64 2.33.1 h53a641e_7
libedit 3.1.20181209 hc058e9b_0
libffi 3.2.1 hd88cf55_4
libgcc-ng 9.1.0 hdf63c60_0
libgfortran-ng 7.3.0 hdf63c60_0
libstdcxx-ng 9.1.0 hdf63c60_0
matplotlib 3.2.1 pypi_0 pypi
mkl 2018.0.3 1
mkl_fft 1.0.6 py37h7dd41cf_0
mkl_random 1.0.1 py37h4414c95_1
nccl 1.3.5 cuda9.0_0
ncurses 6.2 he6710b0_0
networkx 2.4 pypi_0 pypi
ninja 1.9.0 py37hfd86e86_0
numpy 1.15.4 py37h1d66e8a_0
numpy-base 1.15.4 py37h81de0dd_0
opencv-python 3.4.4.19 pypi_0 pypi
openssl 1.1.1g h7b6447c_0
pillow 7.1.2 pypi_0 pypi
pip 20.0.2 py37_1
pycparser 2.20 py_0
pyparsing 2.4.7 pypi_0 pypi
python 3.7.7 hcf32534_0_cpython
python-dateutil 2.8.1 pypi_0 pypi
pytorch 0.4.1 py37ha74772b_0
pywavelets 1.1.1 pypi_0 pypi
readline 8.0 h7b6447c_0
scikit-image 0.14.1 pypi_0 pypi
scipy 1.4.1 pypi_0 pypi
setuptools 46.1.3 py37_0
six 1.14.0 pypi_0 pypi
sqlite 3.31.1 h62c20be_1
tbb 2020.0 hfd86e86_0
tbb4py 2020.0 py37hfd86e86_0
tk 8.6.8 hbc83047_0
toolz 0.10.0 pypi_0 pypi
tqdm 4.28.1 pypi_0 pypi
wheel 0.34.2 py37_0
xz 5.2.5 h7b6447c_0
zlib 1.2.11 h7b6447c_3

Why is this error coming? I tried searching and found https://discuss.pytorch.org/t/runtimeerror-cudnn-error-cudnn-status-success/28045. But it is not helping.

Please tell how to resolve this.

About scannetv1_' + split + '.txt' used in plane_dataset.py

Hi,
I just found there is a line of code with open(self.dataFolder + '/ScanNet/Tasks/Benchmark/scannetv1_' + split + '.txt') as f: in plane_dataset.py. May I ask which file should I use as I did not find the replaced one in ScanNet v2.
Thank you very much.

Any pre-processed data for training and test

Hi,
Thanks for sharing the code of your great work.

I am trying to run the training code, but I found the whole ScanNet dataset is rather than large. May I ask if it is necessary to download all the .sens from the dataset? Is it possible to get access to your per-processed data, or to train the network with part of this dataset?

BTW, a small contribution, if any one uses Cuda 9 + RTX 2080 GPU, the arch should be sm_70 for the nvcc compilement. A link for other gpu types: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/

"depth error" reported during training

Hi, I tried to train your model on the original ScanNet dataset exactly following your README. After I run the training script, the model keeps reporting "depth error" like this:

Loading pretrained weights  pretrained/mask_rcnn_coco.pth
load only base model
change input dimension
  0%|                                                 | 0/11089 [00:00<?, ?it/s]depth error 0.12580698092985002
depth error 0.1841762562045926
depth error 0.3610920941656429
depth error 0.1193058371613103
depth error 0.43547781588766954
depth error 0.48233027258940736
depth error 0.15061639615460393
depth error 0.11701696147735942

Is this to be expected?

Need help finding the focal length, please!

Hi all,
I have been trying to find the focal length values that accompany each photo in a .txt file (it's the (fx, fy, cx, cy, image_width, image_height) values). It's easy enough to get the image's width and height and, and get the principal points values from that, but I cannot figure out an easy way to get the focal length values! I looked at the images and .txt file in /example_images and cannot deduce how the developers arrived that their focal length for those photos. If anyone has figured this out, please let me know how!

Adding compiling environment specs

Hi,

I tried to compile the mask-rcnn kernels and it seems it does not work with cuda10.0 and gcc versions higher than 6. Switching to gcc 5.3 and cuda9.0 works.

Would it be possible to add this in the README.MD? Thanks!

Problem about parse.py

I try to run parse.py to get the training data. However, it seems that the parse.py scripts cannot run sucessfully! I try to modify it and run. But now it always show following errors:

Traceback (most recent call last):
File "/home/viets/worksapce/planercnn/data_prep/parse.py", line 791, in
readMesh(scene_id)
File "/home/viets/worksapce/planercnn/data_prep/parse.py", line 750, in readMesh
colors = colorMap[planeSegmentation]
IndexError: index 15688 is out of bounds for axis 0 with size 207

It seems that the variable planeSegmentation's length is too long, the colorMap 's length is 207. But I cannot figure out how to fix this bug! Can anyone help me ! Thanks!!

Predicted plane parameters

Hi,

I find your plane segmentations very impressive. However, I have encountered some problems when trying to use the predicted plane parameters that are exported to "*_plane_parameters_0.npy". I have tried to reconstruct the depth map from these parameters but without any luck yet.

Is there some specific preprocessing step that needs to be applied to the plane parameter values before proceeding to the depth deconstruction step?

More specifically, given predicted plane normal n, depth map, plane segmentation mask and camera intrinsics, I calculate the plane offset parameter d as described in your work. Than for the individual plane, the depth reconstruction Z is given as:

Z = ((- d (K^(-1) u ) [3]) / (n^T ((K^(-1) u ))

where u is the homogeneous pixel representation of image pixel locations, n is the plane normal.

Am I assuming something wrong? Can you provide more information on the process of depth reconstruction from the plane parameters?

About the scale of testing dataset

Hi, thank you for sharing the code. I'd like to ask what's the scale of testing data? Does it keep the scale number as the PlaneNet (which is 1000 in your paper) with new annotations? And how do you select them?

RuntimeError: CUDA error: out of memory

Hello;
I m trying to run planercnn inference with warping and refine checkpoint However I get cuda error: out of memory as bellow:

(planercnn) tarek@tarek:~/planercnn$ python evaluate.py --methods=f --suffix=warping_refine --dataset=inference --customDataFolder=example_images
the number of images 3
0%| | 0/3 [00:00<?, ?it/s]/home/tarek/planercnn/models/model.py:1473: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight)
rm: cannot remove 'test/inference/*_final.png': No such file or directory
/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/functional.py:1890: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")
/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:122: UserWarning: nn.Upsampling is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.Upsampling is deprecated. Use nn.functional.interpolate instead.")
/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/functional.py:1961: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
"See the documentation of nn.Upsample for details.".format(mode))
Exception ignored in: <function _DataLoaderIter.del at 0x7f80d99de6a8>
Traceback (most recent call last):
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 399, in del
self._shutdown_workers()
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 378, in _shutdown_workers
self.worker_result_queue.get()
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/multiprocessing/queues.py", line 354, in get
return _ForkingPickler.loads(res)
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/multiprocessing/reductions.py", line 151, in rebuild_storage_fd
fd = df.detach()
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/multiprocessing/resource_sharer.py", line 58, in detach
return reduction.recv_handle(conn)
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/multiprocessing/reduction.py", line 185, in recv_handle
return recvfds(s, 1)[0]
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/multiprocessing/reduction.py", line 153, in recvfds
msg, ancdata, flags, addr = sock.recvmsg(1, socket.CMSG_SPACE(bytes_size))
ConnectionResetError: [Errno 104] Connection reset by peer
Traceback (most recent call last):
File "evaluate.py", line 660, in
evaluate(args)
File "evaluate.py", line 571, in evaluate
detection_pair = detector.detect(sample)
File "evaluate.py", line 147, in detect
results = self.refine_model(image, image_2, camera, masks_inp, detection_dict['detection'][:, 6:9], plane_depth, depth_np)
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/tarek/planercnn/models/refinement_net.py", line 658, in forward
result = self.refinement_net(image_1, camera, result)
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/tarek/planercnn/models/refinement_net.py", line 482, in forward
masks, depth, plane = self.refinement_block(image_1.repeat((len(masks), 1, 1, 1)), prev_predictions, prev_result['plane'])
File "/home/tarek/anaconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/tarek/planercnn/models/refinement_net.py", line 93, in forward
y_0 = self.pred(torch.cat([y_1, x_0], dim=1))
RuntimeError: CUDA error: out of memory
..........................................................................................................
I m using Cuda 9.0 with gcc 6
python 3.7 and pytorch 0.4.1
.........................................................................................................
Can You please check the checkpoint file for Refine +Warping provided in your Drive

Thanks
Tarek

Texture replacement

Hi. Congratulations for your great achievement with this research!

I was wondering if have any implementation that I could perform to use the plane instance segmentations generated (that represent floors or walls) to calculate the UV coordinates and replace it with a different texture like PlaneNet does with Manhattan world assumption.

Best.

Trying to re-train planercnn with custom data

Hello friend,

Thanks a lot for your project.

I’m trying to do planar segmentation of single RGB image using your deep neural architecture but sometimes I don’t obtein good results. So, I’d like to re-train it, or train again, with some custom data, where I have plane parameters for each frame. However, I need the right segmentations for each plane. I can share with you my custom data in order to improve your final results.

The meaning of arg numTrainingImages

Hi,

I find you set an arg called numTrainingImages, which is "the number of images to train". However, in the real training, I find it only influence the step of saving learned variables instead of the images used for train, which is fixed as 1400647. Is that right?

Where is data_pred/parse.py file?

Hi, thanks for sharing the code, but can I ask where is the parse.py file which used for producing the annotation? I cannot find the dir or the file. Thank you very much.

Cannot download the dataset sucessfully!

It seems that the datasets cannot be downloaded sucessfully through DropBox .It always failed and lost connection when it is downloading. Can you provides a better way to download the datasets ? Thanks!
image

how can i create category classes

Hi,

I want see on output planes categories as floor, table... as i can see on plane_dataset line 114

confidentClasses = {'wall': True,
'floor': True,
'cabinet': True,
'bed': True,
'chair': False,
'sofa': False,
'table': True,
'door': True,
'window': True,
'bookshelf': False,
'picture': True,
'counter': True,
'blinds': False,
'desk': True,
'shelf': False,
'shelves': False,
'curtain': False,
'dresser': True,
'pillow': False,
'mirror': False,
'entrance': True,
'floor mat': True,
'clothes': False,
'ceiling': True,
'book': False,
'books': False,
'refridgerator': True,
'television': True,
'paper': False,
'towel': False,
'shower curtain': False,
'box': True,
'whiteboard': True,
'person': False,
'night stand': True,
'toilet': False,
'sink': False,
'lamp': False,
'bathtub': False,
'bag': False,
'otherprop': False,
'otherstructure': False,
'otherfurniture': False,
'unannotated': False,
'': False
}

Thanks

data_prep/parse.py cannot generate plane annotation as what you provide

I use "python parse.py" , it can generate planes.ply when debug=False, but failed to generate annotation/segmentation/*.png as what you provide.
the image looks black, but when I drag the mouse, it can generate section of png as what you provide. should I drag the mouse when rendering? I don't think I should do so, because it cannot match the pose.txt.

can you give me some tips? or give the complete suggestion to generate the plane annotation.
thanks a lot.
@kihwan23 @art-programmer

config for 4 GB GPU CUDA 9.6 gcc version 7.4.0

Hello, the research work is very helpful in understanding several issues around 3d modelling.
I am running the code from terminal in ubuntu 18.04. I was able to compile everything. But when I use the inference code, I get the cuda out of memory error. The evaluation works well for the first image and then throw this error. I am trying to figure out the config but not able to get it through. Can you help me??

where is the ground plane

Hi,
On running evaluate.py as mentioned, the planes parameters are saved in "*_plane_parameters_0.npy", How to determine the ground plane among them especially that there is none that is close to <0,0,1>?
Here is an example of the parameters the provided image along with the segmentation result:
[[ 0.03484884 0.377017 -1.2947628 ]
[-2.1032202 1.0239687 0.35741368]
[ 0.06259909 3.3849468 0.52770597]
[-0.07473268 0.19163825 -0.80512947]
[ 0.25436458 2.2515974 1.1864245 ]
[ 2.1670783 1.5183581 -0.125739 ]
[-0.08727778 0.46416706 -1.2580003 ]
[ 0.02940341 2.7239625 1.228664 ]]

Thanks
1_image_0
1_segmentation_0_final

A question about the loss

It's mentioned in your paper that your novel loss consider 2 frames in a video sequence and can improve segmentation consistency. So does it mean the loss is designed for traing data from video sequences? Thank you.

Time and size of dataset to train the model detecting planar surface with Mask R-CNN

Hello NVlabs,

I am trying to reproduce your project using custom dataset. However, my goal is slightly simplified as my only need is to detect planar surface from RGB pictures of cubes, cylinder and so on ... , by Mask R-CNN.

Given that you guys mention the effectiveness of the neuron network to detect planar surface. I want to ask about the number of images you used to train the model. As I see, the number of class is 2 (planar and non-planar). How much time it takes to properly distinguish the two?

Thanks in advance and wish you all best healthy these days.

Son

Get some warning while compiling nms

warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
unsigned long long* mask_flat = THCudaLongTensor_data(state, mask);
^
/home/sujunyu/planercnn-master/nms/src/nms_cuda.c:37:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
unsigned long long * mask_cpu_flat = THLongTensor_data(mask_cpu);
^
/home/sujunyu/planercnn-master/nms/src/nms_cuda.c:40:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
unsigned long long* remv_cpu_flat = THLongTensor_data(remv_cpu);
^
/home/sujunyu/planercnn-master/nms/src/nms_cuda.c:23:7: warning: unused variable 'boxes_dim' [-Wunused-variable]
int boxes_dim = THCudaTensor_size(state, boxes, 1);

These lead to the problem " can't find nms.gpu_nms " while running train_planeRCNN. I assume it is due to the unsuccessfully compilation of nms.

I've already used docker with gcc version 5.4, cuda 9.0. Seems like the nms code has a problem?

Are RGB images and annotations really aligned?

Hello, thanks for this excellent work. However, I am quiet confused about the rgb frames from ScanNet v2 and the plane annotations you offered.

For Example, scene0000_01 frame 33th:
Annotations looks like:
33

while the rgb image looks like:
33

It seems the annotation is not aligned with the image. And I can not find any function in all the scripts inside ./dataset folder that solve the align problem. And the item pair from dataset and dataset_loader seems also doesn't align.

Did I misunderstand something?

No module named 'nms._ext.nms._nms

I've already created a conda env following Getting Started. However, I still got this error and don't know how to fix it.

Traceback (most recent call last):
File "/home/sujunyu/planercnn-master/train_planercnn.py", line 17, in
from models.model import *
File "/home/sujunyu/planercnn-master/models/model.py", line 23, in
from nms.nms_wrapper import nms
File "/home/sujunyu/planercnn-master/nms/nms_wrapper.py", line 11, in
from nms.pth_nms import pth_nms
File "/home/sujunyu/planercnn-master/nms/pth_nms.py", line 2, in
from ._ext import nms
File "/home/sujunyu/planercnn-master/nms/_ext/nms/init.py", line 3, in
from ._nms import lib as _lib, ffi as _ffi
ModuleNotFoundError: No module named 'nms._ext.nms._nms'

Update:
After compiling nms and roialign, and using planercnn env's bin/python, still got the error. Looks like although I've used env's python but the programme still fetch me default cuda, which version is 10.1.

File "/home/sujunyu/planercnn-master/nms/_ext/nms/init.py", line 3, in
from ._nms import lib as _lib, ffi as _ffi
ImportError: /home/sujunyu/planercnn-master/nms/_ext/nms/_nms.so: undefined symbol: __cudaRegisterFatBinaryEnd

Plane class name

Hey, I can see that you output the class index of each plane, but I can't find the actual names of the classes. Could you please refer me to the id-to-name mapping?

Thanks a lot!

ImportError: dynamic module does not define module export function (PyInit__nms)

Description

When I run

python evaluate.py --methods=f --suffix=warping_refine --dataset=inference --customDataFolder=example_images

to use the trained model, the following error was raised:

ImportError: dynamic module does not define module export function (PyInit__nms)

I googled such error and found that the dynamic module refers to those .so files. People with similar experience say that it is because the python versions used for compiling and importing are different. However, they are talking about using the make command, so I couldn't find a proper method to deal with the nvcc command.

Some info:

os version: Ubuntu 14.04 LTS
CUDA version: 8.0.61
gcc version: 4.8.4
python version: 3.6
packages version: the same as requirements.txt

The whole traceback info:

Traceback (most recent call last):
File "evaluate.py", line 20, in
from models.model import *
File "/home/ubuntu3/wzc/projects/planercnn/models/model.py", line 23, in
from nms.nms_wrapper import nms
File "/home/ubuntu3/wzc/projects/planercnn/nms/nms_wrapper.py", line 11, in
from nms.pth_nms import pth_nms
File "/home/ubuntu3/wzc/projects/planercnn/nms/pth_nms.py", line 2, in
from ._ext import nms
File "/home/ubuntu3/wzc/projects/planercnn/nms/_ext/nms/init.py", line 3, in
from ._nms import lib as _lib, ffi as _ffi
ImportError: dynamic module does not define module export function (PyInit__nms)

Trying to re-train planercnn with custom data

Hello guys, thanks a lot for sharing this code.

I'm trying to re-train with some custom data, where we have plane parameters for each frame. This way we changed ScanNetScene Class in order to select the right segmentations for each plane. However, we still need a 'plane_info' file in order to re-train with anchor_type = 'normal'. How could I fix this?

pretrianed model

Can you share your pre-training model elsewhere? There is no way to connect to the dropbox in China.thx!

Environment specs

Hi @ztzhang , I didn't understand what you wrote here: #3. You were using GCC version 6 but didn't worked because it does not work with version higher than 6 and then you switched to version 9 and worked? What?! Can you inform yours system specs, please?

I'm trying to use this pytorch repo with AWS Sagemaker p2.xlarge instance (rhel fedora 2018.3 with single GPU K80) which by default has CUDA 10.0 and GCC 4.8.5. So I've installed CUDA 9.0 and as GCC is version 4.8.5 by default (that's not higher than 6) but it didn't worked when trying to compile roialign.

The default configs (CUDA 10.0 and GCC 4.8.5) works with Mask R-CNN backbone using TensorFlow.

What I'm missing here @art-programmer ?

Thanks guys.

Error in tadm.py

Traceback (most recent call last):
File "/home/lz/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 931, in del
self.close()
File "/home/lz/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1133, in close
self._decr_instances(self)
File "/home/lz/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 496, in _decr_instances
cls.monitor.exit()
File "/home/lz/anaconda3/lib/python3.6/site-packages/tqdm/_monitor.py", line 52, in exit
self.join()
File "/home/lz/anaconda3/lib/python3.6/threading.py", line 1053, in join
raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

I have this error when I evaluated the NYU dataset. Have you encountered this error? This seems to be a problem with the tqdm package, multithread. My tqdm is 4.28.1.

Checkpoint not matching command provided in readme

Hi @art-programmer

I am trying to run '!python evaluate.py --methods=f --suffix=wraping_refine --dataset=inference --customDataFolder=example_images'

After setting up env, building nms and roi align . its giving me below error i think the checkpoint is not matching the model. Could you give correct command or checkpoint

eval_rcnn

Evaluating other methods

Hello,

The readme suggests we can use other methods like so,

--methods:
- f: evaluate PlaneRCNN (use --suffix and --anchorType to specify configuration as explained above)
- p: evaluate PlaneNet
- e: evaluate PlaneRecover
- t: evaluate MWS (--suffix=gt for MWS-G)

However, upon inspection the plane recover is being imported from

from planerecover_ori.inference import PlaneRecoverDetector

The original repo doesn't seem to contain this, could this be added to this repo here?

can't train planrcnn with multiple gpu when I modify the batchsize>1 in dataloader?

can't train planrcnn with multiple gpu when I modify the batchsize>1 in dataloader?
hello, I have 4 titanxp, and I want to train planercnn, in train_planercnn.py
dataloader = DataLoader(dataset, batch_size=1, shuffle=True, num_workers=16) and it only use one gpu. when I modify the batch_size>1(such as 4), it failed to train. the error is as followed.

return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0,
I found the similar issue: https://discuss.pytorch.org/t/problem-with-custom-dataset-invalid-argument-0-sizes-of-tensors-must-match-except-in-dimension-0/34792 , but can't solve it.

can you give me some tips? or how you train planercnn with multiple gpu and more batchsize? @tmbdev @vinodgro @mjgarland @dumerrill @sdalton1

How to get the point cloud of detected planes?

Hi,

The code output masks and plane parameters when evaluate NYU dataset. If I want to get point cloud data (xyz+rgb) from a plane such as the ground, do I need to calculate the point cloud based on the predicted plane parameters and depth map? Is there such a function or similar function in the code you provide?

Thank you!

Question about planes.npy and plane_info.npy

Hi,

I'm trying to run the PlaneRCNN code and get the surface normal of each plane (not the anchor normal, but the regular normal), but kind of confused about what is planes.npy and plane_info.npy. Can anyone explains what is those two files and how can I extract regular surface normal from those two files?

P.S. in the README.md, it says planes.npy is a "global normal". How does this global normal map to each image/annotation?

Problem compiling NMS

Hi @art-programmer

Thanks for awesome paper and code. I have tried repeatedly and cannot compile the nms module on Google Colab. I am using CUDA 9 & gcc 6. When I run python build.py inside nms directory it gives following output


Including CUDA code.
/content/planercnn/nms
generating /tmp/tmp9okwc0i9/_nms.c
setting the current directory to '/tmp/tmp9okwc0i9'
running build_ext
building '_nms' extension
creating content
creating content/planercnn
creating content/planercnn/nms
creating content/planercnn/nms/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c _nms.c -o ./_nms.o -std=c99
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/planercnn/nms/src/nms.c -o ./content/planercnn/nms/src/nms.o -std=c99
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/planercnn/nms/src/nms_cuda.c -o ./content/planercnn/nms/src/nms_cuda.o -std=c99
/content/planercnn/nms/src/nms_cuda.c: In functiongpu_nms’:
/content/planercnn/nms/src/nms_cuda.c:29:35: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   unsigned long long* mask_flat = THCudaLongTensor_data(state, mask);
                                   ^~~~~~~~~~~~~~~~~~~~~
/content/planercnn/nms/src/nms_cuda.c:37:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   unsigned long long * mask_cpu_flat = THLongTensor_data(mask_cpu);
                                        ^~~~~~~~~~~~~~~~~
/content/planercnn/nms/src/nms_cuda.c:40:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   unsigned long long* remv_cpu_flat = THLongTensor_data(remv_cpu);
                                       ^~~~~~~~~~~~~~~~~
/content/planercnn/nms/src/nms_cuda.c:23:7: warning: unused variableboxes_dim’ [-Wunused-variable]
   int boxes_dim = THCudaTensor_size(state, boxes, 1);
       ^~~~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 ./_nms.o ./content/planercnn/nms/src/nms.o ./content/planercnn/nms/src/nms_cuda.o /content/planercnn/nms/src/cuda/nms_kernel.cu.o -o ./_nms.so

Re-training with 2D segment mask + list of planes

Hello,

In your Github you describe that in your implementation you used a list of planes + 2D segmentations but, how can I re-train the network using only these annotations from custom data? (maybe along with camera parameters).

Thanks for help,
Dylan Lopes.

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.