Code Monkey home page Code Monkey logo

vrn-docker's Introduction

Docker build for vrn code

If you’ve been redirected here from the 3D face reconstruction demo website: Sorry, I turned it off.

This is intended to work on CPU. Will modify eventually to have CUDA support. It’s available on DockerHub but you are welcome to build it yourself too. If you feel like doing this yourself, please feel free to send a pull request to a branch called cuda.

Setup

Dockerhub

The pre-built docker image is available on Docker Hub and includes the CPU float versions of the models.

sudo docker pull asjackson/vrn:latest

Build docker manually

The model files were originally held in GitHub’s LFS, but I ran out of space. If you want to build the container yourself, feel free to ask me for links to these files, or alternatively grab them from inside the Docker Hub container.

git clone
cd vrn-docker
docker build -t vrn .

Running the container

An example image of Alan Turing is available in the folder data, this needs to be bind mounted to /data in the container. With any luck, data/turing.jpg.obj will be created.

docker run -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/turing.jpg

The Z suffix changes the SELinux context of the directory so that it can be accessed on systems which have SELinux enabled. This might not be necessary on some distributions, such as Ubuntu, where SELinux is disabled by default. However, it is likely required under CentOS and Fedora.

vrn-docker's People

Contributors

aaronjackson 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

vrn-docker's Issues

M1 macOS BigSur is supported?

After install image

sudo docker pull asjackson/vrn:latest

I run in terminal

MBP-Aleksej:vrn-docker root# docker run --platform linux/amd64 -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/turing.jpg

Then I see it

turing.jpg
turing.jpg.obj
Please wait. Your image is being processed.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
/runner/run.sh: line 27:    43 Segmentation fault      th main.lua -model 2D-FAN-300W.t7 -input $TMPDIR/$INPUT -detectFaces true -mode generate -output $TMPDIR/$INPUT.txt -device cpu -outputFormat txt
The face detector failed to find your face.

My machine: M1 macOS BigSur

Failing to run the container

After pulling the image and running the container:

sudo docker run -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/turing.jpg

I get the following output in terminal:

Please wait. Your image is being processed.
convert: unable to open image /data/turing.jpg': No such file or directory @ error/blob.c/OpenBlob/2882. convert: no images defined /tmp//turing.jpg' @ error/convert.c/ConvertImageCommand/3235.
Initialising python libs...
Initialising detector...
/root/usr/local/torch/install/bin/luajit: /root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: /tmp//turing.jpg: No such file or directory
stack traceback:
[C]: in function 'error'
/root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: in function 'load'
main.lua:33: in main chunk
[C]: in function 'dofile'
...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406460
rm: cannot remove '/tmp//turing.jpg': No such file or directory
The face detector failed to find your face.

Thank you

Hardware/OS Requirements

I'm trying to run this on M1 Mac and its failing, I saw the issue about that so I decided to spin up a linux server running docker to try and run this. When I run the Turing.jpg I get the following error. What am I doing wrong.

Please wait. Your image is being processed.
Initialising python libs...	
Initialising detector...	
   3
 384
 384
[torch.LongStorage of size 3]

/runner/run.sh: line 27:    19 Killed                  th main.lua -model 2D-FAN-300W.t7 -input $TMPDIR/$INPUT -detectFaces true -mode generate -output $TMPDIR/$INPUT.txt -device cpu -outputFormat txt
The face detector failed to find your face.

Unable to modify image

I apologize for this issue as it's more of a docker question.

I wanted to try making a change to one of the scripts after pulling the image.

I did the following:

sudo docker pull asjackson/vrn:latest

docker run -t -i --entrypoint bash asjackson/vrn

I was able to start an interactive session and make the changes that I want.

Then I was able to commit the changes to a new image with:

docker commit hash new_image

After trying to run your command using new_image instead of asjackson/vrn, I am getting errors:

Please wait. Your image is being processed.
convert: no images defined `/tmp//' @ error/convert.c/ConvertImageCommand/3235.
Initialising python libs...	
Initialising detector...	
/root/usr/local/torch/install/bin/luajit: /root/usr/local/torch/install/share/lua/5.1/dok/inline.lua:738: <image.load> unable to determine image type for file: /tmp//
stack traceback:
	[C]: in function 'error'
	/root/usr/local/torch/install/share/lua/5.1/dok/inline.lua:738: in function 'error'
	/root/usr/local/torch/install/share/lua/5.1/image/init.lua:390: in function 'load'
	main.lua:33: in main chunk
	[C]: in function 'dofile'
	...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00406460
rm: cannot remove '/tmp/': Is a directory
The face detector failed to find your face.

I have tried doing this even without modifying anything before committing, it always fails with this error.

Any help would be much appreciated.

Unable to run file

So, I've installed the Docker and followed all of the steps mentioned and even asked a programmer friend for me, but the container keeps exiting without any prompt and no visible effect.

From what I gather, the docker cannot find a folder with the file which is on my c: drive.

this is the thing I'm getting as a result:

ls: cannot access /data: No such file or directory
Please wait. Your image is being processed.
convert: no images defined `/tmp//' @ error/convert.c/ConvertImageCommand/3235.
Initialising python libs...
Initialising detector...
/root/usr/local/torch/install/bin/luajit: /root/usr/local/torch/install/share/lua/5.1/dok/inline.lua:738: <image.load> unable to determine image type for file: /tmp//
stack traceback:
[C]: in function 'error'
/root/usr/local/torch/install/share/lua/5.1/dok/inline.lua:738: in function 'error'
/root/usr/local/torch/install/share/lua/5.1/image/init.lua:390: in function 'load'
main.lua:33: in main chunk
[C]: in function 'dofile'
...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406460
rm: cannot remove '/tmp/': Is a directory
The face detector failed to find your face.

cannot remove '/tmp//turing.jpg'

I am on the latest version of Ubuntu (21).

I pulled the pre-built docker image:

sudo docker pull asjackson/vrn:latest

I ran it using:

docker run -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/turing.jpg

Unfortunately I am getting this error:

Please wait. Your image is being processed.
convert: unable to open image `/data/turing.jpg': No such file or directory @ error/blob.c/OpenBlob/2882.
convert: no images defined `/tmp//turing.jpg' @ error/convert.c/ConvertImageCommand/3235.
Initialising python libs...	
Initialising detector...	
/root/usr/local/torch/install/bin/luajit: /root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: /tmp//turing.jpg: No such file or directory
stack traceback:
	[C]: in function 'error'
	/root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: in function 'load'
	main.lua:33: in main chunk
	[C]: in function 'dofile'
	...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00406460
rm: cannot remove '/tmp//turing.jpg': No such file or directory
The face detector failed to find your face.

Output questions?

Can't seem to find the files out of docker, not sure what directory these files goes to from docker.

more resolution

Hi Aaron,

Thanks for this sweet code .

i am using it with docker desktop. Output is always has the same resolution no matter how the input image is big. will there be any update about this ?

Voxel-fied Output

I tested the docker version right now with a bunch of images and all of their .obj files are getting voxel-fied (block-like).

Is there a known fix for this?

Option to set the detail level?

It works much better than Depth Maps based on shading to create a relief from a photo. The resultant OBJ has the correct depth map for the face but the detail produced is very low due to the large layer heights and resolution. Would it be possible to have an option to increase the detail?
Thanks
Nathan

Failure to detect image as 8-bit

I have two images, pic.png and pic2.png. Both are 8-bit images. However, vrn-docker only recognizes pic2.png as 8-bit.

jared@Vivobook-S15:~$ docker run -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/pic.png
data
pic.png
pic2.png
Please wait. Your image is being processed.
Initialising python libs...
Initialising detector...
    2
 1920
 1920
[torch.LongStorage of size 3]

/root/usr/local/torch/install/bin/luajit: ./facedetection_dlib.lua:22: Python error: opaque ref: call
RuntimeError: Unsupported image type, must be 8bit gray or RGB image.

stack traceback:
        [C]: in function 'detector'
        ./facedetection_dlib.lua:22: in function 'detect'
        main.lua:42: in main chunk
        [C]: in function 'dofile'
        ...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x00406460
The face detector failed to find your face.
jared@Vivobook-S15:~$ docker run -v $PWD/data:/data:Z asjackson/vrn /runner/run.sh /data/pic2.png
data
pic.png
pic2.png
Please wait. Your image is being processed.
Initialising python libs...
Initialising detector...
   3
 500
 500
[torch.LongStorage of size 3]

The face detector failed to find your face.
jared@Vivobook-S15:~$ file data/pic.png
data/pic.png: PNG image data, 1920 x 1920, 8-bit colormap, non-interlaced
jared@Vivobook-S15:~$ file data/pic2.png
data/pic2.png: PNG image data, 500 x 500, 8-bit colormap, non-interlaced

pic.png
pic2.png

Large Pose 3D Face Reconstruction from a Single Image - file exe ??

Hello, I have used your "Large Pose 3D Face Reconstruction from a Single Image" program to great benefit.
Now I would like to download it to my PC but I have serious difficulties because I have no technical skills. There is no exe file for your program?
Thank You very much. Best regards. Silvia (Milan, Italy)

Large Pose 3D Face Reconstruction from a Single Image

Hello everyone, I wanted to tell you my vicissitudes in trying to install the "Pose 3D Face Reconstruction" program on my PC that uses "Windows 10"
A sister of mine tried and this is what she wrote to me: "The program in question is a version that can only be run on a virtual container system running on Linux. At this point I raise my hands and give up. Not I can start installing Linux and then fumble about installing Docker and then move on to figuring out how to make the program work. It's way too much "
... and so I'm without the program I loved so much.
Is there really no simpler system ????
(Thanks everyone for your attention) Silvia

I cannot change this sample image

Hello! First of all, thank you for this great job.
I have successfully run the docker version with ‘git clone ...’ and ‘turning.jpg’.
But the problem I encountered is that it seems that I can only successfully run the example named 'turning.jpg'. (Other names will report an error, and other images with this name can also run).
Another question is: If the non-smooth is caused by python, is there any other platform code that can be provided? (Hope to achieve the effect of the website demo)

The report of the first problem:
docker run -v $PWD/data:/data:Z vrn /runner/run.sh /data/35.jpg
35.jpg ********This file is here
turing.jpg
turing.jpg.obj
Please wait. Your image is being processed.
convert: Empty input file /data/35.jpg' @ error/jpeg.c/JPEGErrorHandler/338. convert: no images defined /tmp//35.jpg' @ error/convert.c/ConvertImageCommand/3235.
Initialising python libs...
Initialising detector...
/root/usr/local/torch/install/bin/luajit: /root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: /tmp//35.jpg: No such file or directory
stack traceback:
[C]: in function 'error'
/root/usr/local/torch/install/share/lua/5.1/image/init.lua:367: in function 'load'
main.lua:33: in main chunk
[C]: in function 'dofile'
...ocal/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406460
rm: cannot remove '/tmp//35.jpg': No such file or directory
The face detector failed to find your face.

Cant find the file on Docker hub?

Hey, im new to the whole social codework thing, but i managed to get CorentinJ /
Real-Time-Voice-Cloning working, somewhat, so i know a little bit of the calls and runs (i guess), i'm trying to find the link to it on docker, but i cant, i don't know what i'm doing there, real talk..

The command to run the container

I am very new to Docker so it might be my mistake but the line you provided to run the Docker container did not work for me.

The original line was:

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

I had to:

  1. change the paranthesis into curly brackets
  2. change the colon symbol ":" to slash "/"

This is the command that worked for me:
docker run -v ${pwd}/data:/data:Z asjackson/vrn /runner/run.sh /data/turing.jpg

And thank you very much for sharing your work and the Docker container.

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.