Project repo for Learning Category-Specific Mesh Reconstruction from Image Collections

Related tags

Deep Learning cmr
Overview

Learning Category-Specific Mesh Reconstruction from Image Collections

Angjoo Kanazawa*, Shubham Tulsiani*, Alexei A. Efros, Jitendra Malik

University of California, Berkeley In ECCV, 2018

This code is no longer actively maintained. For pytorch 1.x, python3, and pytorch NMR support, please see this implementation from chenyuntc.

Project Page Teaser Image

Requirements

  • Python 2.7
  • PyTorch tested on version 0.3.0.post4

Installation

Setup virtualenv

virtualenv venv_cmr
source venv_cmr/bin/activate
pip install -U pip
deactivate
source venv_cmr/bin/activate
pip install -r requirements.txt

Install Neural Mesh Renderer and Perceptual loss

cd external;
bash install_external.sh

Demo

  1. From the cmr directory, download the trained model:
wget https://people.eecs.berkeley.edu/~kanazawa/cachedir/cmr/model.tar.gz & tar -vzxf model.tar.gz

You should see cmr/cachedir/snapshots/bird_net/

  1. Run the demo:
python -m cmr.demo --name bird_net --num_train_epoch 500 --img_path cmr/demo_data/img1.jpg
python -m cmr.demo --name bird_net --num_train_epoch 500 --img_path cmr/demo_data/birdie.jpg

Training

Please see doc/train.md

Citation

If you use this code for your research, please consider citing:

@inProceedings{cmrKanazawa18,
  title={Learning Category-Specific Mesh Reconstruction
  from Image Collections},
  author = {Angjoo Kanazawa and
  Shubham Tulsiani
  and Alexei A. Efros
  and Jitendra Malik},
  booktitle={ECCV},
  year={2018}
}

Comments
  • cupy.cuda.compiler.CompileException: nvrtc: error: failed to load builtins

    cupy.cuda.compiler.CompileException: nvrtc: error: failed to load builtins

    When you run the demo: python -m cmr.demo --name bird_net --num_train_epoch 500 --img_path cmr/demo_data/img1.jpg

    I am getting this error:

    /home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Setting up model.. loading /home/ubuntu/akshay/cmr/nnutils/../cachedir/snapshots/bird_net/pred_net_500.pth.. Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/ubuntu/akshay/cmr/demo.py", line 119, in app.run(main) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/home/ubuntu/akshay/cmr/demo.py", line 108, in main outputs = predictor.predict(batch) File "cmr/nnutils/predictor.py", line 110, in predict self.forward() File "cmr/nnutils/predictor.py", line 149, in forward self.cam_pred) File "cmr/nnutils/nmr.py", line 183, in forward return Render(self.renderer)(verts, faces) File "cmr/nnutils/nmr.py", line 114, in forward masks = self.renderer.forward_mask(vs, fs) File "cmr/nnutils/nmr.py", line 50, in forward_mask self.masks = self.renderer.render_silhouettes(self.vertices, self.faces) File "build/bdist.linux-x86_64/egg/neural_renderer/renderer.py", line 38, in render_silhouettes File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/chainer/functions/array/concat.py", line 90, in concat y, = Concat(axis).apply(xs) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/chainer/function_node.py", line 245, in apply outputs = self.forward(in_data) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/chainer/functions/array/concat.py", line 44, in forward return xp.concatenate(xs, self.axis), File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/cupy/manipulation/join.py", line 49, in concatenate return core.concatenate_method(tup, axis) File "cupy/core/core.pyx", line 2439, in cupy.core.core.concatenate_method File "cupy/core/core.pyx", line 2482, in cupy.core.core.concatenate_method File "cupy/core/core.pyx", line 2533, in cupy.core.core.concatenate File "cupy/core/core.pyx", line 1630, in cupy.core.core.ndarray.setitem File "cupy/core/core.pyx", line 3101, in cupy.core.core._scatter_op File "cupy/core/elementwise.pxi", line 823, in cupy.core.core.ufunc.call File "cupy/util.pyx", line 39, in cupy.util.memoize.decorator.ret File "cupy/core/elementwise.pxi", line 622, in cupy.core.core._get_ufunc_kernel File "cupy/core/elementwise.pxi", line 33, in cupy.core.core._get_simple_elementwise_kernel File "cupy/core/carray.pxi", line 170, in cupy.core.core.compile_with_cache File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/cupy/cuda/compiler.py", line 123, in compile_with_cache base = _preprocess('', options, arch) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/cupy/cuda/compiler.py", line 86, in _preprocess result = prog.compile(options) File "/home/ubuntu/akshay/cmr/venv_cmr/local/lib/python2.7/site-packages/cupy/cuda/compiler.py", line 233, in compile raise CompileException(log, self.src, self.name, options) cupy.cuda.compiler.CompileException: nvrtc: error: failed to load builtins

    I tried the solution mentioned in this: https://groups.google.com/forum/#!topic/chainer-jp/GKNe5KY_fm0 yet it is not working

    opened by akjagadish 17
  • What version of Cuda is required for installing?

    What version of Cuda is required for installing?

    As in the title. I have cuda version 9.0 and this is causing a lot of problems in installing cupy. I installed it seperately using "pip install cupy-cuda90", removed it from requirements.txt and then installed everything else. When I try to install the external repos, i.e, Perceptual Loss and Neural Renderer, I got this Traceback: Traceback (most recent call last): File "setup.py", line 3, in import neural_renderer File "/home/nsajjan/WORK/Capstone/cmr/external/neural_renderer/neural_renderer/init.py", line 1, in from cross import cross File "/home/nsajjan/WORK/Capstone/cmr/external/neural_renderer/neural_renderer/cross.py", line 2, in import cupy as cp File "/home/nsajjan/WORK/Capstone/cmr/venv_cmr/lib/python2.7/site-packages/cupy/init.py", line 7, in from cupy import _version ImportError: cannot import name _version

    Any suggestions?

    opened by BornInWater 9
  • Experiment on PASCAL3D+ dataset

    Experiment on PASCAL3D+ dataset

    Hi, I'm a beginner in 3d reconstruction. It's a really impressive work! I'm now trying to implement it on PASCAL3D+ dataset, facing some problems on camera pose. I find PASCAL3D+ dataset offer cam_pose in azi/ele system for each picture and the perspective projection codes. I just wonder how did you process the dataset to match cmr?

    1. Simply run SfM again, ignoring the ground-truth cam_pose provided by PASCAL3D+?
    2. Calculate the scale/trans/rotation for PASCAL correspond to CUB dataset? But I don't know if it's ok because PASCAL is under perspective projection and CUB is under weak-perspective projection.
    3. Rewrite python codes to project PASCAL using perspective camera? If I want to do this, I guess the main problem would be how to adjust neural renderer to match the projection.

    I'd really appreciate it if you could offer any ideas/materials/codes in this. Thanks a lot!

    opened by yd-yin 9
  • Snapshot generated after training not generating same results as provided snapshot

    Snapshot generated after training not generating same results as provided snapshot

    Hi, When I tested the model using the snapshot provided, I got the below result saved_image

    But when I trained the model while following the instructions provided, similar snapshot is not able to generate similar output saved_image2_500

    I checked with snapshots later in the training as well, similar output as above.

    The only thing I have changed is that I ported the code to Torch 1.0 and had to make one small change: replace things like self.total_loss.data[0] with self.total_loss.item(). I am sure this is not the reason but just mentioned it for the sake of completion.

    Could you suggest what might I be doing wrong ?

    EDIT: The losses are way higher as compared to the loss_log I got when I downloaded the snapshot. losses

    opened by BornInWater 7
  • textured human reconstruction

    textured human reconstruction

    Professor Angjoo Kanazawa: I want to try to reconstruct the textured human body shape from a single image with your represent model.So,I want to ask you about whether it's feasible or not?Would you give me some suggestions about these?Thanks! @akanazawa @shubhtuls

    opened by QHan1st 5
  • Update to PyTorch1.x and Python3, remove chainer/cupy dependancy.

    Update to PyTorch1.x and Python3, remove chainer/cupy dependancy.

    Nice work! I've been working on a similar task, your code is clean and intuitive, a good start for the project.

    But I struggle to set up the env. So I make some updates:

    • upgrade support to Python3 Python 2 support ends today.

    • upgrade to PyTorch 1.3 PyTorch 0.3 was like two years ago.

    • Remove chainer/cupy dependancy. Setting up cupy is too complicated and now there is pytorch version neural renderer

    The repo is in chenyuntc/cmr. I can make a pull request if you would like.

    opened by chenyuntc 4
  • 404 error while downloading cachedir.tar.gz

    404 error while downloading cachedir.tar.gz

    When I tried to download CUB annotation file by running: wget https://people.eecs.berkeley.edu/~shubhtuls/cachedir/cmr/cachedir.tar.gz I got 404 error. Is this file currently available for downloading?

    opened by XiangMochu 4
  • Failed to load builtins

    Failed to load builtins

    Hi, thanks for sharing the code! I encountered the following error, and I am wondering how to solve this?

    venv_cmr/local/lib/python2.7/site-packages/cupy/cuda/compiler.py", line 233, in compile
        raise CompileException(log, self.src, self.name, options)
    cupy.cuda.compiler.CompileException: nvrtc: error: failed to load builtins
    
    opened by moshanATucsd 4
  • Data Incomplete

    Data Incomplete

    Hi, It seems the 'testval_cub_cleaned.mat' and 'train_cub_cleaned.mat' downloaded from https://people.eecs.berkeley.edu/~kanazawa/cachedir/cmr/cachedir.tar.gz are incomplete since they are 45 bytes only.

    Thanks.

    opened by thusiyuan 3
  • Where to download the key point annotation for PCK evaluation.

    Where to download the key point annotation for PCK evaluation.

    Thanks a lot for the great code.

    I want to evaluate my model on CUB, but I notice the key point annotations are in mat format, and there is no such annotation in the CUB official site. So where can I download key point annotations?

    image

    opened by layumi 1
  • Annotation mat file of PASCAL

    Annotation mat file of PASCAL

    I find that the link of annotation mat files is down. I found a temporary link of CUB in issue #7, but PASCAL's annotation is still not found. Would I find it in some other link? Thank you so much!

    opened by furljq 1
  • ERROR: Could not find a version that satisfies the requirement h5py

    ERROR: Could not find a version that satisfies the requirement h5py

    conda create -n cmr python=3
    conda activate cmr
    conda install pytorch torchvision -c pytorch
    pip install -r requirements.txt
    

    But I get many errors for almost all dependencies in requirements.txt starting with

    h5py:

    (cmr) [moldach@cedar5 cmr]$ pip install -r requirements.txt
    Looking in links: /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/nix/avx2, /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/nix/generic, /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic
    Collecting absl-py
      Downloading absl_py-0.12.0-py3-none-any.whl (129 kB)
         |████████████████████████████████| 129 kB 10.4 MB/s 
    Collecting Cython
      Downloading Cython-0.29.22-py2.py3-none-any.whl (980 kB)
         |████████████████████████████████| 980 kB 18.1 MB/s 
    ERROR: Could not find a version that satisfies the requirement h5py
    ERROR: No matching distribution found for h5py
    
    
    opened by moldach 0
  • Did you do the training on Pascal3D+ car and aeroplane together or separately?

    Did you do the training on Pascal3D+ car and aeroplane together or separately?

    Did you train the CMR on Pascal3D+ car and aeroplane together or separately? I noticed in DRC, you mentioned you train category-agnostic CNN, which means you train DRC on aeroplane and car together and you report DRC's 3D IoU on aeroplane and car test data, which are 0.42 and 0.67 separately. However, in this repo, the p3d dataloader only loads 'car'.

    opened by meijie0401 0
  • Where is the code to calcualte 3D IOU on Pascal 3D+ dataset (aero, car)?

    Where is the code to calcualte 3D IOU on Pascal 3D+ dataset (aero, car)?

    Hi, could you please tell me where is the code to calculate 3D IOU on Pascal 3D+ dataset (aero, car)? In my understanding, in order to calculate it, we have to voxelize the mesh first, right?

    opened by meijie0401 0
  • demo.py plot_trisurf

    demo.py plot_trisurf

    Hi Angjoo, I'm still trying to find a way to plot the bird demo as an interactive 3d visualization, similiar to projects like this. Have you maybe discussed to use plot_trisurf function from matplotlib in demo.py to do something similar?

    opened by felixboevr 0
Owner
null
CoSMA: Convolutional Semi-Regular Mesh Autoencoder. From Paper "Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes"

Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes Implementation of CoSMA: Convolutional Semi-Regular Mesh Autoencoder arXiv p

Fraunhofer SCAI 10 Oct 11, 2022
Given a 2D triangle mesh, we could randomly generate cloud points that fill in the triangle mesh

generate_cloud_points Given a 2D triangle mesh, we could randomly generate cloud points that fill in the triangle mesh. Run python disp_mesh.py Or you

Peng Yu 2 Dec 24, 2021
AI Face Mesh: This is a simple face mesh detection program based on Artificial intelligence.

AI Face Mesh: This is a simple face mesh detection program based on Artificial Intelligence which made with Python. It's able to detect 468 different

Md. Rakibul Islam 1 Jan 13, 2022
Code for 'Single Image 3D Shape Retrieval via Cross-Modal Instance and Category Contrastive Learning', ICCV 2021

CMIC-Retrieval Code for Single Image 3D Shape Retrieval via Cross-Modal Instance and Category Contrastive Learning. ICCV 2021. Introduction In this wo

null 42 Nov 17, 2022
Research code for CVPR 2021 paper "End-to-End Human Pose and Mesh Reconstruction with Transformers"

MeshTransformer ✨ This is our research code of End-to-End Human Pose and Mesh Reconstruction with Transformers. MEsh TRansfOrmer is a simple yet effec

Microsoft 473 Dec 31, 2022
Out-of-Domain Human Mesh Reconstruction via Dynamic Bilevel Online Adaptation

DynaBOA Code repositoty for the paper: Out-of-Domain Human Mesh Reconstruction via Dynamic Bilevel Online Adaptation Shanyan Guan, Jingwei Xu, Michell

null 197 Jan 7, 2023
Single-stage Keypoint-based Category-level Object Pose Estimation from an RGB Image

CenterPose Overview This repository is the official implementation of the paper "Single-stage Keypoint-based Category-level Object Pose Estimation fro

NVIDIA Research Projects 188 Dec 27, 2022
ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction

ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction. NeurIPS 2021.

Gengshan Yang 59 Nov 25, 2022
A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.

ManhattanSLAM Authors: Raza Yunus, Yanyan Li and Federico Tombari ManhattanSLAM is a real-time SLAM library for RGB-D cameras that computes the camera

null 117 Dec 28, 2022
"MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction" (CVPRW 2022) & (Winner of NTIRE 2022 Challenge on Spectral Reconstruction from RGB)

MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction (CVPRW 2022) Yuanhao Cai, Jing Lin, Zudi Lin, Haoqian Wang, Yulun Z

Yuanhao Cai 274 Jan 5, 2023
This is the offical website for paper ''Category-consistent deep network learning for accurate vehicle logo recognition''

The Pytorch Implementation of Category-consistent deep network learning for accurate vehicle logo recognition This is the offical website for paper ''

Wanglong Lu 28 Oct 29, 2022
[ICRA 2022] CaTGrasp: Learning Category-Level Task-Relevant Grasping in Clutter from Simulation

This is the official implementation of our paper: Bowen Wen, Wenzhao Lian, Kostas Bekris, and Stefan Schaal. "CaTGrasp: Learning Category-Level Task-R

Bowen Wen 199 Jan 4, 2023
NeRD: Neural Reflectance Decomposition from Image Collections

NeRD: Neural Reflectance Decomposition from Image Collections Project Page | Video | Paper | Dataset Implementation for NeRD. A novel method which dec

Computergraphics (University of Tübingen) 195 Dec 29, 2022
Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set (CVPRW 2019). A PyTorch implementation.

Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set —— PyTorch implementation This is an unofficial offici

Sicheng Xu 833 Dec 28, 2022
Official PyTorch implementation of CAPTRA: CAtegory-level Pose Tracking for Rigid and Articulated Objects from Point Clouds

CAPTRA: CAtegory-level Pose Tracking for Rigid and Articulated Objects from Point Clouds Introduction This is the official PyTorch implementation of o

Yijia Weng 96 Dec 7, 2022
Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders

Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders

null 1 Oct 11, 2021
PyTorch implemention of ICCV'21 paper SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation

SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation This is the PyTorch implemention of ICCV'21 paper SGPA: Structure

Chen Kai 24 Dec 5, 2022
Official public repository of paper "Intention Adaptive Graph Neural Network for Category-Aware Session-Based Recommendation"

Intention Adaptive Graph Neural Network (IAGNN) This is the official repository of paper Intention Adaptive Graph Neural Network for Category-Aware Se

null 9 Nov 22, 2022
EMNLP 2021 Adapting Language Models for Zero-shot Learning by Meta-tuning on Dataset and Prompt Collections

Adapting Language Models for Zero-shot Learning by Meta-tuning on Dataset and Prompt Collections Ruiqi Zhong, Kristy Lee*, Zheng Zhang*, Dan Klein EMN

Ruiqi Zhong 42 Nov 3, 2022