##################################################################################### ######## Loss Function for kk in range(K): if kk == 0: rate_total = rate[kk] else: rate_total = rate_total + rate[kk] loss = tf.reduce_mean(rate_total) ######### Optimizer optimizer = tf.train.AdamOptimizer(learning_rate) training_op = optimizer.minimize(loss, name="training_op") init = tf.global_variables_initializer() saver = tf.train.Saver() ###################################################################### ########### Validation Set h_act_test, hR_act_test, hI_act_test = generate_batch_data( test_size, M, K, Lp, LSF_UE, Mainlobe_UE, HalfBW_UE) DNN_input_BS_Q_test = generate_batch_data_specializedB(h_act_test,Xp_r,Xp_i,noise_std_dl,K,\ A1,A2,A3,A4,b1,b2,b3,b4,Qmin,Qmax) feed_dict_test = { DNN_input_BS: DNN_input_BS_Q_test, hR: hR_act_test, hI: hI_act_test, lay['noise_std']: noise_std_dl } rate_MRT, rate_ZF = generate_MRT_ZF_performance(h_act_test, noise_std_dl, P) ########### Load Final Data Set AA = sio.loadmat('Data_test_K{}M{}Lp{}_{}HBW_withParams.mat'.format( K, M, Lp, int(HalfBW_UE[0]))) h_act_test_Final = AA['h_act_test_Final'] hR_act_test_Final = AA['hR_act_test_Final'] hI_act_test_Final = AA['hI_act_test_Final']
csv_img, csv_ann = util.load_sample_from_csv(FLAGS.csv) if csv_img is not None and len(csv_img) > 0: images.extend(csv_img) annotations.extend(csv_ann) if len(images) == 0: print('Samples is empty, exit()') exit() print('fine tuning images size: {}'.format(len(images))) print('fine tuning annotations size: {}'.format(len(annotations))) assert len(images) == len(annotations) image_tensor, annotation_tensor = generate_batch_data(images, annotations, batch_size=batch_size) if __name__ == "__main__": is_training = tf.placeholder(tf.bool) dsn_fuse, dsn1, dsn2, dsn3, dsn4, dsn5 = mobilenet_v2_style_hed( image_tensor, is_training) hed_weights = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='hed') cost = class_balanced_sigmoid_cross_entropy(dsn_fuse, annotation_tensor) # cost = class_balanced_sigmoid_cross_entropy(dsn_fuse, annotation_tensor) \ # + class_balanced_sigmoid_cross_entropy(dsn1, annotation_tensor)\ # + class_balanced_sigmoid_cross_entropy(dsn2, annotation_tensor)\