示例#1
0
def modeltest():
    #上面函数为测试flask程序使用。
    parser = argparse.ArgumentParser(description='Test')
    parser.add_argument(
        '--iter',
        default='-1',
        type=int,
        help='iter: iteration of the checkpoint to load. Default: 80000')
    parser.add_argument(
        '--batch_size',
        default='1',
        type=int,
        help='batch_size: batch size for parallel test. Default: 1')
    parser.add_argument(
        '--cache',
        default=False,
        type=boolean_string,
        help='cache: if set as TRUE all the test data will be loaded at once'
        ' before the transforming start. Default: FALSE')
    opt = parser.parse_args()
    m = initialization(conf, test=opt.cache)[0]

    # load model checkpoint of iteration opt.iter
    print('Loading the model...')
    m.load()
    print('Transforming...')
    time = datetime.now()

    probe = m.transform('probe', opt.batch_size)
    gallery = m.transform('gallery', opt.batch_size)

    return evaluation(probe, gallery)
示例#2
0
def modeltrain():
    parser = argparse.ArgumentParser(description='Train')
    parser.add_argument(
        '--cache',
        default=True,
        type=boolean_string,
        help='cache: if set as TRUE all the training data will be loaded at once'
        ' before the training start. Default: TRUE')
    opt = parser.parse_args()

    m = initialization(conf, train=opt.cache)[0]

    print("Training START")
    m.fit()
    print("Training COMPLETE")
示例#3
0
from model.initialization import initialization
from config import conf
import argparse


def boolean_string(s):
    if s.upper() not in {'FALSE', 'TRUE'}:
        raise ValueError('Not a valid boolean string')
    return s.upper() == 'TRUE'


parser = argparse.ArgumentParser(description='Train')
parser.add_argument(
    '--cache',
    default=True,
    type=boolean_string,
    help='cache: if set as TRUE all the training data will be loaded at once'
    ' before the training start. Default: TRUE')
opt = parser.parse_args()

if __name__ == '__main__':
    m = initialization(conf, train=opt.cache)[0]

    print("Training START")
    m.fit()
    print("Training COMPLETE")
示例#4
0
parser.add_argument(
    '--iter',
    default='-1',
    type=int,
    help='iter: iteration of the checkpoint to load. Default: 80000')
parser.add_argument(
    '--batch_size',
    default='1',
    type=int,
    help='batch_size: batch size for parallel test. Default: 1')
parser.add_argument(
    '--cache',
    default=False,
    type=boolean_string,
    help='cache: if set as TRUE all the test data will be loaded at once'
    ' before the transforming start. Default: FALSE')
opt = parser.parse_args()

m = initialization(conf, test=opt.cache)[0]

# load model checkpoint of iteration opt.iter
print('Loading the model...')
m.load()
print('Transforming...')
time = datetime.now()

probe = m.transform('probe', opt.batch_size)
gallery = m.transform('gallery', opt.batch_size)

evaluation(probe, gallery)
示例#5
0
文件: test.py 项目: tree96/GaitSet
    '--batch_size',
    default='1',
    type=int,
    help='batch_size: batch size for parallel test. Default: 1')
opt = parser.parse_args()


# Exclude identical-view cases
def de_diag(acc, each_angle=False):
    result = np.sum(acc - np.diag(np.diag(acc)), 1) / 10.0
    if not each_angle:
        result = np.mean(result)
    return result


m = initialization(conf, test=True)[0]

# load model checkpoint of iteration opt.iter
print('Loading the model of iteration %d...' % opt.iter)
m.load(opt.iter)
print('Transforming...')
time = datetime.now()
test = m.transform('test', opt.batch_size)
print('Evaluating...')
acc = evaluation(test, conf['data'])
print('Evaluation complete. Cost:', datetime.now() - time)

for i in range(1):
    print('===Rank-%d (Include identical-view cases)===' % (i + 1))
    print('NM: %.3f,\tBG: %.3f,\tCL: %.3f' % (np.mean(
        acc[0, :, :, i]), np.mean(acc[1, :, :, i]), np.mean(acc[2, :, :, i])))