ajaichemmanam / simple_bodypix_python

A simple and minimal bodypix inference in python
76 stars 19 forks source link

Some dependencies are obsolete or missing #6

Closed RazZziel closed 4 years ago

RazZziel commented 4 years ago

The project doesn't work out of the box because some dependencies are obsolete or missing:

raziel@Bebop ~/dev/fakecam/fakecam/simple_bodypix_python:master $ virtualenv .venv
raziel@Bebop ~/dev/fakecam/fakecam/simple_bodypix_python:master $ .venv/bin/pip install -r requirements.txt 
ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.2 (from -r requirements.txt (line 1)) (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0)
ERROR: No matching distribution found for tensorflow==1.15.2 (from -r requirements.txt (line 1))
ERROR: Could not find a version that satisfies the requirement tensorflow-cpu==2.1.0 (from tensorflowjs==1.7.4->-r requirements.txt (line 2)) (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0)
ERROR: No matching distribution found for tensorflow-cpu==2.1.0 (from tensorflowjs==1.7.4->-r requirements.txt (line 2))
raziel@Bebop ~/dev/fakecam/fakecam/simple_bodypix_python:master $ .venv/bin/python evalbody_singleposemodel.py
Traceback (most recent call last):
  File "evalbody_singleposemodel.py", line 1, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'
raziel@Bebop ~/dev/fakecam/fakecam/simple_bodypix_python:master $ .venv/bin/python evalbody_singleposemodel.py
Traceback (most recent call last):
  File "evalbody_singleposemodel.py", line 2, in <module>
    import tfjs_graph_converter as tfjs
ModuleNotFoundError: No module named 'tfjs_graph_converter'
raziel@Bebop ~/dev/fakecam/fakecam/simple_bodypix_python:master $ .venv/bin/python evalbody_singleposemodel.py
Loading model...Traceback (most recent call last):
  File "evalbody_singleposemodel.py", line 72, in <module>
    graph = tfjs.api.load_graph_model(modelPath)  # downloaded from the link above
AttributeError: module 'tfjs_graph_converter' has no attribute 'api'

This change fixed the issue for me:

diff --git a/requirements.txt b/requirements.txt
index cd1746e..76b3ec8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,6 @@
-tensorflow==1.15.2
-tensorflowjs==1.7.4
+tensorflow
+tensorflowjs
 numpy==1.18.3
-matplotlib==3.2.1
\ No newline at end of file
+matplotlib==3.2.1
+pillow
+tfjs_graph_converter
diff --git a/evalbody_singleposemodel.py b/evalbody_singleposemodel.py
index ee3859b..fbb4e6b 100644
--- a/evalbody_singleposemodel.py
+++ b/evalbody_singleposemodel.py
@@ -1,5 +1,6 @@
 from PIL import Image
 import tfjs_graph_converter as tfjs
+import tfjs_graph_converter.api as tfjs_api
 import tensorflow as tf
 import math
 import matplotlib.patches as patches
@@ -67,7 +69,7 @@ PART_CHANNELS = [

 print("Loading model...", end="")
-graph = tfjs.api.load_graph_model(modelPath)  # downloaded from the link above
+graph = tfjs_api.load_graph_model(modelPath)  # downloaded from the link above
 print("done.\nLoading sample image...", end="")
ajaichemmanam commented 4 years ago

It seems there are some issues with your environment setup. Tensorflow 1.15.2 is possible to install in normal cases. Also it has been specified in other issues that the project can work in both tf version 1.x and 2.x. The requirements specified was the tested dependencies of the project.

tfjs_graph_converter dependency was removed due to compatibility problems. Incase you need, It is recommeded to install it from https://github.com/ajaichemmanam/tfjs-to-tf.

Thank you.

RazZziel commented 4 years ago

Tensorflow 1.15.2 is possible to install in normal cases

https://pypi.org/project/tensorflow/1.15.2/ specifies that the package is compatible from Python 2.7 to Python 3.7, while https://pypi.org/project/tensorflow/2.2.0/ specifies the package is compatible from Python 3.5 to Python 3.8. My system has Python 3.8.2, so it's not compatible with Tensorflow 1.15.2.

tfjs_graph_converter dependency was removed due to compatibility problems. It is recommeded to install it from https://github.com/ajaichemmanam/tfjs-to-tf

The version installed from pip seems to work fine on my setup, but anyway if that's the case it would be cool to have it specified in the README.md

ajaichemmanam commented 4 years ago

Please use the updated code from the repo. The tfjs_graph_converter dependency was removed before.