Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jtthompson1887/posenet-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: kaitolucifer/posenet-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 15, 2022

  1. Copy the full SHA
    73db2ab View commit details
  2. Copy the full SHA
    9b97dbf View commit details
  3. Update README.md

    kaitolucifer authored Nov 15, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    af8e374 View commit details
  4. Copy the full SHA
    9a097c1 View commit details
Showing with 20 additions and 100 deletions.
  1. +15 −19 README.md
  2. +0 −80 environment.yml
  3. +1 −1 posenet/converter/config.py
  4. +4 −0 requirements.txt
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,27 +5,23 @@ This repository contains a pure Python implementation (multi-pose only) of the G
I first adapted the JS code more or less verbatim and found the performance was low so made some vectorized numpy/scipy version of a few key functions (named `_fast`).

Further optimization is possible
* The base MobileNet models have a throughput of 200-300 fps on a GTX 1080 Ti (or better)
* The multi-pose post processing code brings this rate down significantly. With a fast CPU and a GTX 1080+:
* A literal translation of the JS post processing code dropped performance to approx 30fps
* My 'fast' post processing results in 90-110fps
* A Cython or pure C++ port would be even better...

- The base MobileNet models have a throughput of 200-300 fps on a GTX 1080 Ti (or better)
- The multi-pose post processing code brings this rate down significantly. With a fast CPU and a GTX 1080+:
- A literal translation of the JS post processing code dropped performance to approx 30fps
- My 'fast' post processing results in 90-110fps
- A Cython or pure C++ port would be even better...

### Install

A suitable Python 3.x environment with a recent version of Tensorflow is required.

Development and testing was done with Conda Python 3.6.8 and Tensorflow 1.12.0 on Linux.

Windows 10 with the latest (as of 2019-01-19) 64-bit Python 3.7 Anaconda installer was also tested.
Development and testing was done with Python 3.9.13 and Tensorflow 2.10.0 on Linux and Mac OS(Apple Silicon).

If you want to use the webcam demo, a pip version of opencv (`pip install opencv-python`) is required instead of the conda version. Anaconda's default opencv does not include ffpmeg/VideoCapture support. Also, you may have to force install version 3.4.x as 4.x has a broken drawKeypoints binding.
A environment setup as below should suffice:

A conda environment setup as below should suffice:
```
conda install tensorflow-gpu scipy pyyaml python=3.6
pip install opencv-python==3.4.5.20
pip install -r requirements.txt
```

### Usage
@@ -36,7 +32,7 @@ The first time these apps are run (or the library is used) model weights will be

For all demos, the model can be specified with the '--model` argument by using its ordinal id (0-3) or integer depth multiplier (50, 75, 100, 101). The default is the 101 model.

#### image_demo.py
#### image_demo.py

Image demo runs inference on an input folder of images and outputs those images with the keypoints and skeleton overlayed.

@@ -61,9 +57,9 @@ This port and my work is in no way related to Google.
The Python conversion code that started me on my way was adapted from the CoreML port at https://github.com/infocom-tpo/PoseNet-CoreML

### TODO (someday, maybe)
* More stringent verification of correctness against the original implementation
* Performance improvements (especially edge loops in 'decode.py')
* OpenGL rendering/drawing
* Comment interfaces, tensor dimensions, etc
* Implement batch inference for image_demo

- More stringent verification of correctness against the original implementation
- Performance improvements (especially edge loops in 'decode.py')
- OpenGL rendering/drawing
- Comment interfaces, tensor dimensions, etc
- Implement batch inference for image_demo
80 changes: 0 additions & 80 deletions environment.yml

This file was deleted.

2 changes: 1 addition & 1 deletion posenet/converter/config.py
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@

def load_config(config_name='config.yaml'):
cfg_f = open(os.path.join(BASE_DIR, config_name), "r+")
cfg = yaml.load(cfg_f)
cfg = yaml.safe_load(cfg_f)
return cfg
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tensorflow
scipy
pyyaml
opencv-python