hourglasstensorflow
hourglasstensorflow copied to clipboard
How to test on a single image?
Hi,
I downloaded the regular hourglass (80 conv layers) pre-trained model and tried to test on a single image. However, the result turned out to be incorrect. I am not sure whether I have used API correctly, so could anyone take a look?
import os
from inference import Inference
from train_launcher import process_config
from hourglass_tiny import HourglassModel
from datagen import DataGenerator
import numpy as np
import tensorflow as tf
import cv2
RED = (0, 0, 255)
def show_prections(img, predictions):
i = 0
for coord in predictions:
i += 1
keypt = (int(coord[0]), int(coord[1]))
text_loc = (keypt[0]+5, keypt[1]+7)
cv2.circle(img, keypt, 3, RED, -1)
cv2.putText(img, str(i), text_loc, cv2.FONT_HERSHEY_DUPLEX, 0.5, RED, 1, cv2.LINE_AA)
cv2.imshow('img', img)
cv2.waitKey(0)
if __name__ == '__main__':
print('--Parsing Config File')
params = process_config('config.cfg')
img = cv2.imread(os.path.join(params['img_directory'], '005808361.jpg'))
# the bounding boxes used below are ground truth from dataset.txt
img1 = np.copy(img)[80:711, 798:1167]
img2 = np.copy(img)[66:651, 310:721]
test_img = cv2.resize(img2, (256, 256))
model = Inference()
predictions = model.predictJoints(test_img, mode='gpu')
show_prections(test_img, predictions)
In what way are the results incorrect? Do you have an image or some results you can share?
Hi~
@wbenbihi
Could u please show me a simple example for testing a single image?
Like how to utilize your API? plt_skeleton() .etc.
: )
I think I understand why your results are incorrect. I tried your code, it works fine excepts it uses BGR images in the network whereas it was trained on RGB images.
You should add the following before running it :
test_img = cv2.cvtColor(test_img, cv2.COLOR_BGR2RGB)
PS: I also spotted another thing to change, on the show_predictions function you should invert the keypt indices
keypt = (int(coord[1]), int(coord[0]))
OpenCV takes (y,x) coordinates and not (x,y)
Hi I have follow @o0t1ng0o steps. And down load the pretained model(refined and tiny). I have I convert the test_img and key point. But it seems still a wrong result. Can this model can detect all the joint? `
import os from inference import Inference from train_launcher import process_config from hourglass_tiny import HourglassModel from datagen import DataGenerator import numpy as np import tensorflow as tf import cv2
RED = (0, 0, 255)
if name == 'main': print('--Parsing Config File') params = process_config('config.cfg') model = Inference()
img = cv2.imread(os.path.join('000003072.jpg')) # the bounding boxes used below are ground truth from dataset.txt img1 = np.copy(img)[132:538, 639:850] img2 = np.copy(img)[82:565, 367:487] test_img = cv2.resize(img2, (256, 256)) #test_img = cv2.cvtColor(test_img, cv2.COLOR_RGB2BGR)
def show_prections(img, predictions): i = 0 for coord in predictions: i += 1 keypt = (int(coord[1]), int(coord[0])) print(keypt) text_loc = (keypt[0]+5, keypt[1]+7) cv2.circle(img, keypt, 3, RED, -1) cv2.putText(img, str(i), text_loc, cv2.FONT_HERSHEY_DUPLEX, 0.5, RED, 1) cv2.imshow('img', img) cv2.waitKey(0) cv2.destroyAllWindows() cam.release()
predictions = model.predictJoints(test_img, mode='gpu') show_prections(test_img, predictions) ` The joints output are (204, 184) (112, 152) (120, 204) (116, 204) (112, 136) (212, 184) (152, 192) (240, 40) (236, 40) (208, 40) (204, 184) (240, 44) (240, 40) (240, 40) (116, 100) (212, 188)
I was able to test the model on a single image but the results I am getting are inaccurate. Can you please help me with this?
Your help will be highly appreciated.
@GajjarMihir Hi, i have figure out that why the transform.rotate(img, r_angle, preserve_range = True) get errors. The reason is the version of skimage(sickit image). It seems only high version sickit image (v1.3) support this.
In the predictHM.(line 125 in inference.py) Your original code is return self.predict.pred(self, img / 255, debug = False, sess = None) In my python. img/255 will cause data lost. So i cannot get the right prediction. For example 1/255 = 0 so all the similar function i have changed to return self.predict.pred((img.astype(np.float32) / 255), debug = False, sess = None) and then get right result.
I have noticed that many people in isses6 meet this problem. Because the data lost.
You can change your data type in the predict file. I think in some python version img/255 will cause data lost. so you have to change the ((img.astype(np.float32) / 255), for example. Hope to help u
Thank you @Crazod. I changed the things you mentioned but the results were still the same. The results are inaccurate. Thank you for helping me. Are you getting accurate results?
@Crazod Running you code I get the following error:
[jalal@goku hourglasstensorlfow]$ /scratch/sjn/anaconda/bin/python test.py
/scratch/sjn/anaconda/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
CREATE MODEL:
---Inputs : Done (0 sec.)
---Graph : Done (2 sec.)
---Loss : Done (0 sec.)
WARNING:tensorflow:From /scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py:625: arg_max (from tensorflow.python.ops.gen_math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `argmax` instead
---Acc : Done (1 sec.)
---LR : Done (0 sec.)
---Optim : Done (0 sec.)
---Minimizer : Done (4 sec.)
---Init : Done (0 sec.)
Model created (8 sec.)
Graph Generated in 8 sec.
Session initialization
2018-03-25 04:33:44.382615: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Sess initialized in 0 sec.
Loading Trained Model
Traceback (most recent call last):
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call
return fn(*args)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1320, in _run_fn
self._extend_graph()
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1381, in _extend_graph
self._session, graph_def.SerializeToString(), status)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 14, in <module>
model = Inference()
File "/scratch2/body_pose/hourglasstensorlfow/inference.py", line 74, in __init__
self.predict.load_model(load = model)
File "/scratch2/body_pose/hourglasstensorlfow/predictClass.py", line 163, in load_model
self.HG.restore(load)
File "/scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py", line 215, in restore
self.saver.restore(self.Session, load)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1686, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
feed_dict_tensor, options, run_metadata)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run
options, run_metadata)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
Caused by op 'model/stacks/stage_3/out/weights/RMSProp_1', defined at:
File "test.py", line 14, in <module>
model = Inference()
File "/scratch2/body_pose/hourglasstensorlfow/inference.py", line 73, in __init__
self.predict.model_init()
File "/scratch2/body_pose/hourglasstensorlfow/predictClass.py", line 154, in model_init
self.HG.generate_model()
File "/scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py", line 182, in generate_model
self.train_rmsprop = self.rmsprop.minimize(self.loss, self.train_step)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 365, in minimize
name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 516, in apply_gradients
self._create_slots([_get_variable_for(v) for v in var_list])
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/rmsprop.py", line 113, in _create_slots
self._zeros_slot(v, "momentum", self._name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 883, in _zeros_slot
named_slots[_var_key(var)] = slot_creator.create_zeros_slot(var, op_name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 174, in create_zeros_slot
colocate_with_primary=colocate_with_primary)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 148, in create_slot_with_initializer
dtype)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 67, in _create_slot_var
validate_shape=validate_shape)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1262, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1097, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 435, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 404, in _true_getter
use_resource=use_resource, constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 806, in _get_single_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 229, in __init__
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 329, in _init_from_args
name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 133, in variable_op_v2
shared_name=shared_name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 1061, in _variable_v2
shared_name=shared_name, name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op
op_def=op_def)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
[jalal@goku hourglasstensorlfow]$
Code:
import os
from inference import Inference
from train_launcher import process_config
from hourglass_tiny import HourglassModel
from datagen import DataGenerator
import numpy as np
import tensorflow as tf
import cv2
RED = (0, 0, 255)
params = process_config('config.cfg')
model = Inference()
img = cv2.imread(os.path.join('000003072.jpg'))
# the bounding boxes used below are ground truth from dataset.txt
img1 = np.copy(img)[132:538, 639:850]
img2 = np.copy(img)[82:565, 367:487]
test_img = cv2.resize(img2, (256, 256))
#test_img = cv2.cvtColor(test_img, cv2.COLOR_RGB2BGR)
def show_prections(img, predictions):
i = 0
for coord in predictions:
i += 1
keypt = (int(coord[1]), int(coord[0]))
print(keypt)
text_loc = (keypt[0]+5, keypt[1]+7)
cv2.circle(img, keypt, 3, RED, -1)
cv2.putText(img, str(i), text_loc, cv2.FONT_HERSHEY_DUPLEX, 0.5, RED, 1)
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
cam.release()
predictions = model.predictJoints(test_img, mode='gpu')
show_prections(test_img, predictions)
How should I fix it?
@yolandawww running your code I get this error. Do you know how can I fix it?
[jalal@goku hourglasstensorlfow]$ /scratch/sjn/anaconda/bin/python another_test.py
/scratch/sjn/anaconda/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
--Parsing Config File
CREATE MODEL:
---Inputs : Done (0 sec.)
---Graph : Done (2 sec.)
---Loss : Done (0 sec.)
WARNING:tensorflow:From /scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py:625: arg_max (from tensorflow.python.ops.gen_math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `argmax` instead
---Acc : Done (1 sec.)
---LR : Done (0 sec.)
---Optim : Done (0 sec.)
---Minimizer : Done (4 sec.)
---Init : Done (0 sec.)
Model created (8 sec.)
Graph Generated in 8 sec.
Session initialization
2018-03-25 04:43:58.167594: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Sess initialized in 0 sec.
Loading Trained Model
Traceback (most recent call last):
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call
return fn(*args)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1320, in _run_fn
self._extend_graph()
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1381, in _extend_graph
self._session, graph_def.SerializeToString(), status)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "another_test.py", line 33, in <module>
model = Inference()
File "/scratch2/body_pose/hourglasstensorlfow/inference.py", line 74, in __init__
self.predict.load_model(load = model)
File "/scratch2/body_pose/hourglasstensorlfow/predictClass.py", line 163, in load_model
self.HG.restore(load)
File "/scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py", line 215, in restore
self.saver.restore(self.Session, load)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1686, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
feed_dict_tensor, options, run_metadata)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run
options, run_metadata)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
Caused by op 'model/stacks/stage_3/out/weights/RMSProp_1', defined at:
File "another_test.py", line 33, in <module>
model = Inference()
File "/scratch2/body_pose/hourglasstensorlfow/inference.py", line 73, in __init__
self.predict.model_init()
File "/scratch2/body_pose/hourglasstensorlfow/predictClass.py", line 154, in model_init
self.HG.generate_model()
File "/scratch2/body_pose/hourglasstensorlfow/hourglass_tiny.py", line 182, in generate_model
self.train_rmsprop = self.rmsprop.minimize(self.loss, self.train_step)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 365, in minimize
name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 516, in apply_gradients
self._create_slots([_get_variable_for(v) for v in var_list])
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/rmsprop.py", line 113, in _create_slots
self._zeros_slot(v, "momentum", self._name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 883, in _zeros_slot
named_slots[_var_key(var)] = slot_creator.create_zeros_slot(var, op_name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 174, in create_zeros_slot
colocate_with_primary=colocate_with_primary)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 148, in create_slot_with_initializer
dtype)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/training/slot_creator.py", line 67, in _create_slot_var
validate_shape=validate_shape)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1262, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1097, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 435, in get_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 404, in _true_getter
use_resource=use_resource, constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 806, in _get_single_variable
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 229, in __init__
constraint=constraint)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 329, in _init_from_args
name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 133, in variable_op_v2
shared_name=shared_name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 1061, in _variable_v2
shared_name=shared_name, name=name)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op
op_def=op_def)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'model/stacks/stage_3/out/weights/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: model/stacks/stage_3/out/weights/RMSProp_1 = VariableV2[_class=["loc:@model/stacks/stage_3/out/weights"], container="", dtype=DT_FLOAT, shape=[1,1,256,16], shared_name="", _device="/device:GPU:0"]()]]
code is:
import os
from inference import Inference
from train_launcher import process_config
from hourglass_tiny import HourglassModel
from datagen import DataGenerator
import numpy as np
import tensorflow as tf
import cv2
RED = (0, 0, 255)
def show_prections(img, predictions):
i = 0
for coord in predictions:
i += 1
keypt = (int(coord[0]), int(coord[1]))
text_loc = (keypt[0]+5, keypt[1]+7)
cv2.circle(img, keypt, 3, RED, -1)
cv2.putText(img, str(i), text_loc, cv2.FONT_HERSHEY_DUPLEX, 0.5, RED, 1, cv2.LINE_AA)
cv2.imshow('img', img)
cv2.waitKey(0)
print('--Parsing Config File')
params = process_config('config.cfg')
img = cv2.imread('005808361.jpg')
# the bounding boxes used below are ground truth from dataset.txt
img1 = np.copy(img)[80:711, 798:1167]
img2 = np.copy(img)[66:651, 310:721]
test_img = cv2.resize(img2, (256, 256))
model = Inference()
predictions = model.predictJoints(test_img, mode='gpu')
show_prections(test_img, predictions)
you can just change the predictClass.py hpeWebcam function,you give an image param ,you don't need to process the image.then you can test on a single image.
I get this error. Do you know how can I fix it? NotFoundError (see above for traceback): Key BatchNorm_100/moving_mean not found in checkpoint
Hi @Mashiandmaro ! Were you able to solve this error?
same issue , did you find any solution @Mashiandmaro ?