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

from app.search.search_class import find_nearest_vector_for_images

@click.command('')
@click.option('-i', '--input', 'opt_fp_in', required=True, 
  help='Path to input image')
@click.option('-d', '--dims', 'opt_dims', default=512, type=int,
  help='Dimensions of BigGAN network (128, 256, 512)')
@click.option('-s', '--steps', 'opt_steps', default=2000, type=int,
  help='Number of optimization iterations')
@click.option('-l', '--limit', 'opt_limit', default=1000, type=int,
  help='Limit the number of images to process')
@click.option('-v', '--video', 'opt_video', is_flag=True,
  help='Export a video for each dataset')
@click.option('-t', '--tag', 'opt_tag', default='inverse_' + str(int(time.time() * 1000)), 
  help='Tag this dataset')
# @click.option('-r', '--recursive', 'opt_recursive', is_flag=True)
@click.pass_context
def cli(ctx, opt_fp_in, opt_dims, opt_steps, opt_limit, opt_video, opt_tag):
  """
  Search for an image (class vector) in BigGAN using gradient descent
  """
  find_nearest_vector_for_images(opt_fp_in, opt_dims, opt_steps, opt_limit, opt_video, opt_tag)