img_root = '/media/ubuntu/65db2e03-ffde-4f3d-8f33-55d73836211a/dataset/VOCdevkit/VOC2007/Test/JPEGImages' labelfiles = '/media/ubuntu/65db2e03-ffde-4f3d-8f33-55d73836211a/dataset/VOCdevkit/VOC2007/Test/ImageSets/Main' checkpoint_dir = '../../model/yolol2sum_epoch_SGD' classes = voc.list_image_sets() val_list = voc.imgs_from_category_as_list('', 'test', labelfiles) yolo_old = YOLO_tiny_tf.YOLO_TF() with tf.device('/gpu:0'): #Vanilla YOLO_tiny Weight x = tf.placeholder(tf.float32, (None, 448, 448, 3)) label = tf.placeholder(tf.float32, (None, 1470), name='labels') keep_prob = tf.placeholder(tf.float32) modelTicket_G = {'root': 'yolo_tiny', 'branch': 'vanilla'} init_layers = mu.model_zoo(modelTicket_G) var_dict = recursive_create_var('recursive', 1, 0.2, init_layers) yolo_ds = nf.glosso_train("recursive_0", 'test', x, var_dict, keep_prob, False) tlossTicket = {'loss': 'smoothL1'} loss_pair = {'prob': yolo_ds} loss = mu.loss_zoo(tlossTicket, loss_pair, label) tp = 0 fp = 0 tp_old = 0 fp_old = 0 num = 0
import tensorflow as tf import numpy as np import yolo_netfactory as nf import random_batch as rb import YOLO_tiny_tf import cv2 import model_utility as mut import time #Vanilla Yolo scope = 'train' yolo = YOLO_tiny_tf.YOLO_TF() #Target Model model_ticket = {'root': yolo_tiny, 'branch': 'double_cut89'} ds_yolo = mut.create_var_tnorm(scope, mut.model_zoo(model_ticket)) batch_file = "/media/ubuntu/65db2e03-ffde-4f3d-8f33-55d73836211a/dataset/VOC_train" test_file = "/media/ubuntu/65db2e03-ffde-4f3d-8f33-55d73836211a/dataset/VOC_val" filename = "../../model/test/fcann_v1.ckpt" logfile = '../../log/test' graph_model = '../../model/test/fcann_v1.ckpt-4000.meta' checkpoint_dir = '../../model/test' continue_training = 1 loop_num = 5900 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)) #
save_epoch = 200 test_epoch = 500 weight_decay = 0.0005 yolo = YOLO_tiny_tf.YOLO_TF() with tf.device('/gpu:0'): keep_prob = tf.placeholder(tf.float32, name='dropout_prob') x = tf.placeholder(tf.float32, (None, 448, 448, 3), name='input_batch') label = tf.placeholder(tf.float32, (None, 1470), name='labels') tlabel = tf.placeholder(tf.float32, (None, 1470), name='test_labels') learning_rate = tf.placeholder(tf.float32, shape=[], name='learning_rate') model_ticket = {'root': 'yolo_tiny', 'branch': 'vanilla'} init_layers = mu.model_zoo(model_ticket) var_dict = recursive_create_var('recursive', 1, 0.2, init_layers) var_list = var_dict['recursive_0'] with tf.name_scope('Weight_sum'): with tf.variable_scope('recursive_0') as scope: scope.reuse_variables() weight_sum = tf.reduce_sum([ 0.5 * tf.reduce_sum(tf.square(tf.get_variable(x) * weight_decay)) for x in var_list ]) w1 = tf.get_variable(var_list[0]) glosso_train = nf.glosso_train("recursive_0", 'train', x, var_dict, keep_prob, True)
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)