コード例 #1
0
    print(
        'Could not load pretrained model weights. Weights can be found at {} and {}'
        .format(
            'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_th_dim_ordering_th_kernels_notop.h5',
            'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
        ))

optimizer_rpn = Nadam(lr=1e-5)
optimizer_classifier = Nadam(lr=1e-5)
model_rpn.compile(
    optimizer=optimizer_rpn,
    loss=[losses.rpn_loss_cls(num_anchors),
          losses.rpn_loss_regr(num_anchors)])

classifier_loss = [
    losses.class_loss_face(),
    losses.class_loss_pose(),
    losses.class_loss_gender(),
    losses.class_loss_viz(),
    losses.class_loss_landmark(),
    losses.class_loss_regr()
]
classifier_loss_weight = [
    C.lambda_face, C.lambda_pose, C.lambda_gender, C.lambda_viz,
    C.lambda_landmark, C.lambda_regr
]
model_classifier.compile(optimizer=optimizer_classifier,
                         loss=classifier_loss,
                         loss_weights=classifier_loss_weight)

# classifier_loss = {	'face_out':losses.class_loss_face,'pose_out': losses.class_loss_pose(face_true),'gender_out': losses.class_loss_gender(face_true), \
コード例 #2
0
	# print('loading RPN weights')
	# model_rpn.load_weights(C.base_net_weights, by_name=True)   #TODO: load RPN weights
# 	# model_classifier.load_weights(C.base_net_weights, by_name=True)
	print('loading weights from {}'.format(C.model_path))
	model_all.load_weights(C.model_path, by_name = True)
except:
	print('Could not load pretrained model weights. Weights can be found at {} and {}'.format(
		'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_th_dim_ordering_th_kernels_notop.h5',
		'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
	))

optimizer_rpn = Nadam(lr=1e-7)
optimizer_classifier = Nadam(lr=1e-7)
model_rpn.compile(optimizer=optimizer_rpn, loss=[losses.rpn_loss_cls(num_anchors), losses.rpn_loss_regr(num_anchors)])

classifier_loss = [losses.class_loss_face(),losses.class_loss_pose(),losses.class_loss_gender(), losses.class_loss_viz(),losses.class_loss_landmark()]
classifier_loss_weight = [C.lambda_face,C.lambda_pose,C.lambda_gender,C.lambda_viz,C.lambda_landmark]
model_classifier.compile(optimizer=optimizer_classifier, loss=classifier_loss , loss_weights= classifier_loss_weight )

model_all.compile(optimizer='sgd', loss='mae')


##################################################################Training configuration ##########################################################
epoch_length = 100
num_epochs = int(options.num_epochs)
num_epochs = 210 * 10
iter_num = 0
epoch_num = 0

losses = np.zeros((epoch_length, 7))
overall_loss = np.zeros((epoch_length, 2))
コード例 #3
0
	model_rpn.load_weights(C.base_net_weights, by_name=True)   #TODO: load RPN weights
# 	# model_classifier.load_weights(C.base_net_weights, by_name=True)
	# print('loading weights from {}'.format(C.model_path))
	# model_all.load_weights(C.model_path, by_name = True)
except:
	print('Could not load pretrained model weights. Weights can be found at {} and {}'.format(
		'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_th_dim_ordering_th_kernels_notop.h5',
		'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
	))

optimizer_rpn = Nadam(lr=1e-7)
optimizer_classifier = Nadam(lr=1e-6)
model_rpn.compile(optimizer=optimizer_rpn, loss=[losses.rpn_loss_cls(num_anchors), losses.rpn_loss_regr(num_anchors)])


classifier_loss = [losses.class_loss_face(), losses.class_loss_regr()]
classifier_loss_weight = [C.lambda_face, C.lambda_regr]

#classifier_loss = [losses.class_loss_face(),losses.class_loss_pose(),losses.class_loss_gender(), losses.class_loss_viz(),losses.class_loss_landmark()]
#classifier_loss_weight = [C.lambda_face,C.lambda_pose,C.lambda_gender,C.lambda_viz,C.lambda_landmark]
model_classifier.compile(optimizer=optimizer_classifier, loss=classifier_loss , loss_weights= classifier_loss_weight )



# model_classifier.compile(optimizer=optimizer_classifier, loss=losses.class_loss_overall(C))
model_all.compile(optimizer='sgd', loss='mae')

epoch_length = 100
num_epochs = int(options.num_epochs)
num_epochs = 210 * 10
iter_num = 0