示例#1
0
from utils.general import LearningRateScheduler, load_weights_from_snapshot
from tqdm import tqdm
# training parameters
train_para = {
    'lr': [1e-5, 1e-6, 1e-7],
    'lr_iter': [20000, 30000],
    'max_iter': 40000,
    'show_loss_freq': 1000,
    'snapshot_freq': 5000,
    'snapshot_dir': 'snapshots_handsegnet'
}

# get dataset
dataset = BinaryDbReader(mode='training',
                         batch_size=4,
                         shuffle=True,
                         hue_aug=True,
                         random_crop_to_size=True)

# build network graph
data = dataset.get()

# build network
evaluation = tf.placeholder_with_default(True, shape=())
net = ColorHandPose3DNetwork()
hand_mask_pred = net.inference_detection(data['image'], train=True)

# Start TF
gpu_options = tf.GPUOptions(allow_growth=True, )
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
tf.train.start_queue_runners(sess=sess)
示例#2
0
from utils.general import LearningRateScheduler, load_weights_from_snapshot

# entrenamiento parameters
train_para = {
    'lr': [1e-5, 1e-6, 1e-7],
    'lr_iter': [20000, 30000],
    'max_iter': 40000,
    'show_loss_freq': 1000,
    'snapshot_freq': 5000,
    'snapshot_dir': 'snapshots_handsegnet'
}

# get dataset
dataset = BinaryDbReader(mode='entrenamiento',
                         batch_size=8,
                         shuffle=True,
                         hue_aug=True,
                         random_crop_to_size=True)

# build network graph
data = dataset.get()

# build network
evaluation = tf.placeholder_with_default(True, shape=())
net = ColorHandPose3DNetwork()
hand_mask_pred = net.inference_detection(data['image'], train=True)

# 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)
示例#3
0
# training parameters
train_para = {
    'lr': [1e-4, 1e-5, 1e-6],
    'lr_iter': [10000, 20000],
    'max_iter': 30000,
    'show_loss_freq': 1000,
    'snapshot_freq': 5000,
    'snapshot_dir': 'snapshots_posenet'
}

# get dataset
dataset = BinaryDbReader(mode='training',
                         batch_size=8,
                         shuffle=True,
                         use_wrist_coord=False,
                         hand_crop=True,
                         coord_uv_noise=True,
                         crop_center_noise=True)

# build network graph
data = dataset.get()

# build network
evaluation = tf.compat.v1.placeholder_with_default(True, shape=())
net = ColorHandPose3DNetwork()
keypoints_scoremap = net.inference_pose2d(data['image_crop'], train=True)
s = data['scoremap'].get_shape().as_list()
keypoints_scoremap = [
    tf.image.resize(x, (s[1], s[2])) for x in keypoints_scoremap
]
示例#4
0
# entrenamiento parameters
train_para = {
    'lr': [1e-5, 1e-6],
    'lr_iter': [60000],
    'max_iter': 80000,
    'show_loss_freq': 1000,
    'snapshot_freq': 5000,
    'snapshot_dir': 'snapshots_lifting_%s' % VARIANT
}

# get dataset
dataset = BinaryDbReader(mode='entrenamiento',
                         batch_size=8,
                         shuffle=True,
                         hand_crop=True,
                         use_wrist_coord=False,
                         coord_uv_noise=True,
                         crop_center_noise=True,
                         crop_offset_noise=True,
                         crop_scale_noise=True)

# build network graph
data = dataset.get()

# build network
net = PosePriorNetwork(VARIANT)

# feed trough network
evaluation = tf.placeholder_with_default(True, shape=())
_, coord3d_pred, R = net.inference(data['scoremap'], data['hand_side'],
                                   evaluation)