def __init__(self, sess, num_classes, batch_size, train_featurizer='FINE_TUNE', train_main_model='FINE_TUNE', train_fc='FINE_TUNE', weights_filename=None, is_training=True): self.sess = sess if weights_filename is not None: print('loading weights from: {}'.format(weights_filename)) self.weights = np.load(weights_filename) if weights_filename is not None else None self.num_classes = num_classes self.batch_size = batch_size assert train_featurizer in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_featurizer must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_featurizer = train_featurizer if is_training else 'NO' assert train_main_model in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_main_model must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_main_model = train_main_model if is_training else 'NO' assert train_fc in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_fc must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_fc = train_fc if is_training else 'NO' self.is_training = is_training self.featurizer_variables = [] self.main_model_variables = [] self.fc_variables = [] self.vfeedbacknet_base = VFeedbackNetBase(sess, num_classes, train_vgg16=train_featurizer, is_training=is_training) #self.vfeedbacknet_fb_base = VFeedbackNetFBBase(sess, num_classes, batch_size, train_featurizer='NO', train_main_model='NO', is_training=True, trainable=False) self._declare_variables()
def __init__(self, sess, num_classes, train_featurizer='FINE_TUNE', train_main_model='FROM_SCRATCH', train_fc='FROM_SCRATCH', weights_filename=None, is_training=True): self.sess = sess self.weights = np.load(weights_filename) if weights_filename is not None else None self.num_classes = num_classes assert train_featurizer in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_featurizer must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_featurizer = train_featurizer if is_training else 'NO' assert train_main_model in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_main_model must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_main_model = train_main_model if is_training else 'NO' assert train_fc in ['NO', 'FINE_TUNE', 'FROM_SCRATCH'], 'train_fc must be either: NO, FINE_TUNE, or FROM_SCRATCH' self.train_fc = train_fc if is_training else 'NO' self.is_training = is_training self.featurizer_variables = [] self.main_model_variables = [] self.fc_variables = [] self.vfeedbacknet_base = VFeedbackNetBase(sess, num_classes, is_training=is_training) self._declare_variables()