Beispiel #1
0
def main(args):
    start1 = time.time()
    model = fr.setup(args)
    if (args.verbose):
        print("Setup time:", time.time() - start1)
    data_directory_list = os.listdir(args.testData)
    matrix = {}
    detect = 0
    not_detect = 0
    for d in data_directory_list:
        dir_name = args.testData + "/" + d

        image_filename_list = [
            dir_name + "/" + i for i in os.listdir(dir_name)
            if i.endswith(".jpg")
        ]
        t = time.time()
        for image_filename in image_filename_list:
            output = fr.run(model, image_filename, args.threshold)
            if len(output) == 0:
                not_detect += 1
                if (args.verbose):
                    print("No result", image_filename)
                continue

            if d in matrix:
                if output[0] in matrix[d]:
                    matrix[d][output[0]] += 1
                else:
                    matrix[d][output[0]] = 1
            else:
                matrix[d] = {output[0]: 1}
            detect += 1
            if (args.verbose):
                print("Time for processing", time.time() - t)
            t = time.time()

    if (args.verbose):
        print not_detect, detect
        print matrix
Beispiel #2
0
def main(args):
    start1 = time.time()
    model = fr.setup(args)
    if (args.verbose):
        print("Setup time:", time.time() - start1)
    DATA_DIR = args.testData
    data_directory_list = os.listdir(DATA_DIR)
    matrix = {}
    detect = 0
    not_detect = 0
    for d in data_directory_list:
        dir_name = DATA_DIR + "/" + d

        image_filename_list = [
            dir_name + "/" + i for i in os.listdir(dir_name)
            if i.endswith(".jpg")
        ]

        for image_filename in image_filename_list:
            args.testData = image_filename
            output = fr.run(model, args)
            if len(output) == 0:
                not_detect += 1
                if (args.verbose):
                    print("No result", image_filename)
                continue

            if d in matrix:
                if output in matrix[d]:
                    matrix[d][output[0]] += 1
                else:
                    matrix[d] = {output[0]: 1}
            else:
                matrix[d] = {output[0]: 1}
            detect += 1

    if (args.verbose):
        print not_detect, detect
        print matrix