Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukin0110 committed Nov 23, 2017
1 parent 953dcd9 commit f78383f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 24 deletions.
72 changes: 50 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
# Human 2D images to 3D models

Docker image inspired by http://files.is.tuebingen.mpg.de/classner/up/.
Project to put the [Unite the People](http://files.is.tuebingen.mpg.de/classner/up/)
project in a Docker image. The project contains 2 docker images because the
*pose* and *segmentation* scripts require different environments.

## Setup
* **up_caffe**: run the pose prediction with the *p91* model
* **up_deeplab**: run the segmentation script with the *s31* model

## Usage

When you `run` the containers you need to mount a local folder which contains
the source images that you want to use for pose predictions and segmentations.

### 1. Download

```
$ docker pull lukin0110/up_caffe
$ docker pull lukin0110/up_deeplab
```
### 2. Execute pose prediction

```
$ docker run -it -v "$(pwd)"/input:/input lukin0110/up_caffe pose input/debruyne1.jpg
```

### 3. Execute bodyfit

```
$ docker run -it -v "$(pwd)"/input:/input lukin0110/up_caffe bodyfit input/debruyne1.jpg
```

### 4. Execute segmentation

It's required to use [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker) to
run the segmentation since CUDA is being used.

```
$ nvidia-docker run -it -v "$(pwd)"/input:/input lukin0110/up_deeplab segmentation input/debruyne1.jpg
```

## Setup from source

Before you execute the script: download **SMPL_python_v.1.0.0.zip**
from http://smpl.is.tue.mpg.de/ and put it in the ./models folder. You need an
Expand All @@ -15,41 +52,32 @@ account to download the package.
Build image:
```
$ docker-compose build
or
$ docker build . -t demo
```

Generate pose prediction:
```
$ docker-compose run demo pose input/debruyne1.jpg
or
$ docker run -it -v "$(pwd)"/input:/input demo bodyfit input/debruyne1.jpg
$ docker-compose run caffe pose input/debruyne1.jpg
```

This will generate `.npz` and `.png` files in the `input` folder.

Generate 3D body:
```
$ docker-compose run demo pose input/debruyne1.jpg
or
$ docker run -it -v "$(pwd)"/input:/input demo bodyfit input/debruyne1.jpg
$ docker-compose run caffe bodyfit input/debruyne1.jpg
```

## Using nvidia-docker-compose
Generate segmentation:
```
pip install nvidia-docker-compose
# nvidia-docker-compose binary may not be in your path. On ubuntu, for my installation, it installed to /home/edward/.local/bin/. An Anaconda installation will have binaries in anaconda/bin.
nvidia-docker-compose build
$ nvidia-docker-compose run deeplab segmentation input/debruyne1.jpg
```

Generate body fit:
```
# Download SMPL_python_v.1.0.0.zip and place in the models directory of this repo on the docker host
nvidia-docker-compose build
nvidia-docker-compose run demo bodyfit /input/zuck1.jpg
```
Install nvidia docker compose if it is not present yet: `pip install nvidia-docker-compose`.

## Push to docker hub

Generate segmentation:
```
$ nvidia-docker run -it -v "$(pwd)"/input:/input dl segmentation input/debruyne1.jpg
$ docker tag demo2d3d_caffe:latest lukin0110/up_caffe:latest
$ docker tag demo2d3d_deeplab:latest lukin0110/up_deeplab:latest
$ docker push lukin0110/up_caffe:latest
$ docker push lukin0110/up_deeplab:latest
```
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3'

services:
demo:
caffe:
build: .
volumes:
- ./input:/input

dl:
deeplab:
build:
context: .
dockerfile: Dockerfile.deeplabv2
Expand Down

0 comments on commit f78383f

Please sign in to comment.