text
stringlengths
1
93.6k
cur_patience = 0
MI_1s = []
MI_2s = []
AMI_1s = []
AMI_2s = []
top_1s = []
top_5s = []
top_10s = []
mAPs = []
Hi_MPC_losses = []
mACT = []
mRCL = []
if dataset == 'KGBD' or dataset == 'KS20':
if FLAGS.dataset == 'KS20':
nb_nodes = 25
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes, X_train_J_D, X_gal_J_D = \
process.gen_train_data(dataset=dataset, split='gallery', time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att, batch_size=batch_size,
norm=norm
)
nb_nodes = 20
elif dataset == 'BIWI':
if probe == 'Walking':
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes, X_train_J_D, X_gal_J_D = \
process.gen_train_data(dataset=dataset, split='Still', time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att,
batch_size=batch_size, norm=norm
)
else:
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes, X_train_J_D, X_gal_J_D = \
process.gen_train_data(dataset=dataset, split='Walking', time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att,
batch_size=batch_size, norm=norm
)
elif dataset == 'IAS':
if probe == 'A':
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes, X_train_J_D, X_gal_J_D = \
process.gen_train_data(dataset=dataset, split='B', time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att,
batch_size=batch_size, norm=norm
)
else:
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes, X_train_J_D, X_gal_J_D = \
process.gen_train_data(dataset=dataset, split='A', time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att,
batch_size=batch_size, norm=norm
)
elif dataset == 'CASIA_B':
X_train_J, X_train_P, X_train_B, _, _, y_train, X_gal_J, X_gal_P, X_gal_B, _, _, y_gal, \
adj_J, biases_J, _, _, _, _, _, _, _, _, nb_classes = \
process.gen_train_data(dataset=dataset, split=probe, time_step=time_step,
nb_nodes=nb_nodes, nhood=nhood, global_att=global_att, batch_size=batch_size,
PG_type=FLAGS.probe_type.split('.')[1])
del _
gc.collect()
for epoch in range(train_epochs):
train_features_all_int, train_features_all, train_features_all_P, train_features_all_B, train_labels_all = train_loader(
X_train_J, X_train_P, X_train_B, y_train)
gal_features_all_int, gal_features_all, gal_features_all_P, gal_features_all_B, gal_labels_all = gal_loader(
X_gal_J, X_gal_P, X_gal_B, y_gal)
mAP_int, top_1_int, top_5_int, top_10_int, mAP, top_1, top_5, top_10, mAP_P, top_1_P, top_5_P, top_10_P, \
mAP_B, top_1_B, top_5_B, top_10_B, = evaluation()
cur_patience += 1
if epoch > 0 and top_1 > max_acc_2:
max_acc_1 = mAP
max_acc_2 = top_1
top_5_max = top_5
top_10_max = top_10
if epoch > 0 and top_1_int > max_acc_2_int:
max_acc_1_int = mAP_int
max_acc_2_int = top_1_int
top_5_max_int = top_5_int
top_10_max_int = top_10_int
if FLAGS.mode == 'Train':
if FLAGS.dataset != 'CASIA_B':
checkpt_file = pre_dir + dataset + '/' + probe + change + '/' + 'best.ckpt'
elif FLAGS.dataset == 'CASIA_B':
checkpt_file = pre_dir + dataset + '/' + probe + change + '/' + FLAGS.probe_type + '_best.ckpt'
print(checkpt_file)
if FLAGS.save_model == '1':
saver.save(sess, checkpt_file)
cur_patience = 0
if epoch > 0 and top_1_P > max_acc_2_P:
max_acc_1_P = mAP_P
max_acc_2_P = top_1_P
top_5_max_P = top_5_P