From d8fea13dc5cf9bbcff80be7c9bb6834fda08cfdb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 1 Dec 2019 12:06:46 +0100 Subject: cli --- cli/app/commands/process/fetch.py | 20 +++++++++++++++++ cli/app/settings/app_cfg.py | 37 ++++++++++++++++++++++++++++++ cli/cli.py | 4 ++-- modelzoo/modelzoo.yaml | 47 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 cli/app/commands/process/fetch.py create mode 100644 cli/app/settings/app_cfg.py create mode 100644 modelzoo/modelzoo.yaml diff --git a/cli/app/commands/process/fetch.py b/cli/app/commands/process/fetch.py new file mode 100644 index 0000000..a558d94 --- /dev/null +++ b/cli/app/commands/process/fetch.py @@ -0,0 +1,20 @@ +import click + +from app.utils import click_utils +from app.settings import app_cfg + +@click.command('') +# @click.option('-i', '--input', 'opt_dir_in', required=True, +# help='Path to input image glob directory') +# @click.option('-r', '--recursive', 'opt_recursive', is_flag=True) +@click.pass_context +def cli(ctx): + """ + Converts directory of images to BigGAN* vectors + """ + + # ------------------------------------------------ + # imports + + # app_cfg.MODELZOO_CFG + pass diff --git a/cli/app/settings/app_cfg.py b/cli/app/settings/app_cfg.py new file mode 100644 index 0000000..fe65458 --- /dev/null +++ b/cli/app/settings/app_cfg.py @@ -0,0 +1,37 @@ +import os +from os.path import join +import collections +import logging + +from dotenv import load_dotenv +import yaml + +from app.models import types +from pathlib import Path + +import codecs +codecs.register(lambda name: codecs.lookup('utf8') if name == 'utf8mb4' else None) + +# ----------------------------------------------------------------------------- +# Click config +# ----------------------------------------------------------------------------- + +CLICK_GROUPS = { + 'process': 'commands/process', +} + +# ----------------------------------------------------------------------------- +# File I/O +# ----------------------------------------------------------------------------- + +SELF_CWD = os.path.dirname(os.path.realpath(__file__)) # Script CWD +DIR_APP = str(Path(SELF_CWD).parent.parent.parent) + +FP_MODELZOO = join(DIR_APP, 'modelzoo/modelzoo.yaml') + +# ----------------------------------------------------------------------------- +# Model config +# ----------------------------------------------------------------------------- + +with open(FP_MODELZOO, 'r') as fp: + MODELZOO_CFG = yaml.load(fp, Loader=yaml.Loader) diff --git a/cli/cli.py b/cli/cli.py index 4a1e8e5..4e3fdb2 100755 --- a/cli/cli.py +++ b/cli/cli.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -------------------------------------------------------- -# VFRAME Synthetic Data cli +# GAN processing cli # -------------------------------------------------------- import click @@ -22,7 +22,7 @@ if __name__ == '__main__': # argparse: intercept group argv_tmp = sys.argv sys.argv = sys.argv[:2] - ap = argparse.ArgumentParser('\033[1m\033[94mMEGAPIXELS\033[0m') + ap = argparse.ArgumentParser('\033[1m\033[94mGAN\033[0m') ap.add_argument('group', choices=app_cfg.CLICK_GROUPS.keys()) args = ap.parse_args() sys.argv = argv_tmp diff --git a/modelzoo/modelzoo.yaml b/modelzoo/modelzoo.yaml new file mode 100644 index 0000000..e8910a9 --- /dev/null +++ b/modelzoo/modelzoo.yaml @@ -0,0 +1,47 @@ +biggan_128: + name: BigGAN 128 + url: https://tfhub.dev/deepmind/biggan-128/2 + w: 128 + h: 128 + +biggan_deep_128: + name: BigGAN Deep 128 + url: https://tfhub.dev/deepmind/biggan-deep-128/1 + w: 128 + h: 128 + +biggan_256: + name: BigGAN 256 + url: https://tfhub.dev/deepmind/biggan-256/2 + w: 256 + h: 256 + +biggan_deep_256: + name: BigGAN Deep 256 + url: https://tfhub.dev/deepmind/biggan-deep-256/1 + w: 256 + h: 256 + +biggan_512: + name: BigGAN 512 + url: https://tfhub.dev/deepmind/biggan-512/2 + w: 512 + h: 512 + +biggan_deep_512: + name: BigGAN Deep 512 + url: https://tfhub.dev/deepmind/biggan-deep-512/1 + w: 512 + h: 512 + +bigbigan_revnet: + name: BigBiGAN Resnet50 + url: https://tfhub.dev/deepmind/bigbigan-resnet50/1 + w: 256 + h: 256 + +bigbigan_resnet: + name: BigBiGAN Revnet50 + url: https://tfhub.dev/deepmind/bigbigan-revnet50x4/1 + w: 256 + h: 256 -- cgit v1.2.3-70-g09d2