Exemplo n.º 1
0
time.sleep(3)
servers.wait_until_stop('sample')

time.sleep(3)

new_result = "{0}{1}{2}-result.csv".format(directory, os.sep, version)
print(result)
print(new_result)
shutil.copyfile(result, new_result)
error_name = "{0}{1}{2}----result.xlsx".format(directory, os.sep, version)

if options.test_type == 'detect':
    # 生成图片
    names = data_common.file2list(result, basename=True)
    data_common.output_file('/home/andrew/code/tmp/detection_results.txt',
                            names)
    subprocess.call(
        "cd  /home/andrew/code/tmp/facedet-profile && rm -rf cache",
        shell=True)
    subprocess.check_output(
        "cd /home/andrew/code/tmp/facedet-profile  && python3 get_roc.py > {}/log.txt"
        .format(directory),
        shell=True)
    print("copyinig")
    src = "/home/andrew/code/tmp/facedet-profile/roc.png"
    dst = "{}/{}-roc.png".format(directory, version)
    time.sleep(0.5)
    shutil.copyfile(src, dst)

if options.test_type != 'verify':
    values = "{0}{1}{2}-values.csv".format(directory, os.sep, version)
Exemplo n.º 2
0
    process = []
    queue = multiprocessing.Queue()
    results = multiprocessing.Manager().list()
    lock = multiprocessing.Lock()
    if multiprocessing.cpu_count() < 3:
        number = multiprocessing.cpu_count()
    else:
        number = multiprocessing.cpu_count() - 1

    # Launch the consumer process
    for i in range(number):
        t = multiprocessing.Process(target=consumer,
                                    args=(queue, results, lock))
        t.daemon = True
        process.append(t)

    for i in range(number):
        process[i].start()

    for item in df['ir']:
        queue.put(item)

    for i in range(number):
        queue.put(None)

    for i in range(number):
        process[i].join()

    data_common.output_file("output.txt", results)
Exemplo n.º 3
0
# wait for result
if not options.w:
    exit(0)

# anlyse result
result = "{0}{1}{2}{1}{2}_output%files.txt.csv".format(
    tool, os.sep, options.test_type)
servers.wait_until_stop(types[options.test_type]['process'])
new_result = "{0}{1}{2}-result.csv".format(directory, os.sep, version)
shutil.copyfile(result, new_result)

if options.test_type != 'verify':
    values = "{0}{1}{2}-values.csv".format(directory, os.sep, version)
    maps = data_common.concat_file(new_result, file_name, sep=',')
    data_common.output_file(values, maps)    

if options.test_type == 'liveness':
    new_result_ = "{0}{1}{2}-result_.csv".format(directory, os.sep, version)
    shutil.copyfile(result, new_result_)
    cmd = "sed -i  's#-1#1#' {}".format(new_result_)
    subprocess.call(cmd,shell=True)
     
    if options.data_type == 'base':
        replace = '/home/andrew/code/data/tof/base_test_data/vivo-liveness/'
    else:
        replace = ''
    error_name = "{0}{1}{2}-result.xlsx".format(directory, os.sep, version)
    servers.get_liveness_server_result(new_result, file_name, label_name, 
        replace=replace, error_name=error_name)
Exemplo n.º 4
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author:    xurongzhong#126.com 
# CreateDate: 2018-3-31

import os
import argparse
from pathlib import Path

import data_common 

parser = argparse.ArgumentParser()
parser.add_argument('file1', action="store")
parser.add_argument('file2', action='store', help='测试类型')
parser.add_argument('-s', action='store', dest='sep', default=' ',
                    help='分隔符')
parser.add_argument('--version', action='version',
                    version='%(prog)s 1.0 Rongzhong xu 2018 03 31')
options = parser.parse_args()

new = data_common.concat_file(options.file1,options.file2,options.sep)
data_common.output_file(options.file1, new)


Exemplo n.º 5
0
results = []
poses = []
for filename in files:
    d = json.load(open(filename))
    name = d['image']['rawFilename'].strip('.jpg')
    pos = d['objects']['face'][0]['position']
    num = len(d['objects']['face'])
    if num > 1:
        print(filename)
        print(name)
        pprint.pprint(d['objects']['face'])
    out = "# {}\n{}\n3 640 480 1\n0\n{}\n".format(i, name, num)
    for face in d['objects']['face']:
        pos = face['position']
        top = round(pos['top'])
        bottom = round(pos['bottom'])
        left = round(pos['left'])
        right = round(pos['right'])
        out = out + "1 {} {} {} {}\n".format(left, top, right, bottom)
        poses.append("{},{},{},{},{},{},{}".format(name, left, top, right,
                                                   bottom, right - left,
                                                   bottom - top))
    i = i + 1
    #print(out)
    file_list.append(name)
    results.append(out.rstrip('\n'))

data_common.output_file("files.txt", file_list)
data_common.output_file("results.txt", results)
data_common.output_file("poses.txt", poses)
Exemplo n.º 6
0
if options.type_name == 'android':
    print('In android')
    df = pd.read_excel(options.filename,
                       usecols=[0, 4],
                       names=['name', 'result'])
    rename = lambda x: os.path.basename(x)
    df['name'] = df['name'].apply(rename)
    print(df.head())
    for num in range(len(df)):
        row = df.iloc[num]
        result = row['result']
        if result != '未检测到人脸':
            temps = result.split('[')
            left, top, = temps[1].strip(']').split(',')
            right, bottom = temps[2].strip(']').split(',')
            out = "# {}\n{}\n3 640 480 1\n0\n1\n".format(i, row['name'])
            out = out + "1 {} {} {} {}\n".format(left, top, right, bottom)
            detection_result = "{0} {1} {2} {3} {4} 1 {5}".format(
                row['name'], left, top,
                int(right) - int(left),
                int(bottom) - int(top), 0.99)
            i = i + 1
            #print(out)
            file_list.append(row['name'])
            results.append(out.rstrip('\n'))
            detection_results.append(detection_result)

data_common.output_file("files.txt", file_list)
data_common.output_file("gt.txt", results)
data_common.output_file("dt.txt", detection_results)