Beispiel #1
0
    image_list.append('./data/1.png')
    image_list.append('./data/2.png')
    image_list.append('./data/3.png')
    image_list.append('./data/4.png')
    image_list.append('./data/5.png')

    # network input
    image_tf = tf.placeholder(tf.float32, shape=(1, 240, 320, 3))
    hand_side_tf = tf.constant([[1.0, 0.0]
                                ])  # left hand (true for all samples provided)
    evaluation = tf.placeholder_with_default(True, shape=())

    # build network
    net = PoseEstimationNetwork()
    print("Line 48:Let's test!\n")
    hand_scoremap_tf, image_crop_tf, scale_crop_tf, center_tf = net.HandSegCrop(
        image_tf)
    print("Oops,testcrop_line 49==> The formu is :", hand_scoremap_tf.shape)
    # Start TF
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.8)
    sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

    # initialize network
    # net.init(sess)
    # retrained version: HandSegNet
    last_cpt = tf.train.latest_checkpoint(PATH_TO_HANDSEGNET_SNAPSHOTS)
    assert last_cpt is not None, "Could not locate snapshot to load. Did you already train the network and set the path accordingly?"
    load_weights_from_snapshot(sess,
                               last_cpt,
                               discard_list=['Adam', 'global_step', 'beta'])

    # Feed image list through network
Beispiel #2
0
                         shuffle=False,
                         use_wrist_coord=True,
                         scale_to_size=True)

# build network graph
data = dataset.get()

# build network
net = PoseEstimationNetwork()

# 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])

hand_scoremap, image_crop, scale_crop, center = net.HandSegCrop(image_scaled)

# detect keypoints in 2D
s = image_crop.get_shape().as_list()
keypoints_scoremap = net.PoseNet(image_crop)
keypoints_scoremap = keypoints_scoremap[-1]
keypoints_scoremap = tf.image.resize_images(keypoints_scoremap, (s[1], s[2]))

# Start TF
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.8)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
tf.train.start_queue_runners(sess=sess)

# initialize network weights
# retrained version: HandSegNet
last_cpt = tf.train.latest_checkpoint(PATH_TO_HANDSEGNET_SNAPSHOTS)