예제 #1
0
    'result': 0
}, {
    'res': 1080,
    'file': './1_1920x1080.jpg',
    'minsize': 80,
    'cpus': 2,
    'result': 0
}, {
    'res': 1080,
    'file': './1_1920x1080.jpg',
    'minsize': 200,
    'cpus': 2,
    'result': 0
}]

m.init('./model/')
print('warming up')
m.set_minsize(40)
m.set_num_threads(1)
m.set_threshold(0.6, 0.7, 0.8)
result = m.detect('./1_854x480.jpg')
print(result)
m.detect('./1_854x480.jpg')
m.detect('./1_854x480.jpg')
m.detect('./1_854x480.jpg')
m.detect('./1_854x480.jpg')
print('starting up')

rounds = 20

for item in benchmark:
예제 #2
0
from __future__ import print_function

import face_detection as m
import json, cv2, os
import numpy as np
from scipy import misc
import face_preprocess
import time

minsize = int(os.getenv("MINIMAL_FACE_RESOLUTION", default="100"))  # minimum size of face, 100 for 1920x1080 resolution, 70 for 1280x720.
threads_number = int(os.getenv("THREADS_NUM_FACE_DETECTOR", default="1"))
image_size = 160
margin = 16
BLURY_THREHOLD = 5

m.init('./model')
m.set_minsize(minsize)
m.set_threshold(0.6,0.7,0.8)
m.set_num_threads(threads_number)

def get_filePath_fileName_fileExt(filename):
    (filepath,tempfilename) = os.path.split(filename)
    (shotname,extension) = os.path.splitext(tempfilename)
    return filepath, shotname, extension

def prewhiten(x):
    mean = np.mean(x)
    std = np.std(x)
    std_adj = np.maximum(std, 1.0/np.sqrt(x.size))
    y = np.multiply(np.subtract(x, mean), 1/std_adj)
    return y
예제 #3
0
import face_detection as m
import time

m.init('./models/ncnn/')
print('warming up')

m.set_minsize(40)
m.set_threshold(0.6, 0.7, 0.8)
m.set_num_threads(1)

m.detect('./images_480p/1_854x480.jpg')
m.detect('./images_480p/1_854x480.jpg')
m.detect('./images_480p/1_854x480.jpg')
m.detect('./images_480p/1_854x480.jpg')
m.detect('./images_480p/1_854x480.jpg')

start = time.time()
for i in range(100):
    step_start = time.time()
    result = m.detect('./images_480p/1_854x480.jpg')
    step_end = time.time()
    print('step {} duration is {}'.format(i, step_end - step_start))
end = time.time()
print(result)

print('average duration is {}'.format((end - start) / 100))