GithubHelp home page GithubHelp logo

aaronjackson / vrn Goto Github PK

View Code? Open in Web Editor NEW
4.5K 4.5K 749.0 538 KB

:man: Code for "Large Pose 3D Face Reconstruction from a Single Image via Direct Volumetric CNN Regression"

Home Page: http://aaronsplace.co.uk/papers/jackson2017recon/

License: MIT License

Lua 9.60% MATLAB 35.97% Shell 26.32% Python 25.40% TeX 2.71%
3d computer-vision computervision deeplearning face reconstruction torch7

vrn's Introduction

Large Pose 3D Face Reconstruction from a Single Image via Direct Volumetric Regression

Aaron S. Jackson, Adrian Bulat, Vasileios Argyriou and Georgios Tzimiropoulos

Try out the code without running it! Check out our online demo here. Alternatively, pull the DockerHub image `asjackson:vrn`, see docs in the vrn-docker repo.

http://aaronsplace.co.uk/papers/jackson2017recon/preview.png

Please visit our project webpage for a link to the paper and an example video run on 300VW. This code is licenses under the MIT License, as described in the LICENSE file.

This is an unguided version of the Volumetric Regression Network (VRN) for 3D face reconstruction from a single image. This method approaches the problem of reconstruction as a segmentation problem, producing a 3D volume, spatially aligned with the input image. A mesh can then be obtained by taking the isosurface of this volume.

Several example images are included in the examples folder. Most of these are AFLW images taken from 3DDFA.

If you are running the code to calculate error for a potential publication, please use the MATLAB version, as this is what was used to compute the error for the paper.

Prebuilt Docker Image for CPU version

I have released an image on Docker Hub which has everything to get the CPU version running under Docker. I’ll extend this to have CUDA support at some point.

docker pull asjackson/vrn:latest
docker run -v $(pwd)/data:/data:Z vrn /runner/run.sh /data/turing.jpg

The repo holding this is available at vrn-docker and the models (which have been cast to CPU floats already) were stored in Git LFS but took too much space. If you have an issue with this docker container, please use the vrn-docker issue tracker rather than the vrn issue tracker.

Software Requirements

A working installation of Torch7 is required. This can be easily installed on most platforms using torch/distro. You will also require a reasonable CUDA capable GPU.

This project was developed under Linux. I have no idea if it will work on Windows and it is unlikely that I will be able to help you with this. If you are running Mac OS, issue #1 might be of interest to you.

Quick overview of requirements:

  • Torch7 (+ nn, cunn, cudnn, image). See “Installation Example” below.
  • NVIDIA GPU, with a working CUDA (7.5 or 8.0) and CuDNN (5.1).
  • Either,
    • MATLAB
    • bash, ImageMagick, GNU awk, Python 2.7 (+ visvis, imageio, numpy)

Please be wary of the version numbers for CUDA, CuDNN and Python.

Bulat’s face alignment code is included as a submodule. Please check his README for dependencies.

Getting Started

git clone --recursive https://github.com/AaronJackson/vrn.git
cd vrn
./download.sh

Running with MATLAB

MATLAB offers better functionality for taking the iso surface of the volume. It also has some code to calculate per-vertex colouring on the mesh. If you have MATLAB I recommend this route.

To run, type “run” from MATLAB.

Running with Python

No longer is MATLAB an absolute requirement! I’ve included a slightly crazy (but don’t worry, I had fun writing it) shell script which performs the face normalisation, and runs the vis.py script to render the regressed volume.

Unfortunately this does not yet apply any colouring or texture to the mesh (you’re welcome to contribute) and it has some issues if you don’t have a fully working OpenGL setup. Some GPUs won’t like the background image not being a power of two, so it might make the results look odd. I’ll work on this sometime.

To run it on the included example images without MATLAB, make the run.sh executable with chmod u+x run.sh and type ./run.sh from your terminal.

Using your own images

You are, of course, welcome to try out this method on your own set of images. dlib, the face detector included with Bulat’s face alignment code struggles to find side poses. You are welcome to modify the code to provide bounding boxes.

Available Options

The MATLAB “run.m” script contains a few options which you can change. Here is a very quick description of them:

  • input_folder, as the name suggests, the folder to glob for JPEG images.
  • output_folder, the directory to store the regressed volumes.
  • model_file, the name of the Torch model to load.
  • gpunum, specify which GPU to use, starting at 0.
  • texture, rudimentary texture mapping by taking the 2D projections nearest neighbour (MATLAB only).

Installation Example

I’ve had a few requests to describe a little better how to configure Torch so that everything works correctly. I’ve tested this on Fedora 24 and CentOS 7. I’m assuming it will also work on Ubuntu if you have the correct development packages installed.

# Install some dependencies for later. I might have missed some
sudo yum install glog-devel boost-devel
pip install dlib matplotlib numpy visvis imageio

# Install the Torch distribution.
mkdir -p $HOME/usr/{local,src}
cd $HOME/usr/local
git clone https://github.com/torch/distro.git
mv distro torch
cd torch
sudo ./install-deps
./install.sh
source $HOME/usr/local/torch/install/bin/torch-activate

# Install THPP and fb.python for the face alignment code
cd $HOME/usr/src
git clone https://github.com/1adrianb/thpp.git
cd thpp/thpp
THPP_NOFB=1 ./build.sh

# Install fb.python.
cd $HOME/usr/src
git clone https://github.com/facebook/fblualib.git
cd fblualib/fblualib/python
luarocks make rockspec/*

cd $HOME
git clone --recursive https://github.com/AaronJackson/vrn.git
cd vrn
./download.sh
./run.sh

Paper Citation

@article{jackson2017vrn,
  title={Large Pose 3D Face Reconstruction from a Single Image via Direct Volumetric CNN Regression},
  author={Jackson, Aaron S and Bulat, Adrian and Argyriou, Vasileios and Tzimiropoulos, Georgios},
  journal={International Conference on Computer Vision},
  year={2017}
}

vrn's People

Contributors

aaronjackson avatar modest-as avatar wuisawesome 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vrn's Issues

Runing code in CPU mode...

I try to run the code.. For this purpose i prepare envrioment for GPU and run the code.. I got the out of memory error as shown in the screen shot..
out_of_memory_error
Than i try to run the code in CPU mood by setting the gpunum=-1.. When i run the code than i got another error... as show below....
cpu_mode_error

Can anybody help me how to run this code in CPU mode ???

Thanks

Performance?

Hello!

A wonderful and creative project!
I am only missing some informations about the performance. How long does it take to calculate a 3d model basing on a "standard" image depending on the gpu hardware? And: Is cpu also a strong factor? I am so impressed that I want to set up an own server to let your project run but would like to know a bit more about performance before deciding which components I buy.

Best regards
Marc

clearState before save the net

The vrn-unguided.t7 file is about 1.4GB. however if I simply dump the parameters with:

local nn = require("nn")
local image = require("image")
net = torch.load("/path/to/vrn-unguided.t7")
params = net:parameters()
torch.save("/path/to/vrn-params.t7", params)

The vrn-params.t7 is only 74MB.

with issue

net = net:clearState()
torch.save("/path/to/vrn-light.t7", net)

the vrn-light.t7 will be only 148MB

I haven't test the dumped model, but I think this will help you more easily distribute your model.

Model definition file and loss

Thanks for sharing the testing code. Is it possible to have the code to create the released model please? I find the architecture easier to understand with a model definition file. And which criterion did you use on top of the voxel output during training?

Output Format Problem

Yes i have run the code and it produce the output in Output folder with file extension .raw. How I open this raw format and save it back into .obj or .ply format. Can any body help me in this regards? is there is any special software or have some function in the code to write into .obj format..

Thanks

CUDA on Macs

Hi, just a heads up that you can't run this project on Macs without a GPU.

Segmentation fault

I tried to run it but got the following error.....
./run.sh ./run.sh: line 30: 32683 Segmentation fault (core dumped) th main.lua -model 2D-FAN-300W.t7 -input ../$INPUT/ -detectFaces true -mode generate -output ../$INPUT/ -device gpu -outputFormat txt ls: cannot access '*.txt': No such file or directory /home/pritam/usr/local/torch/install/bin/luajit: ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:351: read error: read 1071687 blocks instead of 7372800 at /home/pritam/usr/local/torch/pkg/torch/lib/TH/THDiskFile.c:356 stack traceback: [C]: in function 'read' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:351: in function <...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:245> [C]: in function 'read' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' ...itam/usr/local/torch/install/share/lua/5.1/nn/Module.lua:192: in function 'read' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject' ...tam/usr/local/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load' process.lua:13: in main chunk [C]: in function 'dofile' ...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50 ls: cannot access '*.raw': No such file or directory
Trying to run on ubuntu with python.

Please HELP! error message when run in MATLAB

I followed each step in Installation Example but there's still error when I run run.sh

if I click "run" in the MATLAB then the error message is

device =

gpu

/home/syaoran/torch/install/bin/lua: /home/syaoran/torch/install/share/lua/5.2/trepl/init.lua:389: /home/syaoran/torch/install/share/lua/5.2/trepl/init.lua:389: /home/syaoran/torch/install/share/lua/5.2/trepl/init.lua:389: error loading module 'fb.python.lib' from file '/home/syaoran/usr/local/torch/install/lib/lua/5.1/fb/python/lib.so':
/usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/syaoran/usr/local/torch/install/lib/lua/5.1/fb/python/lib.so)
stack traceback:
[C]: in function 'error'
/home/syaoran/torch/install/share/lua/5.2/trepl/init.lua:389: in function 'require'
main.lua:8: in main chunk
[C]: in function 'dofile'
...oran/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?
错误使用 run (line 38)
Failed to run Torch7 script.

And if I run "sudo ./run.sh" then the error message is

./run.sh: 行 24: th: 未找到命令
ls: 无法访问'.txt': 没有那个文件或目录
./run.sh: 行 78: th: 未找到命令
ls: 无法访问'
.raw': 没有那个文件或目录

which means

./run.sh: line 24: th: Command not found
ls: Unable to access'.txt': No such file or directory
./run.sh: 行 78: th: Command not found
ls: Unable to access'
.raw': No such file or directory

And after that I make sure I've make torch installed with guide on http://torch.ch/docs/getting-started.html
and after I run $th in bash there is the correct information:

______ __ | Torch7
/_ / ________/ / | Scientific computing for Lua.
/ / / _ / __/ / _ \ | Type ? for help
/_/ _
// _//// | https://github.com/torch
| http://torch.ch

Any ideas?
THANK YOU SO MUCH

fb.python, import matplotlib.pyplot segfault

@AaronJackson I am getting this.
"Fatal Python error: GC object already tracked
[1] 25262 segmentation fault (core dumped) th test.lua"

where test.lua is file that I made by running one by one every line of utils.lua file.

I found out that "import matplotlib.pyplot as plt" causes this and no matter what I do this just stays same.
Sometimes it also gives
"Fatal Python error: ceval: tstate mix-up
[1] 25302 abort (core dumped) th test.lua"

I have also tried "https://github.com/1adrianb/thpp" but still no good.

I am on cuda 8.0 and cudnn is libcudnn.so.7.

I can also import all require torch packages like cunn, cudnn.

Use Docker

If I run this project using Docker I don`t have any software requirements other than Docker itself, right?
What are the commands to run Docker?
Once the Docker container is running how can I input an image and output a .obj colored-vertex model?
KR,
Alex

fail to run ./run.sh

Hi, I followed all setup requirements. And finally ready to run!
However, I got something like this when I try to run in terminal.

2

And some error message showed in MATLAB.

> device =
> 
>     'gpu'
> 
> /home/eddie/usr/local/torch/install/bin/luajit: ...die/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: ...die/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: ...die/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: ...sr/local/torch/install/share/lua/5.1/luarocks/loader.lua:117: error loading module 'fb.python.lib' from file '/home/eddie/usr/local/torch/install/lib/lua/5.1/fb/python/lib.so':
> 	/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/eddie/usr/local/torch/install/lib/lua/5.1/fb/python/lib.so)
> stack traceback:
> 	[C]: in function 'error'
> 	...die/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
> 	main.lua:8: in main chunk
> 	[C]: in function 'dofile'
> 	...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
> 	[C]: at 0x00405d50
> Error using run (line 38)
> Failed to run Torch7 script.

I have CUDA 7.5 and corresponding cudnn 5.1 installed.

3
4

Please help :D

Request for PHP Pages

Hey Buddy,
Can you please provide me the pages of PHP that you showed in Online demo.
I want to use functionality of "Try your own face"
When i submit custom image that action goes on upload.php

can you please provide me upload.php page ?

Thank You.

Mesh vertices count differ

Output mesh vertices count is differ from each model. how can we get same vertices count for all output mesh. so that i can use this model for animation.
(or)
how to get landmark vertices point (eye, mouth, face border) from output mesh vertices

How to use raw2obj.py?

Hello @AaronJackson , Thanks for you Share this amazing code.
I already get through this code, getting the 3D model. those .raw file.
But I wanna get obj file. Could you tell me how to use raw2obj.py?

Quality of model

Hi Aaron
How can I increase quality generated models
(I am using run.sh to generating the model)

Thanks

cuda runtime error (30)

Hi Aaron

My system:
Ubuntu 16.04.3 LTS
CUDA Version 8.0.61
All need requirements installed

Error:
THCudaCheck FAIL file=/root/torch/extra/cutorch/lib/THC/THCGeneral.c line=70 error=30 : unknown error
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/trepl/init.lua:389: /root/torch/install/share/lua/5.1/trepl/init.lua:389: cuda runtime error (30) : unknown error at /root/torch/extra/cutorch/lib/THC/THCGeneral.c:70
stack traceback:
[C]: in function 'error'
/root/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:12: in main chunk
[C]: in function 'dofile'
/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50
convert: geometry does not contain image `asj.jpg' @ warning/transform.c/CropImage/674.
Cropped and scaled asj.jpg
THCudaCheck FAIL file=/root/torch/extra/cutorch/lib/THC/THCGeneral.c line=70 error=30 : unknown error
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/trepl/init.lua:389: /root/torch/install/share/lua/5.1/trepl/init.lua:389: cuda runtime error (30) : unknown error at /root/torch/extra/cutorch/lib/THC/THCGeneral.c:70
stack traceback:
[C]: in function 'error'
/root/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
process.lua:16: in main chunk
[C]: in function 'dofile'
/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

cuda runtime error when execute "run.sh"

Hi Aaron,
I downloaded your github code and successfully configured its dependences on a linux server of our lab (Ubuntu 16.04.3 LTS, 4.4.0-98-generic; Python 2.7.12; Torch7; CUDA 8.0.61; cudnn 5.1; GPU: NVIDIA TITAN Xp 12GB), but when i try to execute "run.sh", a cuda runtime error occurs:

THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-9198/cutorch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memory
/home/deqiang/Toolkits/Torch/install/bin/luajit: ...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:11: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-9198/cutorch/lib/THC/generic/THCStorage.cu:66
stack traceback:
[C]: in function 'resize'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:11: in function 'torch_Storage_type'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:57: in function 'recursiveType'
...qiang/Toolkits/Torch/install/share/lua/5.1/nn/Module.lua:160: in function 'type'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:41: in function 'recursiveType'
...qiang/Toolkits/Torch/install/share/lua/5.1/nn/Module.lua:160: in function 'type'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:41: in function 'recursiveType'
...qiang/Toolkits/Torch/install/share/lua/5.1/nn/Module.lua:160: in function 'type'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
...
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:41: in function 'recursiveType'
...qiang/Toolkits/Torch/install/share/lua/5.1/nn/Module.lua:160: in function 'type'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:45: in function 'recursiveType'
...eqiang/Toolkits/Torch/install/share/lua/5.1/nn/utils.lua:41: in function 'recursiveType'
...qiang/Toolkits/Torch/install/share/lua/5.1/nn/Module.lua:160: in function 'cuda'
process.lua:18: in main chunk
[C]: in function 'dofile'
...kits/Torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50
ls: cannot access '*.raw': No such file or directory

I tried several solutions from Google, but doesn't work.
Any help is appreciated!

Error importing "pyqt4" and "gtk" backend

Hi Aaron,
I executed "run.sh" on our linux server, the following errors display:

Error importing pyqt4 backend: cannot import name QtOpenGL
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/init.py:127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK
set_interactive(1)
Error importing gtk backend: No module named gtkgl
Traceback (most recent call last):
File "../vis.py", line 24, in
t = vv.imshow(im)
File "/usr/local/lib/python2.7/dist-packages/visvis/functions/imshow.py", line 57, in imshow
axes = vv.gca()
File "/usr/local/lib/python2.7/dist-packages/visvis/functions/gca.py", line 19, in gca
f = vv.gcf()
File "/usr/local/lib/python2.7/dist-packages/visvis/functions/gcf.py", line 23, in gcf
return vv.figure()
File "/usr/local/lib/python2.7/dist-packages/visvis/functions/figure.py", line 23, in figure
backends.use()
File "/usr/local/lib/python2.7/dist-packages/visvis/backends/init.py", line 229, in use
raise RuntimeError("None of the backends could be loaded. "+tmp)
RuntimeError: None of the backends could be loaded. Install PySide, PyQt4, wxPython, GTK, or fltk.

I checked this error on google, but still cannot understand what it is caused by.
Do you have any idea about it? Thanks in advance!

Failed to run on Ubuntu 16.06

Hi, I tried to follow the steps in the instructions to configure it on Ubuntu 16.06.

  1. In matlab 2014, when I ran 'run.m', there is an error 'usr/local/MATLAB/R2014a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found', I tried to update gcc or add options when starting matlab, the same error still occurs.
  2. So I tried to run the face alignment code directly from the terminal, by using the command 'th main.lua -model 2D-FAN-300W.t7 -input ../scaled -detectFaces true -mode generate -output ../scaled -device gpu -outputFormat txt 2>&1 > /dev/null;'
    Unfortunately, it reports one of the three errors each time I run it:
    (1) Segmentation fault
    (2) Fatal Python error: GC object already tracked
    Aborted
    (3) Fatal Python error: ceval: tstate mix-up
    Aborted

Has anyone successfully run it on Ubuntu 16.06 pls? How to make the face alignment part work?

Cannot download vrn-unguided.t7

Hey Aaron, cool stuff. :)

I'm unable to download the vrn-unguided.t7 file in the download.sh script. The link seems to be dead or at least down for several days... Is there an alternate location for the download?

The following just hangs, times out, retires, repeat...

wget -O vrn-unguided.t7 http://cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7                                                                                  
--2017-12-30 20:12:07--  http://cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7
Resolving cs.nott.ac.uk (cs.nott.ac.uk)... 128.243.20.9, 128.243.21.19
Connecting to cs.nott.ac.uk (cs.nott.ac.uk)|128.243.20.9|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7 [following]
--2017-12-30 20:12:07--  http://www.cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7
Resolving www.cs.nott.ac.uk (www.cs.nott.ac.uk)... 128.243.21.108
Connecting to www.cs.nott.ac.uk (www.cs.nott.ac.uk)|128.243.21.108|:80...failed: Connection timed out.
Retrying.

--2017-12-30 20:14:19--  (try: 2)  http://www.cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7
Connecting to www.cs.nott.ac.uk (www.cs.nott.ac.uk)|128.243.21.108|:80... failed: Connection timed out.
Retrying.

--2017-12-30 20:16:31--  (try: 3)  http://www.cs.nott.ac.uk/~psxasj/download.php?file=vrn-unguided.t7
Connecting to www.cs.nott.ac.uk (www.cs.nott.ac.uk)|128.243.21.108|:80...

error run in matlab

i have installation of Torch7 using torch/distro, but the matlab shows error:
device =

'gpu'

/home/wy/torch/install/bin/luajit: /home/wy/torch/install/share/lua/5.1/trepl/init.lua:389: /home/wy/torch/install/share/lua/5.1/trepl/init.lua:389: module 'fb.python' not found:No LuaRocks module found for fb.python
no field package.preload['fb.python']
no file '/home/wy/.luarocks/share/lua/5.1/fb/python.lua'
no file '/home/wy/.luarocks/share/lua/5.1/fb/python/init.lua'
no file '/home/wy/torch/install/share/lua/5.1/fb/python.lua'
no file '/home/wy/torch/install/share/lua/5.1/fb/python/init.lua'
no file './fb/python.lua'
no file '/home/wy/torch/install/share/luajit-2.1.0-beta1/fb/python.lua'
no file '/usr/local/share/lua/5.1/fb/python.lua'
no file '/usr/local/share/lua/5.1/fb/python/init.lua'
no file '/home/wy/.luarocks/lib/lua/5.1/fb/python.so'
no file '/home/wy/torch/install/lib/lua/5.1/fb/python.so'
no file '/home/wy/torch/install/lib/fb/python.so'
no file './fb/python.so'
no file '/usr/local/lib/lua/5.1/fb/python.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/home/wy/.luarocks/lib/lua/5.1/fb.so'
no file '/home/wy/torch/install/lib/lua/5.1/fb.so'
no file '/home/wy/torch/install/lib/fb.so'
no file './fb.so'
no file '/usr/local/lib/lua/5.1/fb.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/wy/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:8: in main chunk
[C]: in function 'dofile'
...e/wy/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50
错误使用 run (line 38)
Failed to run Torch7 script.

how can i fix this error, thanks a lot!

i converted it to pytorch...

Hi,

First off thanks for posting this! I couldn't find a better way to contact you, so I hope this is ok.
I'm excited to use it, but I ran into some issues. I tried several times and just couldn't get it to run. i know it's something with my configuration, I just can't figure it out.

So I converted the project to use Pytorch and I got that working. I'm wondering if I can get a copy of the .raw files for the example folder, so I can see how accurate my conversion is?

My plan is to do a visual inspection first, with your vis.py script, then if that pans out, compare the volumes generated.

My hope is that it is accurate, so I can post the conversion for others to use, giving you credit of course.

Thanks,
-Andrew

Any free way to run the code?

I was trying to run this project but after the full setup I learned that MATLAB is not some free library to download, but rather a very expensive commercial software :(

Is there any way to release a compiled version or to run this without MATLAB?

It's unclear about the effect of double hourglass model

You claimed the 2nd hourglass model (with the identical structure) help to refine the result. It would be interesting to see what the result would be with only 1 or even multiple of hourglass model.
Also I have a gut feeling that the later "refinement" model doesn't needs to be as deep and the previous one(s), since the abstracted information should already been encoded.

It's overall very interesting work, cheers.

How to run raw2obj.py

Hello your project is very helpful to my academic work, can you guide me to execute raw2obj.py with arguments .

Cropped images could have size less than 192x192

I'm not sure if this is a problem related my imagemagick, but the cropped images may have height less than 192. I see this even with the included examples. As a result, vis.py generates error when volRGB is created since image may not match 192x192 dimension.

I have modified convert command in run.sh as below.
convert $fname
-scale $scale%
-crop 192x192+$x+$y
-background white
-gravity center
-extent 192x192
scaled/$fname

this seems to be generating 192x192 images that matches the volume.

Error in running run.sh - attempt to perform arithmetic on field 'scale_factor' (a nil value)

Found the following error while running the script. The script fails at passing cropped image through the VRN. I tried using one image at a time as well, but not able to figure out why is the code failing. It looks like its failing at image.scale, but there's no scale_factor field reqd for image.scale.

Do you have any insight as to why this is happening?

root@56fb226b7d32:/workspace/vrn# ./run.sh
Cropped and scaled AFLW_image00046.jpg
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/nn/Container.lua:67: 
In 12 module of nn.Sequential:
In 1 module of nn.ConcatTable:
In 3 module of nn.Sequential:
...h/install/share/lua/5.1/nn/SpatialUpSamplingBilinear.lua:64: attempt to perform arithmetic on field 'scale_factor' (a nil value)
stack traceback:
	...h/install/share/lua/5.1/nn/SpatialUpSamplingBilinear.lua:64: in function <...h/install/share/lua/5.1/nn/SpatialUpSamplingBilinear.lua:47>
	[C]: in function 'xpcall'
	/root/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
	/root/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function </root/torch/install/share/lua/5.1/nn/Sequential.lua:41>
	[C]: in function 'xpcall'
	/root/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
	/root/torch/install/share/lua/5.1/nn/ConcatTable.lua:11: in function </root/torch/install/share/lua/5.1/nn/ConcatTable.lua:9>
	[C]: in function 'xpcall'
	/root/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
	/root/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
	process.lua:31: in main chunk
	[C]: in function 'dofile'
	/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
	[C]: at 0x00406670

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above.
stack traceback:
	[C]: in function 'error'
	/root/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
	/root/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
	process.lua:31: in main chunk
	[C]: in function 'dofile'
	/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
	[C]: at 0x00406670

Segmentation fault (core dumped)- Error

i have installed torch7 and all its dependencies according to your project. During execution of face alignment whenever i run main.lua file with any model "Segmentation fault (core dumped)" error is triggered. Give advice to run that project .Please help !

$ th main.lua -model 2D-to-3D-FAN.t7
Segmentation fault (core dumped)

Apply scale transform to visvis

In vis.py,

# Worth mentioning that the Z component (axis=0) is twice as deep as
# the X and Y components are wide/tall. I'm going to leave these
# unscaled for now, but if you know how to scale the mesh from
# showvol, I would love to know.

Here is it:

# add the following line just below
# v = vv.volshow(volRGB, renderStyle='iso')
# will do the scale transform.
v.transformations[1].sz = 0.5

from v.transformations:
[<visvis.core.misc.Transform_Translate at 0x7effcb6c7890>,
<visvis.core.misc.Transform_Scale at 0x7effcb6c7b50>]

As you can see from it, the first is translate and second is scale, and it can be simply modified.

failed run in matlab, in main.lua line8: local utils = require 'utils'

Hi, @AaronJackson , Thanks for your meaningful work. When I run your demo, I encountered an error as follows. I try to solve this problem according to Unsupported HDF5 version and Error while running "th eval.lua but I failed.

`/home/lixuanping/torch/install/bin/luajit: /home/lixuanping/torch/install/share/lua/5.1/trepl/init.lua:389: ./utils.lua:4: Python error: execute Python code
Traceback (most recent call last):
File "", line 3, in
File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 97, in
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/init.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 13, in
import gtk; gdk = gtk.gdk
File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/init.py", line 64, in
_init()
File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/init.py", line 52, in _init
_gtk.init_check()
RuntimeError: could not open display

stack traceback:
[C]: in function 'error'
/home/lixuanping/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:8: in main chunk
[C]: in function 'dofile'
...ping/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x004064f0
Error using run (line 40)
Failed to run Torch7 script.`

MATLAB on Mac OS X is unable to find th

Hi
I am using mac , and have installed torch7 , MATLAB and NVIDIA GPU (CUDA 8.0) . When I run the run.m by MATLAB, I get the following results:
--------------------------------
~/vrn/face-alignment ~/vrn
/bin/bash: th: command not found
~/vrn
Landmarks extracted successfully.
/bin/bash: th: command not found
Error using run (line 70)
Failed to run Torch7 script.
-------------------------------
----

Looks like 'th' and CUDA works properly since it responds "Landmarks extracted successfully." but the second system call in the code gives this error. No idea what is this error from.
I greatly appreciate your help in advance!

Error loading module 'fb.python.lib'

Hi Aaron,
Thanks for sharing your work! The outcome of 3D face reconstruction with your method (online model testing) is really good.
To test your code in further, I downloaded your github code and tried to configure its environment on a linux server of our lab (Ubuntu 14.04.5 LTS, kernel 3.16.0-77-generic; Python 2.7.14; Torch7). Finally, I successfully configured all dependences according to the guidance on VRN github webpage (https://github.com/AaronJackson/vrn) , but an lib linking error occurs when run "run.sh" as follows:

deqiang@andrew:~/Toolkits/VRN/vrn$ ./run.sh
/home/deqiang/Toolkits/Torch/install/bin/luajit: ...iang/Toolkits/Torch/install/share/lua/5.1/trepl/init.lua:389: ...iang/Toolkits/Torch/install/share/lua/5.1/trepl/init.lua:389: ...iang/Toolkits/Torch/install/share/lua/5.1/trepl/init.lua:389: ...Toolkits/Torch/install/share/lua/5.1/luarocks/loader.lua:117: error loading module 'fb.python.lib' from file '/home/deqiang/Toolkits/Torch/install/lib/lua/5.1/fb/python/lib.so':
/home/deqiang/Toolkits/Torch/install/lib/lua/5.1/fb/python/lib.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8
stack traceback:
[C]: in function 'error'
...iang/Toolkits/Torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:8: in main chunk
[C]: in function 'dofile'
...kits/Torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk

I searched this issue on Google, it seems that the python interpreter version for fb.python module used (PyUnicodeUCS2) is not consistent with the system python interpreter version (PyUnicodeUCS4). I tried to reconfigure "fblualib" for several times, but doesn't work.
Do you have any idea for this issue? Any help is appreciated!

Deqiang Xiao
Biomedical Research Imaging Center (BRIC)
University of North Carolina at Chapel Hill, US

Other trained models?

In the paper, you describe 3 models: VRN, VRN-multitask, and VRN-guided. I believe that the model included in the framework is only the first; do you plan on releasing the other two?

Very much appreciate the code, thanks for releasing!

Matthew

err!!! run "run.m" in matlab

/root/torch/install/bin/lua: main.lua:54: '=' expected near 'continue'
stack traceback:
[C]: in function 'dofile'
.../torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: ?

please help? i'm newer

XYZ export of the volume data for mesh reconstruction

I wanted to share a simple script based on vis.py to save the volume to an xyz file with color. Later meshlab could be used to reconstruct the surface. The steps are

  1. Export the volume to xyz file using below script: python export_xyz.py --volume volumename --image imagename --xyz xyz.txt
  2. Use meshlab to import txt file as X Y Z R G B file
  3. Filters ->Normals -> Compute Normals for point sets
  4. Filters -> Remeshing -> Surface reconstruct Poisson
  5. Filters -> Texture -> Parametrization: Trivial Per-Triangle
  6. Filters -> Texture -> Transfer Vertex Attributes to Texture

I have also done vertex color transfer, but I'm not sure if it was necessary. After the transfer, the number of vertices can be reduced to have a smaller model.

Regarding the script, I didn't want to add it to vis.py since it would need further changes to differentiate visvis display vs xyz output etc.

import numpy as np
import visvis as vv
import argparse

parser = argparse.ArgumentParser(description='Export the 3D volume')

parser.add_argument('--volume', dest='volume',
help="The volume to render")
parser.add_argument('--image', dest='image',
help="The background image to display")
parser.add_argument('--xyz', dest='xyz',
help="XYZ file to export")
args = parser.parse_args()

vol = np.fromfile(args.volume, dtype=np.int8)
vol = vol.reshape((200,192,192))

im = vv.imread(args.image)

f = open(args.xyz, 'w')
for z in range(0,200):
for y in range(0,192):
for x in range(0,192):
if(vol[z][y][x]>1):
f.write(str(z)+";"+str(-y)+";"+str(x)+";"+
str(im[y,x,0])+";"+str(im[y,x,1])+";"+str(im[y,x,2])+
"\n")
f.close()

Output OBJ file

Hi @AaronJackson,

Is there a way to output OBJ file directly? I notice the output of your online demo is OBJ, but the output of the code is RAW.

Thanks!

Segmentation fault

Hello.
I have a problem with running ./run.sh script:

./run.sh: line 30: 11690 Segmentation fault      (core dumped) th main.lua -model 2D-FAN-300W.t7 -input ../$INPUT/ -detectFaces true -mode generate -output ../$INPUT/ -device gpu -outputFormat txt
ls: cannot access '*.txt': No such file or directory
ls: cannot access '*.raw': No such file or directory

I have ubuntu 16.04 LTS
Python 2.7.12
CUDA Version 9.0.176
CUDNN v5.0
nVidia GTX 1080 GPU

Do you have any idea how to resolve this problem?
And what i can provide to you for additional information?

Thanks.

About training data

First of all, congratulations for your very impressive results!
A couple of questions:

  1. Can you please clarify what's the training data for the vrn-unguided.t7 model released with this repo? In your paper, section 3.1, a method for generating data from the 300W-LP dataset is described. In section 4 you also present results on other datasets.
  2. Do you plan to release such dataset at some point?

Thanks!

Train torch model

can you please provide any one sample image / 3d mesh which is used for torch trained model,
did you used same vertices count (3d mesh vertices) in trained model?

"./run.sh" error loading module 'fb.python.lib'

[root@localhost vrn]# ./run.sh
/home/torch/install/bin/luajit: /home/torch/install/share/lua/5.1/trepl/init.lua:389: /home/torch/install/share/lua/5.1/trepl/init.lua:389: /home/torch/install/share/lua/5.1/trepl/init.lua:389: .../torch/install/share/lua/5.1/luarocks/loader.lua:117: error loading module 'fb.python.lib' from file '/home/torch/install/lib/lua/5.1/fb/python/lib.so':
/home/torch/install/lib/lua/5.1/fb/python/lib.so: undefined symbol: _ZN6google4base21CheckOpMessageBuilder9NewStringEv
stack traceback:
[C]: in function 'error'
/home/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:8: in main chunk
[C]: in function 'dofile'
.../torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x004064f0
ls: cannot access *.txt: No such file or directory
ls: cannot access *.raw: No such file or directory

i've already installed fbpython into the path: /home/torch/install/lib/luarocks/rocks

something wrong with run.sh

./run.sh: line 24: th: command not found
ls: cannot access '.txt': No such file or directory
./run.sh: line 78: th: command not found
ls: cannot access '
.raw': No such file or directory
Do you have any idea about these problems?

voxelization

Hi, could you post the voxelization code? Or tell more about the used algorithm. I tried some tools but they generate a volume model with artifacts like this:
image

./run.sh failed!

I've installed cuda9.0 and cudnn v7. What is *.raw?

▶ ./run.sh                                                 
/home/artprog/usr/local/torch/install/bin/luajit: cannot open main.lua: No such file or directory
stack traceback:
	[C]: in function 'dofile'
	...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00405d50
ls: cannot access '*.txt': No such file or directory
Found Environment variable CUDNN_PATH = /usr/lib/x86_64-linux-gnu/libcudnn.so7/home/artprog/usr/local/torch/install/bin/luajit: ...rog/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: ...rog/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: ...prog/usr/local/torch/install/share/lua/5.1/cudnn/ffi.lua:1592: /usr/lib/x86_64-linux-gnu/libcudnn.so7: cannot open shared object file: No such file or directory
stack traceback:
	[C]: in function 'error'
	...rog/usr/local/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
	process.lua:17: in main chunk
	[C]: in function 'dofile'
	...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00405d50
ls: cannot access '*.raw': No such file or directory

I've tried to run from matlab. But it complained as follows:

device =

gpu

zsh:1: command not found: th
Error using run (line 38)
Failed to run Torch7 script.

But torch works in terminal.

Port to iOS CoreML

THANKS for the project! I am currently doing a project that tracks face in mobile AR and surprised to see your face 3d reconstruction paper. I hope I can use 'vrn' as part of my face tracking. Would you appreciate I port the torch model you've trained to the CoreML format in iOS?

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.