1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
import click
from app.settings import types
from app.models.dataset import Dataset
from app.utils import click_utils
from app.settings import app_cfg as cfg
from app.utils.logger_utils import Logger
log = Logger.getLogger()
@click.command()
@click.option('--index', 'opt_index', type=int, required=True,
help='File index to lookup')
@click.option('--data_store', 'opt_data_store',
type=cfg.DataStoreVar,
default=click_utils.get_default(types.DataStore.SSD),
show_default=True,
help=click_utils.show_help(types.Dataset))
@click.option('--dataset', 'opt_dataset',
type=cfg.DatasetVar,
required=True,
show_default=True,
help=click_utils.show_help(types.Dataset))
@click.pass_context
def cli(ctx, opt_index, opt_data_store, opt_dataset):
"""Display image info"""
import sys
from glob import glob
from os.path import join
from pathlib import Path
import time
import pandas as pd
import cv2 as cv
from tqdm import tqdm
from app.utils import file_utils, im_utils
from app.models.data_store import DataStore
log = Logger.getLogger()
# init dataset
dataset = Dataset(opt_data_store, opt_dataset)
#dataset.load_face_vectors()
dataset.load_records()
dataset.load_identities()
# set data store and load files
# get image record from file index
image_record = dataset.index_to_record(opt_index)
image_record.summarize()
# load image
im = cv.imread(image_record.filepath)
# display
cv.imshow('', im)
# cv gui
while True:
k = cv.waitKey(1) & 0xFF
if k == 27 or k == ord('q'): # ESC
cv.destroyAllWindows()
sys.exit()
elif k != 255:
# any key to continue
break
|