Ejemplo n.º 1
0
def cont(name, preload, key):
    with get_session() as sess:
        fcn = FCN(sess=sess, name=name)
        sess.run(tf.global_variables_initializer())
        if preload is not None:
            fcn.load(name=preload, key=key)
        fcn.train(EPOCHS)
Ejemplo n.º 2
0
def train(name, *args):
    kwargs = {}
    for arg in args:
        key, val = arg.split('=')
        kwargs[key] = val
        OVERRODE[key] = val
    with get_session() as sess:
        fcn = FCN(sess=sess, name=name, kwargs=kwargs)
        sess.run(tf.global_variables_initializer())
        fcn.train(EPOCHS)
Ejemplo n.º 3
0
from fcn import FCN

# set PATH to location of Pacal VOC dataset
PATH = '/home/seth/Datasets/VOCtrainval_11-May-2012/VOCdevkit/VOC2012/'

fcn = FCN(path=PATH)
#fcn.load('my_model')
fcn.train(epochs=75)
fcn.save('my_model')
fcn.evaluate(val=False)
fcn.evaluate()
for id in fcn.train_list[:10]:
    fcn.data.show_seg(id)
    fcn.predict(id)
for id in fcn.val_list[:10]:
    fcn.data.show_seg(id)
    fcn.predict(id)
Ejemplo n.º 4
0
import matplotlib.pyplot as plt

logging.basicConfig(level=logging.DEBUG)


def print_usage():
    print('Usage:')
    print('python train.py MAX_ITERATIONS_COARSE MAX_ITERATIONS_FINE '
          'SAVE_PARAMS_AFTER RESTORE_COARSE_PARAMS_PATH')


if len(sys.argv) not in [4, 5]:
    print_usage()
    exit(1)

TRAINVAL_ROOT_DIR = '/home/paperspace/PASCAL-VOC-Dataset/TrainVal'
TEST_ROOT_DIR = '/home/paperpsace/PASCAL-VOC-Dataset/Test'
VGG_PARAMS_ROOT_DIR = '/home/paperspace/FCN/vgg-weights'

MAX_ITERATIONS_COARSE = int(sys.argv[1])
MAX_ITERATIONS_FINE = int(sys.argv[2])
SAVE_PARAMS_AFTER = int(sys.argv[3])
if len(sys.argv) == 5:
    RESTORE_CKPT = sys.argv[4]
else:
    RESTORE_CKPT = None

fcn = FCN(TRAINVAL_ROOT_DIR, TEST_ROOT_DIR, VGG_PARAMS_ROOT_DIR)
fcn.train(MAX_ITERATIONS_COARSE, MAX_ITERATIONS_FINE, SAVE_PARAMS_AFTER,
          RESTORE_CKPT)