Missing arguments?
staymillion opened this issue · comments
I run body demo well. but when I run demo_cpm_hand.py , I got this error:
Traceback (most recent call last):
File "demo_cpm_hand.py", line 430, in <module>
tf.app.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "demo_cpm_hand.py", line 106, in main
model = cpm_hand.CPM_Model(FLAGS.stages, FLAGS.joints + 1)
TypeError: __init__() missing 2 required positional arguments: 'stages' and 'joints'
I followed instruction and download model put weights file and did't change anything.
I'm using python 3.6 win10, tensorflow 1.7, opencv3
Could you try run_demo_hand_with_tracker.py ?
Yes,but I got error on run_demo_hand_with_tracker.py:
File "run_demo_hand_with_tracker.py", line 32, in main is_training=False) TypeError: __init__() got an unexpected keyword argument 'input_size'
I'm not familiar with python actually but I don't see there's need to reset this argument in config.py. Don't know where's going wrong.
me too. i get the same problem
import cpm_hand _slim instead of cpm_hand
-
First of all, I am trying to run without GPU so in demo_cpm_hand.py file I changed line 92 from
tf_device = '/gpu:0
' totf_device = '/cpu:0'
. Otherwise I got this error:
[[Node: stage_6/mid_conv7/biases = VariableV2[_class=["loc:@stage_6/mid_conv7/biases"], container="", dtype=DT_FLOAT, shape=[22], shared_name="", _device="/device:GPU:0"]()]]
-
If I do
import cpm_hand_slim
then I get this error:
weights = pickle.load(open(weight_file_path, 'rb'), encoding='latin1') TypeError: load() got an unexpected keyword argument 'encoding'
So after doing the first step which is editing in cpm_body_slim.py, line 122 to
weights = pickle.load(open(weight_file_path, 'rb'))
from
weights = pickle.load(open(weight_file_path, 'rb'), encoding='latin1')
Then I got the following error:
Traceback (most recent call last):
File "demo_cpm_hand.py", line 430, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "demo_cpm_hand.py", line 117, in main
model.load_weights_from_file(FLAGS.model_path, sess, False)
File "/Users/Moon/Desktop/convolutional-pose-machines-tensorflow/models/nets/cpm_hand_slim.py", line 128, in load_weights_from_file
conv_kernel = tf.get_variable('sub_stages/sub_conv' + str(layer) + '/kernel')
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1297, in get_variable
constraint=constraint)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1093, in get_variable
constraint=constraint)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 439, in get_variable
constraint=constraint)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 408, in _true_getter
use_resource=use_resource, constraint=constraint)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 765, in _get_single_variable
"reuse=tf.AUTO_REUSE in VarScope?" % name)
ValueError: Variable sub_stages/sub_conv1/kernel does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?
in cpm_hand_slim modify the load_weights_from_file function according to this
'/kernel' to '/weights' and '/bias' to '/biases'
Example
conv_kernel = tf.get_variable('sub_stages/sub_conv' + str(layer) + '/weights')
conv_bias = tf.get_variable('sub_stages/sub_conv' + str(layer) + '/biases')
Tell if you get success
Yeah I actually ended up doing that last night! It works but it can't really track the hands of Roger in the test picture. Not immediately and not even after 30 minutes of keeping the program running. Also, I ran it on a video and that just ended up not working at all. I closed the terminal window, but basically the error had to do something with screen width > 0 while trying to do a cv2.resize I think.
Also I thought the DEMO_TYPE argument is for giving any kind of pic or video input. It doesn't seem to be doing anything. The script just does with the default pic!
Basically it seems decently good at performing with the real time hand tracker even without a gpu, but with the demo_cpm_hand.py file it can't do anything!
screen width > 0 while trying to do a cv2.resize usually occurs when the program is not able to read the image. It is majorly a path problem . 'DEMO_TYPE' argument is not to be changed rather default_value='SINGLE' should be done for running on webcam.