pose-tensorflow icon indicating copy to clipboard operation
pose-tensorflow copied to clipboard

How do you run test.py?

Open monajalal opened this issue 6 years ago • 2 comments

When I run test.py I get the following error:

[jalal@goku pose-tensorflow]$ TF_CUDNN_USE_AUTOTUNE=0 python test.py 
/scratch/sjn/anaconda/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
  return f(*args, **kwds)
/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
INFO:root:Config:
{'batch_size': 1,
 'crop': False,
 'crop_pad': 0,
 'dataset': '/path/to/dataset.mat',
 'dataset_type': 'mpii',
 'display_iters': 20,
 'fg_fraction': 0.25,
 'global_scale': 0.8452830189,
 'init_weights': '../../pretrained/resnet_v1_101.ckpt',
 'intermediate_supervision': True,
 'intermediate_supervision_layer': 12,
 'location_refinement': True,
 'locref_huber_loss': True,
 'locref_loss_weight': 0.05,
 'locref_stdev': 7.2801,
 'log_dir': 'log',
 'max_input_size': 850,
 'mean_pixel': [123.68, 116.779, 103.939],
 'mirror': True,
 'multi_step': [[0.005, 10000],
                [0.02, 430000],
                [0.002, 730000],
                [0.001, 1030000]],
 'net_type': 'resnet_101',
 'optimizer': 'sgd',
 'pairwise_huber_loss': True,
 'pairwise_loss_weight': 1.0,
 'pairwise_predict': False,
 'pairwise_stats_collect': False,
 'pairwise_stats_fn': 'pairwise_stats.mat',
 'pos_dist_thresh': 17,
 'regularize': False,
 'save_iters': 60000,
 'scale_jitter_lo': 0.85,
 'scale_jitter_up': 1.15,
 'scoremap_dir': 'test',
 'shuffle': True,
 'snapshot_prefix': 'snapshot',
 'sparse_graph': [],
 'stride': 8.0,
 'tensorflow_pairwise_order': True,
 'use_gt_segm': False,
 'video': False,
 'video_batch': False,
 'weigh_negatives': False,
 'weigh_only_present_joints': False,
 'weigh_part_predictions': False,
 'weight_decay': 0.0001}
Traceback (most recent call last):
  File "test.py", line 75, in <module>
    test_net(not args.novis, args.cache)
  File "test.py", line 20, in test_net
    dataset = create_dataset(cfg)
  File "/scratch2/body_pose/pose-tensorflow/dataset/factory.py", line 8, in create
    data = MPII(cfg)
  File "/scratch2/body_pose/pose-tensorflow/dataset/mpii.py", line 9, in __init__
    super().__init__(cfg)
  File "/scratch2/body_pose/pose-tensorflow/dataset/pose_dataset.py", line 89, in __init__
    self.data = self.load_dataset() if cfg.dataset else []
  File "/scratch2/body_pose/pose-tensorflow/dataset/pose_dataset.py", line 104, in load_dataset
    mlab = sio.loadmat(file_name)
  File "/scratch/sjn/anaconda/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 141, in loadmat
    MR, file_opened = mat_reader_factory(file_name, appendmat, **kwargs)
  File "/scratch/sjn/anaconda/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 64, in mat_reader_factory
    byte_stream, file_opened = _open_file(file_name, appendmat)
TypeError: 'NoneType' object is not iterable
[jalal@goku pose-tensorflow]$ grep pose_cfg config.py 
def load_config(filename = "models/mpii/train/pose_cfg.yaml"):
#def load_config(filename = "pose_cfg.yaml"):
[jalal@goku pose-tensorflow]$ 

according to https://stackoverflow.com/a/3887385/2414957 data in None.

So I ran it another time (I guess after I downloaded the resnet101 weights and modified the config.py to take the following pose_cfg.yaml available in models/mpii/train/pose_cfg.yaml

def load_config(filename = "models/mpii/train/pose_cfg.yaml"):
#def load_config(filename = "pose_cfg.yaml"):
    if 'POSE_PARAM_PATH' in os.environ:
        filename = os.environ['POSE_PARAM_PATH'] + '/' + filename
    return cfg_from_file(filename)

and then I got the following error:

[jalal@goku pose-tensorflow]$ TF_CUDNN_USE_AUTOTUNE=0 python test.py 
/scratch/sjn/anaconda/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
  return f(*args, **kwds)
/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
INFO:root:Config:
{'batch_size': 1,
 'crop': False,
 'crop_pad': 0,
 'dataset': '/scratch2/body_pose/pose-tensorflow/dataset/cropped/dataset.mat',
 'dataset_type': 'mpii',
 'display_iters': 20,
 'fg_fraction': 0.25,
 'global_scale': 0.8452830189,
 'init_weights': '../../pretrained/resnet_v1_101.ckpt',
 'intermediate_supervision': True,
 'intermediate_supervision_layer': 12,
 'location_refinement': True,
 'locref_huber_loss': True,
 'locref_loss_weight': 0.05,
 'locref_stdev': 7.2801,
 'log_dir': 'log',
 'max_input_size': 850,
 'mean_pixel': [123.68, 116.779, 103.939],
 'mirror': True,
 'multi_step': [[0.005, 10000],
                [0.02, 430000],
                [0.002, 730000],
                [0.001, 1030000]],
 'net_type': 'resnet_101',
 'optimizer': 'sgd',
 'pairwise_huber_loss': True,
 'pairwise_loss_weight': 1.0,
 'pairwise_predict': False,
 'pairwise_stats_collect': False,
 'pairwise_stats_fn': 'pairwise_stats.mat',
 'pos_dist_thresh': 17,
 'regularize': False,
 'save_iters': 60000,
 'scale_jitter_lo': 0.85,
 'scale_jitter_up': 1.15,
 'scoremap_dir': 'test',
 'shuffle': True,
 'snapshot_prefix': 'snapshot',
 'sparse_graph': [],
 'stride': 8.0,
 'tensorflow_pairwise_order': True,
 'use_gt_segm': False,
 'video': False,
 'video_batch': False,
 'weigh_negatives': False,
 'weigh_only_present_joints': False,
 'weigh_part_predictions': False,
 'weight_decay': 0.0001}
Traceback (most recent call last):
  File "test.py", line 75, in <module>
    test_net(not args.novis, args.cache)
  File "test.py", line 21, in test_net
    dataset.set_shuffle(False)
  File "/scratch2/body_pose/pose-tensorflow/dataset/pose_dataset.py", line 147, in set_shuffle
    assert not self.cfg.mirror
AssertionError

Can you please provide a little documentation on how to run the test.py? And what is the cfg it looks for? Seems the one I fed in is not matched.

monajalal avatar Apr 08 '18 21:04 monajalal

For testing you need to use different pose_cfg.yaml file, which should look like this one: https://github.com/eldar/pose-tensorflow/blob/master/models/mpii/test/pose_cfg.yaml The test code is not really supported, what does work here is the demo code, which you can use as reference.

eldar avatar Apr 11 '18 08:04 eldar

have you download the pretrained model?can you share it with me. because the download site cannot open.thank you very much!

1Rookiechang avatar May 17 '18 08:05 1Rookiechang