inputs = tf.placeholder(tf.float32, (None, model_config['doc_time_step'], model_config['input_dim']), name='input') query = tf.placeholder(tf.float32, (None, model_config['query_time_step'], model_config['input_dim']), name='question') labels = tf.placeholder(tf.float32, (None, model_config['n_entities']),name='labels') learning_rate = tf.placeholder(tf.float32, shape=[], name='learning_rate') keep_prob = tf.placeholder(tf.float32, name='dropout_prob') doc_var_list = [ ['d_attw',[2*model_config['ctx_lstm_size'], model_config['attention_mlp_hidden']]], ['q_attw',[2*model_config['question_lstm_size'], model_config['attention_mlp_hidden']]], ['wms',[model_config['attention_mlp_hidden'],1]], ['w_rg',[2*model_config['ctx_lstm_size'], model_config['n_entities'] ]], ['w_ug',[2*model_config['question_lstm_size'], model_config['n_entities'] ]] ] doc_var = mut.create_var_xavier('Varibles',doc_var_list)# x = tf.unstack(inputs, model_config['doc_time_step'], 1) q = tf.unstack(query, model_config['query_time_step'], 1) with tf.variable_scope("query"): with tf.variable_scope("fw"): qlstm_fw_cell = tf.contrib.rnn.LSTMCell(model_config['question_lstm_size'], forget_bias=1.0) qlstm_fw_cell = tf.contrib.rnn.DropoutWrapper(qlstm_fw_cell, input_keep_prob=keep_prob) with tf.variable_scope("bw"): qlstm_bw_cell = tf.contrib.rnn.LSTMCell(model_config['question_lstm_size'], forget_bias=1.0) qlstm_bw_cell = tf.contrib.rnn.DropoutWrapper(qlstm_bw_cell, input_keep_prob=keep_prob) doc_net, fw, bw = rnn.static_bidirectional_rnn(qlstm_fw_cell, qlstm_bw_cell, q ,dtype=tf.float32) y_q = tf.concat([fw[-1], bw[-1]],1)#
filename = "../../model/yolo_lsgan/fcann_v1.ckpt" logfile = '../../log/yolo_lsgan' graph_model = '../../model/yolo_lsgan/fcann_v1.ckpt-0.meta' checkpoint_dir = '../../model/yolo_lsgan' continue_training = 1 loop_num = 5500 d_loop_num = 3 batch_size = 64 keep_prob = tf.placeholder(tf.float32) x = tf.placeholder(tf.float32, (None, 448, 448, 3)) label = tf.placeholder(tf.float32, (None, 1470)) yolo = YOLO_tiny_tf.YOLO_TF() ds_yolo = mut.create_var_xavier('train', tmodel_var_list) dis_var = mut.create_var_xavier('discriminator', discriminator_var) theta_D = [] theta_G = [] for i in tmodel_var_list: theta_G.append(ds_yolo[i[0]]) for i in discriminator_var: theta_D.append(dis_var[i[0]]) ##Train Phase yolo_ds_train = nf.yolo_ds_all("yolo_train", x, ds_yolo, keep_prob, True) d_real_logit, d_real_prob = nf.discriminator('discriminator', label, dis_var) d_fake_logit, d_fake_prob = nf.discriminator('discriminator', yolo_ds_train, dis_var)
save_epoch = 200 test_epoch = 500 modelTicket_G = {'root':'yolo_tiny', 'branch':'double_cut89'} modelTicket_D = {'root':'discriminator', 'branch':'4layer'} keep_prob = tf.placeholder(tf.float32) x = tf.placeholder(tf.float32,(None,448,448,3)) test = tf.placeholder(tf.float32,(None,448,448,3)) label = tf.placeholder(tf.float32,(None,1470)) yolo = YOLO_tiny_tf.YOLO_TF() gen_var = mut.create_var_xavier('train',mut.model_zoo(modelTicket_G)) dis_var = mut.create_var_xavier('discriminator', mut.model_zoo(modelTicket_D)) theta_D = [] theta_G = [] for i in mut.model_zoo(modelTicket_G): theta_G.append(gen_var[i[0]]) for i in mut.model_zoo(modelTicket_D): theta_D.append(dis_var[i[0]]) ##Train Phase yolo_ds_train = nf.yolo_dinception("yolo_train", x, gen_var, keep_prob, True) lossTicket = {'loss':'L2norm'} loss = mut.loss_zoo(lossTicket, yolo_ds_train, label)