Exemplo n.º 1
0
    def __init__(self, batch_size, is_training=True, is_fine_tune=False):
        """ Init for Pipeline """
        self.batch_size = batch_size
        self.part_batch = (self.batch_size / 2)
        self.is_training = is_training

        ### Create a new network model
        self.net_scope = "netmodel_prime"
        self.net_model = NetModel(self.net_scope,
                                  batch_size=self.batch_size,
                                  is_training=is_training,
                                  is_fine_tune=is_fine_tune)

        ### Get suitable params
        self.net_params = utils.get_network_params(self.net_scope)
        self.resnet_params = utils.get_net_train_params("resnet_v2_50")

        ### Define all trainable params
        self.trainable_params = self.net_params + self.resnet_params
        self.var_list = tf.global_variables()

        ### Weight save & restore
        self.bestwt_saver = tf.train.Saver(self.var_list, max_to_keep=5)
        self.iterwt_saver = tf.train.Saver(self.var_list, max_to_keep=5)

        ### Scope/Name
        self.scope = "composer"
        self.name = "model_composer"

        ### Get critical network nodes
        self.nodes_net = self.net_model.get_network_nodes()

        ## Nodes
        self.in_gt_nodes = self.nodes_net['inputs_and_gt']
        self.cnn_nodes = self.nodes_net['cnn_layer']
        self.smpl_nodes = self.nodes_net['smpl_layer']
        self.cam_mesh_nodes = self.nodes_net['cam_mesh_module']
        self.ren_nodes = self.nodes_net['renderer_layer']
Exemplo n.º 2
0
                        help="File to save weights")
    parser.add_argument('--inference',
                        type=str,
                        default=None,
                        help="File to load weights")
    parser.add_argument('--resume',
                        type=str,
                        default=None,
                        help="Weights file to resume training")
    args = parser.parse_args()

# Initialize seed before any use
np.random.seed(args.rng_seed)

# Get network parameters
nw_params = get_network_params(args.dataset, args.size, args.batch_size)
metric_names = nw_params['metric_names']
en_top5 = True
num_resnet_mods = nw_params['num_resnet_mods']
args.iter_interval = nw_params['iter_interval']
learning_schedule = nw_params['learning_schedule']
en_bottleneck = nw_params['en_bottleneck']
ax.Y.length = nw_params['num_classes']

# Set batch size
ax.N.length = args.batch_size

# Create training and validation set objects
train_set, valid_set = make_aeon_loaders(args.data_dir,
                                         args.batch_size,
                                         args.num_iterations,