Metadata-Version: 2.4
Name: DWPoses
Version: 0.1.0
Summary: Lightweight whole-body pose estimator (coords only) refactored from IDEA-Research/DWPose
Author-email: yefllower <yefllowers@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/yefllower/dwpose
Project-URL: Issues, https://github.com/yefllower/dwpose/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.0
Requires-Dist: opencv-python
Requires-Dist: Pillow
Requires-Dist: numpy
Dynamic: license-file

# DWPose

> Lightweight whole-body pose estimator (coords only) refactored from IDEA-Research/DWPose

## Install

```bash
pip install dwposes
```

## Usage

```python
from PIL import Image
from DWPoses import DWposeDetector
model = DWposeDetector()
img = Image.open("path/to/image.png", return_img=True)
pose, imgout = model.predict(img)
# imgout is a PIL image with pose drawn on it
imgout.save("openpose.png")
# pose is a dictionary with keys [bodies, hands, faces, foot]
print(pose)
```

Alternatively, you can load with `cv2` and `numpy`:
```python
import cv2
img = cv2.imread("path/to/image.png")
pose, imgout = model.predict(img)
# imgout is a numpy array with pose drawn on it, BGR format
imgout = cv2.cvtColor(imgout, cv2.COLOR_BGR2RGB)
imgout = Image.fromarray(imgout)
imgout.save("openpose.png")
```


Alternatively, you can specify the model path to the file `yolox_l.onnx` and `dw-ll_ucoco_384.onnx`:
```python
model = DWposeDetector(det="path/to/yolox_l.onnx", pose="path/to/dw-ll_ucoco_384.onnx")
pose, imgOut = model(img, return_img=True)
if isinstance(imgOut, np.ndarray):
    imgOut = cv2.cvtColor(imgOut, cv2.COLOR_BGR2RGB)
    imgOut = Image.fromarray(imgOut)
imgOut.save("openpose.png")
print(pose)
```
