Code Monkey home page Code Monkey logo

deep-photometric-stereo-network's Introduction

Deep photometric stereo network

This repository is an implementation of Deep Photometric Stereo Network. (http://openaccess.thecvf.com/content_ICCV_2017_workshops/w9/html/Santo_Deep_Photometric_Stereo_ICCV_2017_paper.html)

How to Train

We use the deep learning framework Tensorflow with following libraries:

We use python 2.7 on Ubuntu 14.04. You can use our Dockerfile (Nvidia-docker is required).

Download datasets

We use following dataset for the training and evaluation.

You can download each file by download_*.sh. DiLiGenT is only used for evaluation.

params.py

This file defines paths of each dataset and the light source directions. Now the light source directions are fit to DiLiGenT dataset. You can modify this values for your setup.

Also, the path to save the training images are defined here.

Rendering training data

First, you need to build:

$ cd ./merl_brdf_database
$ cmake .
$ make

This is because we use BRDFRead.cpp to read MERL BRDF Database, which is the sample code in that project.

You can render synthetic training and test data by:

$ python renderin_with_merl.py

The training and test data are output to the specified path in params.py.

Preparing training data

We use TFRecord format for training data. You can convert rendered images to the TFRecord file by:

$ python dataset.py

Training

$ python train.py --output_path PATH_TO_SAVE_MODEL --gpu GPU_ID

Other arguments can be confirmed by --help option.

Directory tree of Model

PATH_TO_SAVE_MODEL has following directories:

summary

Summary for tensorboard

  • {train|test}/cost : Output of loss function
  • {train|test}/RMSE : Root Mean Squared Error between ground truth and predicted normal vector

checkpoint

Checkpoint files

best_checkpoint

Best checkpoint file. "Best" means that minimize the L_2 loss for synthetic test data.

eval

Estimated images for synthetic test data.

Result

Our estimated normal maps of DiLiGenT are available in .npy format. When you want to use them for the comparison, please contact to the first author of the paper.

deep-photometric-stereo-network's People

Contributors

guanyingc avatar hiroaki-santo 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

Watchers

 avatar  avatar

deep-photometric-stereo-network's Issues

About BRDFRead

Hello,
I am very interested in this project,but I got an error when compiling the project merl_brdf_database.I compiled on Mac os. There was no error in cmake, but the following error occurred during make.

Charlies-MacBook-Pro:merl_brdf_database charlie$ make
Scanning dependencies of target BRDFRead
[ 50%] Building CXX object CMakeFiles/BRDFRead.dir/BRDFRead.cpp.o
/Users/charlie/Documents/dpsn/deep-photometric-stereo-network/merl_brdf_database/BRDFRead.cpp:36:9: warning:
'M_PI' macro redefined [-Wmacro-redefined]
#define M_PI 3.1415926535897932384626433832795
^
/usr/include/math.h:703:9: note: previous definition is here
#define M_PI 3.14159265358979323846264338327950288 /* pi /
^
1 warning generated.
[100%] Linking CXX shared library BRDFRead.dylib
Undefined symbols for architecture x86_64:
"boost::numpy::initialize(bool)", referenced from:
init_module_BRDFRead() in BRDFRead.cpp.o
"boost::numpy::zeros(boost::python::tuple const&, boost::numpy::dtype const&)", referenced from:
read_brdfpy(char const
) in BRDFRead.cpp.o
"boost::numpy::dtype boost::numpy::detail::get_float_dtype<64>()", referenced from:
read_brdfpy(char const*) in BRDFRead.cpp.o
"boost::python::detail::init_module(PyModuleDef&, void ()())", referenced from:
_PyInit_BRDFRead in BRDFRead.cpp.o
"boost::python::converter::object_manager_traitsboost::numpy::ndarray::get_pytype()", referenced from:
boost::python::detail::converter_target_type<boost::python::to_python_value<boost::numpy::ndarray const&> >::get_pytype() in BRDFRead.cpp.o
boost::python::detail::caller_arity<5u>::impl<boost::python::tuple (
)(boost::numpy::ndarray, double, double, double, double), boost::python::default_call_policies, boost::mpl::vector6<boost::python::tuple, boost::numpy::ndarray, double, double, double, double> >::operator()(_object*, _object*) in BRDFRead.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [BRDFRead.dylib] Error 1
make[1]: *** [CMakeFiles/BRDFRead.dir/all] Error 2
make: *** [all] Error 2

I can't solve this problem. Do you have any suggestions?

About rendered image

Hello, I found a mistake about the dataset.
Yesterday, I used the Dockerfile you provided to produce the dataset. But I found some materials image is very black and not normal, for example, the alumina-oxide in fig 1.
0
I opened this image in Matlab and I found its intensity is in [0,255]. Because the rendered image is uint16, I multiplied the rendered image by 255, it looks normal as follows:
2345 20181215091739
However,It's not right for every material. The rendered image of blue-fabric is
1
and multiplied the rendered image by 255 is
2345 20181215092449
it seems to overflow.
what is wrong?
Could you please provide the original dataset if it's convenient?
I am looking forward to your reply! Thank you very much

About rendering_with_merl.py

Hello,
When I run "python rendering_with_merl.py",the error occured as follow.

Traceback (most recent call last):
File "rendering_with_merl.py", line 163, in
for n_path in n_png_paths[[1, 7]]: # This means blob02 and blob08
IndexError: index 1 is out of bounds for axis 1 with size 0

Can you solve it?Thank you.

About mask and time

Hello,I have some questions about this paper。。。。

  1. Each pixel of an image is treated as the training data in this paper. But I think there are lots of redundant data because of the existence of a mask. why ?
  2. How long did it take to train this neural network?

Thank you!!

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.