Depth Map generation from 2D image by Google AI

Japanese

߂

Please read these documents

Learning the Depths of Moving People by Watching Frozen People

MannequinChallenge

MannequinChallenge(Github)

We will install Google MannequinChallenge on Windows 10 64bit and introduce SPM to create the depth maps from 2D images.

Condition
1. Windows 10 64bit
2. CUDA compatible nVidia video card (I think we have an error if the video memory is small)
If does not work in your PC, Try this "Creating depth maps from 2D images using Google Colab"


1. Install Python
https://www.python.org/downloads/release/python-374/
Download and install "Windows x86-64 executable installer"







After install python, press 'python' in command prompt

After install python, press 'python' in command prompt for verification. Press 'Crtl + Z' for quitting python mode.


2. Install Visual Studio 2015 runtime version
Microsoft Visual C++ 2015 Redistributable Update 3

This is need for importing pytorch.

3. Install Pytorch
Visit Pytorch page to get pip command


Open command prompt as administrator,then press pip command as follows,
pip3 install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp37-cp37m-win_amd64.whl



Next step, input following pip command for installing torchvision
pip3 install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp37-cp37m-win_amd64.whl


Press 'python' in command prompt, then input 'import torch' for verification.
If you find an error, please search it with Google.
Press 'Crtl + Z' for quitting python mode.


4. Install "scikit-image","h5py","scipy"






5. Download following zip file, then extract in the root of C drive.
2dtodepth.zip
Attention) It does not operate except "c:/2dtodepth" folder.
I changed some code from the original file on Github.
-Changed to work on Windows
-Modified to work with SPM
-Create depth map of all files in source folder
-Hold the aspect ratio of input image
-Use the orientation tag of the EXIF image
-Specify the type of the depth map (white front / black front)
Etc


How to use
1. Put in your 2d images in 'c:/2dtodepth/infile'
2. Double click on 'c:/2dtodepth/prog/2dtodepth.bat' (batch file) for running scrit.
3. After script finish, you can find SBS(2D+Depth) images in 'c:/2dtodepth/outfile'.

The latest StereoPhoto Maker can load this script.
1. Open your 2D image as Single image.(Menu->File->Open Single Image...)
2. Menu->Edit->Depth map->Create depth map from Single Image(Google AI)
After script finish, SPM show Left(2D) Right(Depth map).