diff --git a/.gitignore b/.gitignore
index c50674d..372a5d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,10 @@
*_bak.py
.cache/
+.egg-info
__pycache__/
build/
dist/
-smpl/native/models/*.pkl
+image.png
+smplpytorch/native/models/*.pkl
diff --git a/README.md b/README.md
index dcd5db1..1bf0d9f 100644
--- a/README.md
+++ b/README.md
@@ -7,18 +7,31 @@ It can be integrated into any architecture as a differentiable layer to predict
The code is adapted from the [manopth](https://github.com/hassony2/manopth) repository by [Yana Hasson](https://github.com/hassony2).
-
+
-## Setting up
-* Dependencies:
- * Install the dependencies listed in [environment.yml](environment.yml)
- * In an existing conda environment, `conda env update -f environment.yml`
- * In a new environment, `conda env create -f environment.yml`, will create a conda environment named `smplpytorch`
-* Download SMPL pickle files:
+## Setup
+
+### 1. The `smplpytorch` package
+* **Run without installing:** You will need to install the dependencies listed in [environment.yml](environment.yml):
+ * `conda env update -f environment.yml` in an existing environment, or
+ * `conda env create -f environment.yml`, for a new `smplpytorch` environment
+* **Install:** To import `SMPL_Layer` in another project with `from smplpytorch.pytorch.smpl_layer import SMPL_Layer` do one of the following.
+ * Option 1: This should automatically install the dependencies.
+ ``` bash
+ git clone https://github.com/gulvarol/smplpytorch.git
+ cd smplpytorch
+ pip install .
+ ```
+ * Option 2: You can install `smplpytorch` from [PyPI](https://pypi.org/project/smplpytorch/). Additionally, you might need to install [chumpy](https://github.com/hassony2/chumpy.git).
+ ``` bash
+ pip install smplpytorch
+ ```
+
+### 2. Download SMPL pickle files
* Download the models from the [SMPL website](http://smpl.is.tue.mpg.de/) by choosing "SMPL for Python users". Note that you need to comply with the [SMPL model license](http://smpl.is.tue.mpg.de/license_model).
- * Extract and copy the `models` folder into the `smpl/native/` folder.
+ * Extract and copy the `models` folder into the `smplpytorch/native/` folder (or set the `model_root` parameter accordingly).
## Demo
diff --git a/assets/image.png b/assets/image.png
new file mode 100644
index 0000000..c73c891
Binary files /dev/null and b/assets/image.png differ
diff --git a/demo.py b/demo.py
index 20252a6..f506974 100644
--- a/demo.py
+++ b/demo.py
@@ -1,6 +1,6 @@
import torch
-from smpl.pytorch.smpl_layer import SMPL_Layer
+from smplpytorch.pytorch.smpl_layer import SMPL_Layer
from display_utils import display_model
@@ -12,7 +12,7 @@ if __name__ == '__main__':
smpl_layer = SMPL_Layer(
center_idx=0,
gender='neutral',
- model_root='smpl/native/models')
+ model_root='smplpytorch/native/models')
# Generate random pose and shape parameters
pose_params = torch.rand(batch_size, 72) * 0.2
diff --git a/environment.yml b/environment.yml
index 92378e0..487c7ed 100644
--- a/environment.yml
+++ b/environment.yml
@@ -6,5 +6,6 @@ dependencies:
- matplotlib
- numpy
- pytorch
+ - pip
- pip:
- git+https://github.com/hassony2/chumpy.git
diff --git a/setup.py b/setup.py
index 39c965d..e0ced55 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
import setuptools
-
with open("README.md", "r") as fh:
long_description = fh.read()
@@ -12,7 +11,7 @@ REQUIREMENTS = [
"chumpy @ git+ssh://git@github.com/hassony2/chumpy"]
setuptools.setup(
- name="smpl-pytorch",
+ name="smplpytorch",
version="0.0.1",
author="Gul Varol",
author_email="gulvarols@gmail.com",
@@ -21,7 +20,7 @@ setuptools.setup(
description="SMPL human body layer for PyTorch is a differentiable PyTorch layer",
long_description=long_description,
long_description_content_type="text/markdown",
- url="https://github.com/gulvarol/smpl-pytorch",
+ url="https://github.com/gulvarol/smplpytorch",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
diff --git a/smpl/pytorch/__init__.py b/smpl/pytorch/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/smplpytorch/__init__.py b/smplpytorch/__init__.py
new file mode 100644
index 0000000..f3d4e53
--- /dev/null
+++ b/smplpytorch/__init__.py
@@ -0,0 +1 @@
+name = "smplpytorch"
diff --git a/smpl/__init__.py b/smplpytorch/native/__init__.py
similarity index 100%
rename from smpl/__init__.py
rename to smplpytorch/native/__init__.py
diff --git a/smpl/native/models/README.md b/smplpytorch/native/models/README.md
similarity index 100%
rename from smpl/native/models/README.md
rename to smplpytorch/native/models/README.md
diff --git a/smpl/native/__init__.py b/smplpytorch/native/webuser/__init__.py
similarity index 100%
rename from smpl/native/__init__.py
rename to smplpytorch/native/webuser/__init__.py
diff --git a/smpl/native/webuser/posemapper.py b/smplpytorch/native/webuser/posemapper.py
similarity index 100%
rename from smpl/native/webuser/posemapper.py
rename to smplpytorch/native/webuser/posemapper.py
diff --git a/smpl/native/webuser/serialization.py b/smplpytorch/native/webuser/serialization.py
similarity index 95%
rename from smpl/native/webuser/serialization.py
rename to smplpytorch/native/webuser/serialization.py
index a186430..9bf16ee 100644
--- a/smpl/native/webuser/serialization.py
+++ b/smplpytorch/native/webuser/serialization.py
@@ -3,7 +3,7 @@ def ready_arguments(fname_or_dict):
import pickle
import chumpy as ch
from chumpy.ch import MatVecMult
- from smpl.native.webuser.posemapper import posemap
+ from smplpytorch.native.webuser.posemapper import posemap
if not isinstance(fname_or_dict, dict):
dd = pickle.load(open(fname_or_dict, 'rb'), encoding='latin1')
diff --git a/smpl/native/webuser/__init__.py b/smplpytorch/pytorch/__init__.py
similarity index 100%
rename from smpl/native/webuser/__init__.py
rename to smplpytorch/pytorch/__init__.py
diff --git a/smpl/pytorch/rodrigues_layer.py b/smplpytorch/pytorch/rodrigues_layer.py
similarity index 100%
rename from smpl/pytorch/rodrigues_layer.py
rename to smplpytorch/pytorch/rodrigues_layer.py
diff --git a/smpl/pytorch/smpl_layer.py b/smplpytorch/pytorch/smpl_layer.py
similarity index 96%
rename from smpl/pytorch/smpl_layer.py
rename to smplpytorch/pytorch/smpl_layer.py
index 49b2b5b..5e74741 100644
--- a/smpl/pytorch/smpl_layer.py
+++ b/smplpytorch/pytorch/smpl_layer.py
@@ -4,9 +4,9 @@ import numpy as np
import torch
from torch.nn import Module
-from smpl.native.webuser.serialization import ready_arguments
-from smpl.pytorch import rodrigues_layer
-from smpl.pytorch.tensutils import (th_posemap_axisang, th_with_zeros, th_pack, make_list, subtract_flat_id)
+from smplpytorch.native.webuser.serialization import ready_arguments
+from smplpytorch.pytorch import rodrigues_layer
+from smplpytorch.pytorch.tensutils import (th_posemap_axisang, th_with_zeros, th_pack, make_list, subtract_flat_id)
class SMPL_Layer(Module):
diff --git a/smpl/pytorch/tensutils.py b/smplpytorch/pytorch/tensutils.py
similarity index 96%
rename from smpl/pytorch/tensutils.py
rename to smplpytorch/pytorch/tensutils.py
index 0082fc2..0d92ff7 100644
--- a/smpl/pytorch/tensutils.py
+++ b/smplpytorch/pytorch/tensutils.py
@@ -1,6 +1,6 @@
import torch
-from smpl.pytorch import rodrigues_layer
+from smplpytorch.pytorch import rodrigues_layer
def th_posemap_axisang(pose_vectors):