Giter VIP home page Giter VIP logo

platonicgan's Introduction

PlatonicGAN

This repository contains code for the paper Escaping Plato’s Cave: 3D Shape from Adversarial Rendering (ICCV2019).

More detailed information and results can be found on our project page.

Teaser

Data

For training you can use any image collection you would like. For now two example datasets "tree" and "chanterelle" are provided under 'datasets/. If you have your own data set go to 'scripts/data' and have a look at the already implemented custom implementations for data sets. You may want to adjust them accordingly or create new ones. In case you want to create a new Dataset class you should do so under scripts/data.

Usage

Prerequisites

  • Linux (not tested for MacOS or Windows)
  • Python3
  • CPU or NVIDIA GPU

Installation

Clone this repo:

git clone https://github.com/henzler/platonicgan
cd platonicgan

In order to install the required python packages run (in a new virtual environment):

pip install -r requirements.txt

Note: The model was trained with PyTorch 1.0.0, but also tested with Pytorch 1.3.1

Train

For training execute the following command (for default config, currently this will train the tree dataset):

python train.py

or for a specific config:

python train.py --config_file=scripts/configs/your_config_file.yaml

Track training progress

Use tensorboard to visualise intermediate training results:

tensorboard --logdir=.

Bibtex

If you use this code for your research, please cite our paper.

@InProceedings{henzler2019platonicgan,
author = {Henzler, Philipp and Mitra, Niloy J. and Ritschel, Tobias},
title = {Escaping Plato's Cave: 3D Shape From Adversarial Rendering},
booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
month = {October},
year = {2019}
}

platonicgan's People

Contributors

henzler 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

Watchers

 avatar  avatar  avatar

platonicgan's Issues

train issue

hello
The code "The self.writer.add_video('{}_x_a'.format(tag), videox_a, self.iteration) " in utils/logger.py shows imageio errors when I train with the train.py file
"raise ValueError("Can't write images with one color channel.")
ValueError: Can't write images with one color channel. "
How to solve it? I guess it may be the version conflict of imageio. What is the version of imageio of the code

Question about metric cd in utils folder

Hello, while analyzing your code, I looked at the code of the metric cd function and found that it was different from the existing chamfer distance. Could you briefly tell me what the input value is different from and what formula was used to obtain it? I'm sorry if the text was translated rudely by using a translator because I was wrong in English at the moment.
this is the code:
def metric_cd(output, target):
distance_transform_target = scipy.ndimage.distance_transform_edt(1-target)
return (distance_transform_target * output).sum() / target.size

Configure CPU computation

I've started to use your model for generating 3D cars but I do not know how to change settings to compute from GPU to CPU (I do not have such a good GPU board, I want to use CPU only, and because of some troubles to install CUDA on my computer).
I am looking the default .yaml file and messing up how to change.

Apply Method to New Dataset / How to Extract the Mesh

Hi @henzler , thanks a lot for the great work!

I want to apply your method to my own car dataset. Could you give me some advice if I would need to change something? These would be RGBA images of cars. For now I tried to use the default config with adjusted paths. Currently, you sample uniformly on the full sphere - is this correct? Here I would adjust the sample range - but is there something else I need to take into account?

Also, could you provide some hints on how to extract the mesh? I tried to take the output volume, select a threshold of 0.5, and apply marching cubes to this - however, my results for the tree dataset look different from your your result in the paper.

Thanks so much in advance!

Can't train in platonic_3d mode

Hi guys when I try to train in platonic_3d model with tree dataset I get the following error:
Traceback (most recent call last): File "train.py", line 41, in <module> trainer.generator_train(image, volume, z) File "/home/neuron/neuron/repos/individual_member_directory/sim/test_voxelization/platonicgan/scripts/trainer/trainer_platonic_3d.py", line 46, in generator_train self.trainer_3d.generator_train(image, volume, z) File "/home/neuron/neuron/repos/individual_member_directory/sim/test_voxelization/platonicgan/scripts/trainer/trainer_3d.py", line 30, in generator_train data_loss = self._compute_data_term_loss(fake_volume, volume, self.param.training.data_term_lambda_3d) File "/home/neuron/neuron/repos/individual_member_directory/sim/test_voxelization/platonicgan/scripts/trainer/trainer.py", line 67, in _compute_data_term_loss return self.criterion_data_term(output, target) * weight File "/home/neuron/anaconda3/envs/platonic_363_torch100/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/home/neuron/anaconda3/envs/platonic_363_torch100/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 435, in forward return F.mse_loss(input, target, reduction=self.reduction) File "/home/neuron/anaconda3/envs/platonic_363_torch100/lib/python3.6/site-packages/torch/nn/functional.py", line 2155, in mse_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/home/neuron/anaconda3/envs/platonic_363_torch100/lib/python3.6/site-packages/torch/functional.py", line 52, in broadcast_tensors return torch._C._VariableFunctions.broadcast_tensors(tensors)

Note: the line numbers might be slightly different since I put a few print statements in the scripts to debug.
The problem is that the 'volume' loaded in train.py is of torch.Size([8])

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.