print "Train DET net start, net : ", net_name print "MODE_CONT : ", MODE_CONT print "Learing Rate : ", LearningRate print "nBatch : ", nBatch # ############################################################################# # # ---------------------- NETWORK MODEL ---------------------------------------- # # ############################################################################# # BM = batch_manager.BatchManager() BM.init(net_name) sess = tf.Session( config=tf.ConfigProto(gpu_options=gpu_options ) ) sess = tf.InteractiveSession() if net_name == '12net' : N12 = cvpr_network.cvpr_12net() N12.input_config_noscale() N12.infer() N12.objective() N12.train(LearningRate, threshold) network_list = [N12] elif net_name == '24net' : N12 = cvpr_network.cvpr_12net() N12.input_config_div2() N12.infer() N24 = cvpr_network.cvpr_24net() N24.input_config_noscale() N24.infer() N24.objective() N24.train(LearningRate, threshold)
threshold1 = 0.80 threshold2 = 0.90 threshold3 = 0.95 BigKernelSize = 100 MinFace = 48 gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.1 ) # ----------------------------------------- # ------ Network ------------------------ sess = tf.Session( config=tf.ConfigProto(gpu_options=gpu_options ) ) sess = tf.InteractiveSession() N12 = cvpr_network.cvpr_12net() N12.infer_scan(BigKernelSize) N12_infer = cvpr_network.cvpr_12net() N12_infer.infer() N24 = cvpr_network.cvpr_24net() # N24.infer_scan(BigKernelSize) N24.infer() N48 = cvpr_network.cvpr_48net() # N48.infer_scan(BigKernelSize) N48.infer() # ------ Scanning ------------------------ saver1 = tf.train.Saver( { 'net48_w_conv1':N48.W_conv1, 'net48_b_conv1':N48.b_conv1, 'net48_w_conv2':N48.W_conv2, 'net48_b_conv2':N48.b_conv2, 'net48_w_fc1':N48.W_fc1, 'net48_b_fc1':N48.b_fc1, 'net48_w_fc2':N48.W_fc2, 'net48_b_fc2': N48.b_fc2 } )
if net_name == '24net' : path = "%s/NS_aflw24/ns-%d.jpg" %(base_path, cnt_ns+cnt_save) elif net_name == '48net' : path = "%s/NS_aflw48_1/ns-%d.jpg" %(base_path, cnt_ns+cnt_save) org_img = org_img.convert('RGB') image_search.save_patch(org_img, final_list[i], path, net_name) cnt_save = cnt_save + 1 return cnt_save # ----------------------------------------- sess = tf.Session( config=tf.ConfigProto(gpu_options=gpu_options ) ) sess = tf.InteractiveSession() N12 = cvpr_network.cvpr_12net() N12.input_config_noscale() N12.infer() CAL12 = cvpr_network.cvpr_calib_12net() CAL12.input_config_noscale() CAL12.infer() saver1 = tf.train.Saver( { 'net12_w_conv1':N12.W_conv1, 'net12_b_conv1':N12.b_conv1, 'net12_w_fc1':N12.W_fc1, 'net12_b_fc1':N12.b_fc1, 'net12_w_fc2':N12.W_fc2, 'net12_b_fc2': N12.b_fc2 } ) saver1.restore(sess, ckpt_file1) saver2 = tf.train.Saver( { 'cal12_w_conv1':CAL12.W_conv1, 'cal12_b_conv1':CAL12.b_conv1, 'cal12_w_fc1':CAL12.W_fc1, 'cal12_b_fc1':CAL12.b_fc1, 'cal12_w_fc2':CAL12.W_fc2, 'cal12_b_fc2': CAL12.b_fc2 } ) saver2.restore(sess, ckpt_file2) if (net_name == '48net') : N24 = cvpr_network.cvpr_24net() N24.input_config_noscale()
threshold1 = 0.80 threshold2 = 0.90 threshold3 = 0.95 BigKernelSize = 100 MinFace = 48 gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.1) # ----------------------------------------- # ------ Network ------------------------ sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) sess = tf.InteractiveSession() N12 = cvpr_network.cvpr_12net() N12.infer_scan(BigKernelSize) N12_infer = cvpr_network.cvpr_12net() N12_infer.infer() N24 = cvpr_network.cvpr_24net() # N24.infer_scan(BigKernelSize) N24.infer() N48 = cvpr_network.cvpr_48net() # N48.infer_scan(BigKernelSize) N48.infer() # ------ Scanning ------------------------ saver1 = tf.train.Saver({