SoftRas

ShichenLiuMIT更新放缓

可微分渲染器 SoftRas 的官方实现,把光栅化过程变得可导,让基于图像的三维重建和几何推理能端到端训练。

Project page of paper "Soft Rasterizer: A Differentiable Renderer for Image-based 3D Reasoning"

暂无版本1,299star159fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
python setup.py install
硬件要求按 README 说明

需要 CUDA 10.1 才能安装该模块;README 未说明具体显存要求,也未说明是否支持纯 CPU 运行

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

可微分渲染器,把渲染建模为可微聚合过程,用于图像驱动的三维推理

可微分渲染器 SoftRas 的官方实现,把光栅化过程变得可导,让基于图像的三维重建和几何推理能端到端训练。

核心能力

  • 将渲染视为对所有三角面片概率贡献的可微聚合
  • 支持直接渲染带颜色的网格并反传梯度到顶点与属性
  • 可用轮廓、明暗和彩色图像作为监督信号
  • 通过调节 sigma 与 gamma 控制渲染的透明度和模糊程度
  • 附带单视图网格重建、形变与位姿拟合示例

容易踩的坑

代码基于 Python3 和 PyTorch 1.6.0,版本不匹配可能装不上;重建示例需先运行 examples/recon/download_dataset.sh 下载 ShapeNet 渲染数据集;预训练模型和重建网格需从 Google Drive 手动下载

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Soft Rasterizer (SoftRas)

    This repository contains the code (in PyTorch) for "Soft Rasterizer: A Differentiable Renderer for Image-based 3D Reasoning" (ICCV'2019 Oral) by Shichen Liu, Tianye Li, Weikai Chen and Hao Li.

    Contents

    1. Introduction
    2. Usage
    3. Applications
    4. Contacts

    Introduction

    Soft Rasterizer (SoftRas) is a truly differentiable renderer framework with a novel formulation that views rendering as a differentiable aggregating process that fuses probabilistic contributions of all mesh triangles with respect to the rendered pixels. Thanks to such "soft" formulation, our framework is able to (1) directly render colorized mesh using differentiable functions and (2) back-propagate efficient supervision signals to mesh vertices and their attributes (color, normal, etc.) from various forms of image representations, including silhouette, shading and color images.

    Usage

    The code is built on Python3 and PyTorch 1.6.0. CUDA (10.1) is needed in order to install the module. Our code is extended on the basis of this repo. 6/3/2021 update note: we add testing models and recontructed color meshes below, and also slightly optimized the code structure! Previous version is archived in the legacy branch.

    To install the module, using

    python setup.py install
    

    Applications

    0. Rendering

    We demonstrate the rendering effects provided by SoftRas. Realistic rendering results (1st and 2nd columns) can be achieved with a proper setting of sigma and gamma. With larger sigma and gamma, one can obtain renderings with stronger transparency and blurriness (3rd and 4th column).

    CUDA_VISIBLE_DEVICES=0 python examples/demo_render.py
    

    1. 3D Unsupervised Single-view Mesh Reconstruction

    By incorporating SoftRas with a simple mesh generator, one can train the network with multi-view images only, without requiring any 3D supervision. At test time, one can reconstruct the 3D mesh, along with the mesh texture, from a single RGB image. Below we show the results of single-view mesh reconstruction on ShapeNet.

    Download shapenet rendering dataset provided by NMR:

    bash examples/recon/download_dataset.sh
    

    To train the model:

    CUDA_VISIBLE_DEVICES=0 python examples/recon/train.py -eid recon
    

    To test the model:

    CUDA_VISIBLE_DEVICES=0 python examples/recon/test.py -eid recon \
        -d 'data/results/models/recon/checkpoint_0200000.pth.tar'
    

    We also provide our trained model here:

    • SoftRas trained with silhouettes supervision (62+ IoU): google drive
    • SoftRas trained with shading supervision (64+ IoU, test with --shading-model arg): google drive
    • SoftRas reconstructed meshes with color (random sampled): google drive

    2. Image-based Shape Deformation

    SoftRas provides strong supervision for image-based mesh deformation. We visualize the deformation process from a sphere to a car model and then to a plane given supervision from multi-view silhouette images.

    CUDA_VISIBLE_DEVICES=0 python examples/demo_deform.py
    

    The optimized mesh is included in data/obj/plane/plane.obj

    3. Pose Optimization for Rigid Objects

    With scheduled blurry renderings, one can obtain smooth energy landscape that avoids local minima. Below we demonstrate how a color cube is fitted to the target image in the presence of large occlusions. The blurry rendering and the corresponding rendering losses are shown in the 3rd and 4th columns respectively.

    4. Non-rigid Shape Fitting

    We fit the parametric body model (SMPL) to a target image where the part (right hand) is entirely occluded in the input view.

    Contacts

    Shichen Liu: [email protected]

    Any discussions or concerns are welcomed!

    Citation

    If you find our project useful in your research, please consider citing:

    @article{liu2019softras,
      title={Soft Rasterizer: A Differentiable Renderer for Image-based 3D Reasoning},
      author={Liu, Shichen and Li, Tianye and Chen, Weikai and Li, Hao},
      journal={The IEEE International Conference on Computer Vision (ICCV)},
      month = {Oct},
      year={2019}
    }
    
    @article{liu2020general,
      title={A General Differentiable Mesh Renderer for Image-based 3D Reasoning},
      author={Liu, Shichen and Li, Tianye and Chen, Weikai and Li, Hao},
      journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
      year={2020},
      publisher={IEEE}
    }