Skip to content

Commit

Permalink
Add getting started and remove sys path to load module
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hertwig-mw committed Jan 30, 2020
1 parent dac6b08 commit b6bc713
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 11 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ If anybody wants a pure python wrapper, please refer to my [pytorch implementati

Don't be mean to star this repo if it helps your research.

### Model Download
### Getting Started

Create a python 3.7 environement, eg:

conda create -n pytorch-openpose python=3.7

Install pytorch by following the quick start guide here (use pip) https://download.pytorch.org/whl/torch_stable.html

Install other requirements with pip

pip install -r requirements.txt

#### Model Download
* [dropbox](https://www.dropbox.com/sh/7xbup2qsn7vvjxo/AABWFksdlgOMXR_r5v3RwKRYa?dl=0)

`*.pth` files are pytorch model, you could also download caffemodel file if you want to use caffe as backend.

Download the pytorch models and put them in a directory named `model` in the project root directory

### Todo list
- [x] convert caffemodel to pytorch.
- [x] Body Pose Estimation.
Expand Down
14 changes: 8 additions & 6 deletions demo_camera.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import sys
sys.path.insert(0, 'python')
import cv2
import model
import util
from hand import Hand
from body import Body
import matplotlib.pyplot as plt
import copy
import numpy as np
import torch

from python import model
from python import util
from python.body import Body
from python.hand import Hand

body_estimation = Body('model/body_pose_model.pth')
hand_estimation = Hand('model/hand_pose_model.pth')

print(f"Torch device: {torch.cuda.get_device_name()}")

cap = cv2.VideoCapture(0)
cap.set(3, 640)
cap.set(4, 480)
Expand Down
Empty file added model/.gitkeep
Empty file.
Empty file added python/__init__.py
Empty file.
5 changes: 3 additions & 2 deletions python/body.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import cv2
import numpy as np
import util
import math
import time
from scipy.ndimage.filters import gaussian_filter
import matplotlib.pyplot as plt
import matplotlib
from model import bodypose_model
import torch
from torchvision import transforms

from python import util
from python.model import bodypose_model

class Body(object):
def __init__(self, model_path):
self.model = bodypose_model()
Expand Down
5 changes: 3 additions & 2 deletions python/hand.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import cv2
import json
import numpy as np
import util
import math
import time
from scipy.ndimage.filters import gaussian_filter
import matplotlib.pyplot as plt
import matplotlib
from model import handpose_model
import torch
from skimage.measure import label

from python.model import handpose_model
from python import util

class Hand(object):
def __init__(self, model_path):
self.model = handpose_model()
Expand Down
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
numpy
matplotlib
opencv-python
scipy
scikit-image
tqdm

0 comments on commit b6bc713

Please sign in to comment.