Git Product home page Git Product logo

mesh3d_meshr-cnn's Introduction

MeshRCNN

Paper: https://arxiv.org/pdf/1906.02739.pdf

Code: https://github.com/facebookresearch/meshrcnn

input a single image, output

  • category label (from Mask R-CNN)
  • bounding box (from Mask R-CNN)
  • instance segmentation mask (from Mask R-CNN)
  • 3D triangle mesh in camera coordinate

ShapeNet Dataset

  • 3D shapes rendering from a subset of ShapeNetCore.v1
  • up to 24 random viewpoints
  • RGB size is 137x137
    • train set 35,011 models (840,189)
    • test set 8,757 models (210,051)
    • validation 5% of training

ShapeNet Evaluation is the following

Pix3D Dataset

IKEA 395 furniture models (10,069 images), S1 and S2 are 2 types of split

Implementation Details

Install PyTorch3D, Detectron2, and MeshRCNN

# docker environment: harbor.pxing.com/x-lab/meshrcnn_cuda111_cudnn8:v0

# For NVIDIA GeForce RTX 3090 
# environment docker_1.9.1-cuda11.1-cudnn8-devel
# install Anaconda, then

apt-get update
apt-get install ffmpeg libsm6 libxext6 

nvcc --version
# Cuda compilation tools, release 11.1, V11.1.105

conda create -n pytorch3d python=3.9
conda activate pytorch3d

# CUDA 11.1
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub

# Demos and examplesconda install jupyter
conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple/

# Tests/Linting
pip install black 'isort<5' flake8 flake8-bugbear flake8-comprehensions -i https://pypi.tuna.tsinghua.edu.cn/simple/

# prebuilt binaries for PyTorch3D from Anaconda Cloud
conda install pytorch3d -c pytorch3d

# install pytorch3d
git clone https://github.com/facebookresearch/pytorch3d.git
cd pytorch3d
pip install -e .

cd tests
python3 -m unittest discover -p *.py


python3 -m unittest discover -p test_meshes.py 
'''
.........../workspace/pytorch3d/pytorch3d/structures/meshes.py:496: UserWarning: This overload of nonzero is deprecated:
        nonzero()
Consider using one of the following signatures instead:
        nonzero(*, bool as_tuple) (Triggered internally at  /opt/conda/conda-bld/pytorch_1607370172916/work/torch/csrc/utils/python_arg_parser.cpp:882.)
  index = index.nonzero()
...........
----------------------------------------------------------------------
Ran 22 tests in 1.275s

OK
'''

python3 -m unittest discover -p test_pointclouds.py
'''
........../workspace/pytorch3d/pytorch3d/structures/pointclouds.py:398: UserWarning: This overload of nonzero is deprecated:
        nonzero()
Consider using one of the following signatures instead:
        nonzero(*, bool as_tuple) (Triggered internally at  /opt/conda/conda-bld/pytorch_1607370172916/work/torch/csrc/utils/python_arg_parser.cpp:882.)
  index = index.nonzero()
.............EE.
======================================================================
ERROR: test_to_list (test_pointclouds.TestPointclouds)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/pytorch3d/tests/test_pointclouds.py", line 708, in test_to_list
    new_cloud = cloud.to(device)
  File "/workspace/pytorch3d/pytorch3d/structures/pointclouds.py", line 793, in to
    other._points_list = [v.to(device_) for v in other.points_list()]
  File "/workspace/pytorch3d/pytorch3d/structures/pointclouds.py", line 793, in <listcomp>
    other._points_list = [v.to(device_) for v in other.points_list()]
RuntimeError: CUDA error: invalid device ordinal

======================================================================
ERROR: test_to_tensor (test_pointclouds.TestPointclouds)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/pytorch3d/tests/test_pointclouds.py", line 745, in test_to_tensor
    new_cloud = cloud.to(device)
  File "/workspace/pytorch3d/pytorch3d/structures/pointclouds.py", line 793, in to
    other._points_list = [v.to(device_) for v in other.points_list()]
  File "/workspace/pytorch3d/pytorch3d/structures/pointclouds.py", line 793, in <listcomp>
    other._points_list = [v.to(device_) for v in other.points_list()]
RuntimeError: CUDA error: invalid device ordinal

----------------------------------------------------------------------
Ran 26 tests in 1.992s

FAILED (errors=2)
'''

# Install Detectron2
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2

# Install MeshRCNN
git clone https://github.com/facebookresearch/meshrcnn.git
cd meshrcnn && pip install -e .

Docker files saved directory

root
  |----- pytorch3d
  |----- detectron2
  |----- meshrcnn  

Run MeshRCNN

# Download pre-trained weights
# https://github.com/facebookresearch/meshrcnn/blob/main/INSTRUCTIONS_PIX3D.md
# https://github.com/facebookresearch/meshrcnn/blob/main/INSTRUCTIONS_SHAPENET.md
# Run MeshRCNN Demo
bash run_demo.sh 
'''
python demo/demo.py \
--config-file configs/pix3d/meshrcnn_R50_FPN.yaml \
--input 000000001993.jpg \
--output output_demo \
--onlyhighest MODEL.WEIGHTS meshrcnn_S2_R50.pth
'''

mesh3d_meshr-cnn's People

Contributors

knightlian avatar

Watchers

 avatar  avatar

Forkers

linecomparison

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.