Example #1
0
    Average median EPE: 28.686 mm
    Area under curve: 0.424 (from 0mm to 50mm)
    Area under curve: 0.603 (from 30mm to 50mm)
""" ""
from __future__ import print_function, unicode_literals
import tensorflow as tf
import numpy as np

from data.BinaryDbReader import *
from data.BinaryDbReaderSTB import *
from nets.ColorHandPose3DNetwork import ColorHandPose3DNetwork
from utils.general import EvalUtil, get_stb_ref_curves, calc_auc

# get dataset
dataset = BinaryDbReader(mode='evaluation',
                         shuffle=False,
                         use_wrist_coord=False)
# dataset = BinaryDbReaderSTB(mode='evaluation', shuffle=False, use_wrist_coord=False)

# build network graph
data = dataset.get()
image_scaled = tf.image.resize_images(data['image'], (240, 320))

# build network
net = ColorHandPose3DNetwork()

# feed through network
evaluation = tf.placeholder_with_default(True, shape=())
_, _, _, _, _, coord3d_pred = net.inference(image_scaled, data['hand_side'],
                                            evaluation)
coord3d_gt = data['keypoint_xyz21']
Example #2
0
from __future__ import print_function, unicode_literals
import tensorflow as tf
import numpy as np

from data.BinaryDbReader import *
from nets.ColorHandPose3DNetwork import ColorHandPose3DNetwork
from utils.general import detect_keypoints, trafo_coords, EvalUtil, load_weights_from_snapshot

# flag that allows to load a retrained snapshot(original weights used in the paper are used otherwise)
USE_RETRAINED = False
PATH_TO_POSENET_SNAPSHOTS = './snapshots_posenet/'  # only used when USE_RETRAINED is true
PATH_TO_HANDSEGNET_SNAPSHOTS = './snapshots_handsegnet/'  # only used when USE_RETRAINED is true

# get dataset
dataset = BinaryDbReader(mode='evaluation',
                         shuffle=False,
                         use_wrist_coord=True,
                         scale_to_size=True)

# build network graph
data = dataset.get()

# build network
net = ColorHandPose3DNetwork()

# scale input to common size for evaluation
image_scaled = tf.image.resize_images(data['image'], (240, 320))
s = data['image'].get_shape().as_list()
scale = (240.0 / s[1], 320.0 / s[2])

# feed trough network
keypoints_scoremap, _, scale_crop, center = net.inference2d(image_scaled)
Example #3
0
elif not scale_invariance and hand_side_invariance:
    model_name += 'handInvar_noScaleInvar'
else:
    model_name += 'noHandInvar_noScaleInvar'
model_path = os.path.join('models', model_name)
sys.path.append(os.path.join(model_path, 'source_files'))
from models import *
# Create the experiment folder
try:
    os.makedirs(model_path + '/eval_results')
except:
    pass
# Load the selected dataset
if dataset_name == 'RHD':
    path_to_db = os.path.join(path_to_db, 'bin/')
    dataset = BinaryDbReader(shuffle=False, use_wrist_coord=False, hand_crop=True, 
            path_to_db=path_to_db)
elif dataset_name == 'STB':
    path_to_db = os.path.join(path_to_db, 'stb/')
    dataset = BinaryDbReaderSTB(shuffle=False, use_wrist_coord=False, hand_crop=True,
            path_to_db=path_to_db)
else:
    raise Exception("Unknown dataset")
# Build dataset
data = dataset.get()
# Build model
n_joints = 21
z_dim = 30
end_size = (256, 256)
# RGB
rgb_enc = resnet18(z_dim, hand_side_invariance)
rgb_dec = rgb_decoder(z_dim)