Esempio n. 1
0
    Note that better sinusoid results can be achieved by using a larger network.
"""
import csv
import numpy as np
import pickle
import random
import tensorflow.compat.v1 as tf

from data_generator import DataGenerator
from maml import MAML
from tensorflow.compat.v1.python.platform import flags

FLAGS = flags.FLAGS

## Dataset/method options
flags.DEFINE_string('datasource', 'sinusoid',
                    'sinusoid or omniglot or miniimagenet')
flags.DEFINE_string('expt_number', '0', '1,2,3 etc..')
flags.DEFINE_integer(
    'num_classes', 5,
    'number of classes used in classification (e.g. 5-way classification).')
# oracle means task id is input (only suitable for sinusoid)
flags.DEFINE_string('baseline', None, 'oracle, or None')

## Training options
flags.DEFINE_integer('pretrain_iterations', 0,
                     'number of pre-training iterations.')
flags.DEFINE_integer(
    'metatrain_iterations', 15000,
    'number of metatraining iterations.')  # 15k for omniglot, 50k for sinusoid
flags.DEFINE_bool('m_metatrain', False, 'use multi-task meta training')
flags.DEFINE_integer('meta_batch_size', 25,
Esempio n. 2
0
    Note that better sinusoid results can be achieved by using a larger network.
"""
import csv
import numpy as np
import pickle
import random
import tensorflow.compat.v1 as tf

from data_generator import DataGenerator
from maml import MAML
from tensorflow.compat.v1.python.platform import flags

FLAGS = flags.FLAGS

## Dataset/method options
flags.DEFINE_string('datasource', 'sinusoid',
                    'sinusoid or omniglot or miniimagenet')
flags.DEFINE_string('task_setting', 'e', 'e or ne')
flags.DEFINE_integer(
    'num_classes', 5,
    'number of classes used in classification (e.g. 5-way classification).')
# oracle means task id is input (only suitable for sinusoid)
flags.DEFINE_string('baseline', None, 'oracle, or None')

## Training options
flags.DEFINE_integer('pretrain_iterations', 0,
                     'number of pre-training iterations.')
flags.DEFINE_integer(
    'metatrain_iterations', 15000,
    'number of metatraining iterations.')  # 15k for omniglot, 50k for sinusoid
flags.DEFINE_integer('meta_batch_size', 25,
                     'number of tasks sampled per meta-update')