summaryrefslogtreecommitdiff
path: root/cli/app/commands/biggan/search_dense.py
blob: b7433502ed1802d2567aac1a1c4a088d7ccee0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import click

from app.search.params import Params, timestamp
from app.search.search_dense import find_dense_embedding_for_images

@click.command('')
@click.option('-i', '--input', 'opt_fp_in', required=True, 
  help='Path to input image')
@click.option('-t', '--tag', 'opt_tag', default="inverse_" + timestamp(), 
  help='Tag this build')
@click.option('-ll', '--feature_layers', 'opt_feature_layers', default="1a,2a,4a,7a",
  help='Feature layers used for loss')
@click.option('-s', '--save_progress', 'opt_save_progress', is_flag=True,
  help='Save example images every 500 frames')
@click.pass_context
def cli(ctx, opt_fp_in, opt_tag, opt_feature_layers, opt_save_progress):
  """
  Search for an image (class vector) in BigGAN using gradient descent
  """
  params = Params(opt_fp_in)
  opt_feature_layers = opt_feature_layers.split(',')
  find_dense_embedding_for_images(params, opt_tag=opt_tag, opt_feature_layers=opt_feature_layers, opt_save_progress=opt_save_progress)