diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-12-05 17:01:44 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-12-05 17:01:44 +0100 |
| commit | d9ceb77e8700312c554cd3205d0c8db775db00c2 (patch) | |
| tree | 70c0f0e177a7104988fb8b56698a59fc4886d5aa /cli/app/commands/process/fetch.py | |
| parent | 1d3c7428068c46568638db5ab547c8aeb2308b57 (diff) | |
biggan
Diffstat (limited to 'cli/app/commands/process/fetch.py')
| -rw-r--r-- | cli/app/commands/process/fetch.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/cli/app/commands/process/fetch.py b/cli/app/commands/process/fetch.py deleted file mode 100644 index 5b6c102..0000000 --- a/cli/app/commands/process/fetch.py +++ /dev/null @@ -1,57 +0,0 @@ -import click - -from app.utils import click_utils -from app.settings import app_cfg - -from os.path import join -from subprocess import call - -@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): - """ - """ - - # app_cfg.MODELZOO_CFG - import gensim - - # from nltk.corpus import wordnet as wn - # synsets = wordnet.synsets("fir_tree") - # synonyms = [ lemma.name() for lemma in synsets[0].lemmas() ] - - imagenet = Imagenet() - - sentence = "The quick brown fox jumps over the lazy dog" - tokens = gensim.utils.simple_preprocess(sentence) - -class Imagenet: - def __init__(): - tokens = {} - with open(app_cfg.FP_IMAGENET_WORDS, "r") as fp: - for line in fp.readlines(): - wordnet_id, word_list = line.split('\t') - words = [word.trim() for word in word_list.split(',')] - for word in words: - tokens[word] = wordnet_id - self.tokens = tokens - - def get_wordnet_ids_for_words(tokens): - # for token in tokens: - # if token in tokens: - pass - - def images_from_wordnet_id(wordnet_id): - """ - Given a Wordnet ID, download images for this class - """ - call([ - "python", - join(app_cfg.DIR_APP, "../ImageNet-Datasets-Downloader/downloader.py"), - '-data_root', app_cfg.FP_IMAGENET, - '-use_class_list', 'True', - '-class_list', wordnet_id, - '-images_per_class', app_cfg.IMAGENET_IMAGES_PER_CLASS - ]) |
