Giter Club home page Giter Club logo

mxnet_mtcnn_face_detection's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mxnet_mtcnn_face_detection's Issues

I can't switch to GPU.

Everything seems to be ok at first. The symbol is successfully upgraded. But after then I encounter a problem which says:
mxnet.base.MXNetError: [09:02:20] c:\jenkins\workspace\mxnet-tag\mxnet\src\storage\pooled_storage_manager.h:119: cudaMalloc failed: unknown error
I have installed the mxnet-cu90.

Extra region after alignment

Hi.

After using extract_image_chips function, in output img I got some extra region which included none face part.
how can I remove this section from output of extract_image_chips function?

best.

How to tweak the parameters to get more faces? (some imgs that have faces but not detected)

image

I see there are two methods, detect_face() and detect_face_limited(). The detect_face() signature is

            img: numpy array, bgr order of shape (1, 3, n, m)
                input image

But the actual shape checking treats an image as a [height, width, channel] array:

        # only works for color image
        if len(img.shape) != 3:
            return None

        # detected boxes
        total_boxes = []

        height, width, _ = img.shape

Therefore the detection fails at some point.

I also tried detect_face_limited(), and saw the [1] and [2] of threshold getting used to do the filtering and decreased those values to get more results. But still, e.g. this picture has four faces, and I'm getting as many as only one.

detector = MtcnnDetector(model_folder='mtcnn-model', ctx=mx.gpu(0), num_worker=1, accurate_landmark = True, threshold=[0.0,-1,-1], minsize=10)
img = cv2.imread("180112-news-friends.jpg")
detector.detect_face_limited(img, 2)

(array([[  5.78239929e+02,  -3.24641838e+01,   1.59770996e+03,
           8.00984070e+02,   2.69610956e-02]], dtype=float32),
 array([[ 932, 1277, 1178,  954, 1229,  302,  275,  414,  628,  599]], dtype=int32))

How can I get all those faces?

Using gpu and from multiprocessing import Pool, mxnet==1.2

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/mxnet/symbol/symbol.py", line 1522, in simple_bind
ctypes.byref(exe_handle)))
File "/usr/local/lib/python3.5/dist-packages/mxnet/base.py", line 251, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [19:18:11] src/storage/storage.cc:65: Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading CUDA: initialization error

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x39008a) [0x7efdbb00208a]
[bt] (1) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x3906c1) [0x7efdbb0026c1]
[bt] (2) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31aba9d) [0x7efdbde1da9d]
[bt] (3) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31b3e58) [0x7efdbde25e58]
[bt] (4) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2a808f6) [0x7efdbd6f28f6]
[bt] (5) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b31baa) [0x7efdbd7a3baa]
[bt] (6) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32235) [0x7efdbd7a4235]
[bt] (7) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32528) [0x7efdbd7a4528]
[bt] (8) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b41d46) [0x7efdbd7b3d46]
[bt] (9) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b42264) [0x7efdbd7b4264]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.5/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/home/chengt1/workspace/ArcFaceVideo/mxnet_align/helper.py", line 168, in detect_first_stage_warpper
return detect_first_stage(*args)
File "/home/chengt1/workspace/ArcFaceVideo/mxnet_align/helper.py", line 156, in detect_first_stage
output = net.predict(input_buf)
File "/usr/local/lib/python3.5/dist-packages/mxnet/model.py", line 700, in predict
self._init_predictor(data_shapes, type_dict)
File "/usr/local/lib/python3.5/dist-packages/mxnet/model.py", line 623, in _init_predictor
self.ctx[0], grad_req='null', type_dict=type_dict, **shapes)
File "/usr/local/lib/python3.5/dist-packages/mxnet/symbol/symbol.py", line 1528, in simple_bind
raise RuntimeError(error_msg)
RuntimeError: simple_bind error. Arguments:
conv4_1_weight: (2, 32, 1, 1)
conv1_weight: (10, 3, 3, 3)
conv4_2_bias: (4,)
conv4_2_weight: (4, 32, 1, 1)
prelu1_gamma: (10,)
conv4_1_bias: (2,)
conv2_bias: (16,)
data: (1, 3, 104, 184)
conv2_weight: (16, 10, 3, 3)
conv3_weight: (32, 16, 3, 3)
prelu3_gamma: (32,)
conv1_bias: (10,)
conv3_bias: (32,)
prelu2_gamma: (16,)
[19:18:11] src/storage/storage.cc:65: Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading CUDA: initialization error

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x39008a) [0x7efdbb00208a]
[bt] (1) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x3906c1) [0x7efdbb0026c1]
[bt] (2) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31aba9d) [0x7efdbde1da9d]
[bt] (3) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31b3e58) [0x7efdbde25e58]
[bt] (4) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2a808f6) [0x7efdbd6f28f6]
[bt] (5) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b31baa) [0x7efdbd7a3baa]
[bt] (6) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32235) [0x7efdbd7a4235]
[bt] (7) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32528) [0x7efdbd7a4528]
[bt] (8) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b41d46) [0x7efdbd7b3d46]
[bt] (9) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b42264) [0x7efdbd7b4264]

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "demo.py", line 11, in
warped = utils_api.detect_centor_face(detector, full_path,chips_method=False)
File "/home/chengt1/workspace/ArcFaceVideo/utils_api.py", line 39, in detect_centor_face
results = detector.detect_face(img)
File "/home/chengt1/workspace/ArcFaceVideo/mxnet_align/mtcnn_detector.py", line 241, in detect_face
zip(repeat(img), self.PNets[:len(batch)], [scales[i] for i in batch], repeat(self.threshold[0])) )
File "/usr/lib/python3.5/multiprocessing/pool.py", line 260, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib/python3.5/multiprocessing/pool.py", line 608, in get
raise self._value
RuntimeError: simple_bind error. Arguments:
conv4_1_weight: (2, 32, 1, 1)
conv1_weight: (10, 3, 3, 3)
conv4_2_bias: (4,)
conv4_2_weight: (4, 32, 1, 1)
prelu1_gamma: (10,)
conv4_1_bias: (2,)
conv2_bias: (16,)
data: (1, 3, 104, 184)
conv2_weight: (16, 10, 3, 3)
conv3_weight: (32, 16, 3, 3)
prelu3_gamma: (32,)
conv1_bias: (10,)
conv3_bias: (32,)
prelu2_gamma: (16,)
[19:18:11] src/storage/storage.cc:65: Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading CUDA: initialization error

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x39008a) [0x7efdbb00208a]
[bt] (1) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x3906c1) [0x7efdbb0026c1]
[bt] (2) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31aba9d) [0x7efdbde1da9d]
[bt] (3) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x31b3e58) [0x7efdbde25e58]
[bt] (4) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2a808f6) [0x7efdbd6f28f6]
[bt] (5) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b31baa) [0x7efdbd7a3baa]
[bt] (6) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32235) [0x7efdbd7a4235]
[bt] (7) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b32528) [0x7efdbd7a4528]
[bt] (8) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b41d46) [0x7efdbd7b3d46]
[bt] (9) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b42264) [0x7efdbd7b4264]

mx.model.FeedForward.load() load parameters directly, but there are not network structure definition?

mx.model.FeedForward.load() load parameters directly, but there are not network structure definition?
"# load 4 models from folder
models = ['det1', 'det2', 'det3','det4']
models = [ os.path.join(model_folder, f) for f in models]", this program loads which model, because the name of model doesn't have det1, but det1.caffemodel, det1.prototxt, det1-0001.poarmas, det1-symbol.json. which one it loads?

How did you handle matlab caffe model

Hi @pangyupo,

Thanks for sharing your implementation. I was wondering how you dealt with the matlab trained caffe weights. Because matlab is column-major and the images are in rgb order. That is how the original network was trained. I implemented a python/caffe version myself but I needed to do necessary transformations to get the correct output.

Looking forward to hearing from you,
Best,
Cha

opencv problem when run `python main.py`

Env:
macOS: 10.12.5 Sierra
opencv: 3.3.0
mxnet: 0.10.1
python: 2.7

Error:
/usr/local/opt/opencv/lib/libopencv_calib3d.2.4.dylib not loaded because it does't exists.
But it exists other versions:

/usr/local/opt/opencv/lib/libopencv_calib3d.3.3.0.dylib
/usr/local/opt/opencv/lib/libopencv_calib3d.3.3.dylib -> libopencv_calib3d.3.3.0.dylib
/usr/local/opt/opencv/lib/libopencv_calib3d.dylib -> libopencv_calib3d.3.3.dylib

I don't know why it must load 2.4.

Full error here:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import mxnet as mx
  File "/usr/local/lib/python2.7/site-packages/mxnet-0.10.1-py2.7.egg/mxnet/__init__.py", line 7, in <module>
    from .base import MXNetError
  File "/usr/local/lib/python2.7/site-packages/mxnet-0.10.1-py2.7.egg/mxnet/base.py", line 52, in <module>
    _LIB = _load_lib()
  File "/usr/local/lib/python2.7/site-packages/mxnet-0.10.1-py2.7.egg/mxnet/base.py", line 44, in _load_lib
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/python2.7/site-packages/mxnet-0.10.1-py2.7.egg/mxnet/libmxnet.so, 10): Library not loaded: /usr/local/opt/opencv/lib/libopencv_calib3d.2.4.dylib
  Referenced from: /usr/local/lib/python2.7/site-packages/mxnet-0.10.1-py2.7.egg/mxnet/libmxnet.so
  Reason: image not found

Detecting faces in list of images

How do i use this code to detect faces in not one image but in a folder which contains images?. I tried using a for loop but it wasn't working.The error i get is because of the multiprocessing used in this code.

Your code does not work for the following image and is likely to be buggy.

It gives negatives in [dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph].

It seems like your conversion from matlab indexing to python indexing is wrong somewhere. I advise you to not do the conversion in the middle. You should follow the matlab code and only converts it to python indexing at the very end since the code is trained in matlab.

sean vincent gillis-48-9528190

I got a RuntimeError.

Since I'm using Python 3.5, I made the following changes to the mtcnn_detector.py:

try:
    from itertools import izip
except ImportError:
    izip = zip

But then when I run the main.py, it says that:

RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

I don't know what happened.

How to change the parameters to prove the detect performance?

I set num_worker = 1 , accurate_landmark = False and test on lfw (using your pre-trained model), then there are four photos the model didn't detect out the faces. There are:

  • Arsinee_Khanjian_0001.jpg
  • John_Wayne_0001.jpg
  • Marilyn_Monroe_0002.jpg
  • Muhammad_Saeed_al-Sahhaf_0003.jpg

so my question is if there is a way to prove the detect performance a little bit to avoid these four failures? or a practical way to fix(or make up) this problem when it happens during the task of detecting and aligning?

padding 0.37 ?

chips = detector.extract_image_chips(img, points, 144, 0.37)
what does it mean to pad 0.37? Thanks

training code

@pangyupo Thank you for the open source code, how get the training code. I want to optimize the face detection time to real-time detection on cpu.

Why using GPU become less efficient?

Test time for detect_face:

start_time = time.time()
# run detector
results = detector.detect_face(img)
end_time = time.time()
diff = end_time - start_time
print datetime.timedelta(seconds=diff)
  • ctx=mx.gpu(0), num_work=1 takes 1.807s

  • ctx=mx.gpu(0), num_work=4 takes 2.307s

  • ctx=mx.cpu(0), num_work=4 takes0.601s

ps : GTX1070

Bug fixed: "could not broadcast input array from shape" and "negative dimensions are not allowed""

Thanks a lot for sharing your code. I am sharing with you how I managed to fix two errors when running your code. Maybe it can help who face the same problems. For some reason, just two images in my dataset generated these errors, on file mtcnn_detector.py:

error 1)
could not broadcast input array from shape (0,63,3) into shape (58,63,3), where "63" can be any other value...

error 2)
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
ValueError: negative dimensions are not allowed.

The two new conditions below fixed (temporary, as I didn't track the source of it) the problem:

(line 280)
# pad the bbox
[dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph] = self.pad(total_boxes, width, height)
# (3, 24, 24) is the input shape for RNet
input_buf = np.zeros((num_box, 3, 24, 24), dtype=np.float32)

    for i in range(num_box):
        if(tmph[i]>0):         # << WARNING (bug fixed)
            tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
            if(edy[i]>=0):     # << WARNING (bug fixed)
                tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = img[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
                input_buf[i, :, :, :] = adjust_input(cv2.resize(tmp, (24, 24)))

    output = self.RNet.predict(input_buf)

Failed to allocate CPU memory Python 32bit

Hello!
Sometimes we get exception "Failed to allocate CPU memory" in detect_face function.
We use mtcnn to get face boundary boxes, then we send it to model to get "embeddings" in this https://github.com/deepinsight/insightface.
Exeception occurs on face detection stage. More precisely - on n 362 - 364 lines https://github.com/deepinsight/insightface/blob/be3b7ccad3a1702f7d2baa0e1d4d0818551da93a/deploy/mtcnn_detector.py#L362
We explore, that exception disappear while we switch off mxnet multithreading (i.e. MXNET_ENGINE_TYPE=NaiveEngine)
We try on Windows-7, python both 3.6 and 2.7 32 bit.
In Oracle VirtualBox with similar parameters as in up lines, exception occurs once and after it gone away.

We opened two issues (it viewed here more widely): https://stackoverflow.com/questions/54834022/failed-to-allocate-cpu-memory-python-32bit, https://github.com/deepinsight/insightface/issues/540, but nobody answered yet.
We will great appreciate to any kind of assistance.

mxnet.model.FeedForward has been deprecated

when I run main.py, it reports the error as follows:

[18:54:04] src/nnvm/legacy_json_util.cc:153: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[Deprecation Warning] mxnet.model.FeedForward has been deprecated. Please use mxnet.mod.Module instead.

I want to install mxnet v0.8.0, but I can't find the compiled mxnet v0.8.0 for python.
I also don't know how to use mxnet.mod.Module to modify the code.

multithreading fails

Hi,
In the following code d1.detect_face is working properly but when I call d2.detect_face the program get stocked and nothing happens. I think there should be a problem with multi thread processing with Pool, because when I use detect_first_stage instead of detect_first_stage_warpper with just one of the nets it was OK.

d = MtcnnDetector(model_folder=model_path, ctx=mx.cpu(0), minsize=minsize, num_worker=4, accurate_landmark=False) 
d2 = MtcnnDetector(model_folder=model_path, ctx=mx.cpu(0), minsize=minsize, num_worker=4, accurate_landmark=False)
d1.detect_face(image)
d2.detect_face(image)

src/ndarray/ndarray.cc:291: Check failed: from.shape() == to->shape() operands shape mismatch

Traceback (most recent call last):
File "main.py", line 14, in
results = detector.detect_face(img)
File "/home//mxnet_mtcnn_face_detection/mtcnn_detector.py", line 291, in detect_face
output = self.RNet.predict(input_buf)
File "/home/
/mxnet_mtcnn_face_detection/mxnet/model.py", line 599, in predict
self._init_predictor(data_shapes)
File "/home//mxnet_mtcnn_face_detection/mxnet/model.py", line 531, in _init_predictor
pred_exec.copy_params_from(self.arg_params, self.aux_params)
File "/home/
/mxnet_mtcnn_face_detection/mxnet/executor.py", line 256, in copy_params_from
array.astype(dst.dtype).copyto(dst)
File "/home//mxnet_mtcnn_face_detection/mxnet/ndarray.py", line 499, in copyto
return _internal._copyto(self, out=other)
File "/home/
/mxnet_mtcnn_face_detection/mxnet/ndarray.py", line 1174, in unary_ndarray_function
c_array(ctypes.c_char_p, [c_str(str(i)) for i in kwargs.values()])))
File "/home/****/mxnet_mtcnn_face_detection/mxnet/base.py", line 77, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [10:14:13] src/ndarray/ndarray.cc:291: Check failed: from.shape() == to->shape() operands shape mismatch

How to solve it, i just run your demo?

卡通图片误检率非常高

fuck
此repo提供的MTCNN对卡通图片误检率特别高,但原版MTCNN并不会这样,不知是对MTCNN做了何种处理?原版MTCNN在同样的参数下在RNet的时候就会reject此图

Can the model detect and align once one batch?

It is too slow to do the face detection and alignment when dataset is large if process images one by one. So I wander if it is possible to change your script a little bit to make it work when the input is a batch?

GPU use question

When I use GPU, I encounter this problem:

[11:16:43] /home/njfh/alex/mxnet/dmlc-core/include/dmlc/logging.h:300: [11:16:43] src/c_api/c_api_ndarray.cc:390: Operator _zeros cannot be run; requires at least one of FCompute, NDArrayFunction, FCreateOperator be registered

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/mxnet-0.9.5-py2.7.egg/mxnet/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x3c) [0x7f34bf503a5c]
[bt] (1) /usr/local/lib/python2.7/dist-packages/mxnet-0.9.5-py2.7.egg/mxnet/libmxnet.so(MXImperativeInvoke+0x66d) [0x7f34bfd9811d]
[bt] (2) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f34c2976adc]
[bt] (3) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x1fc) [0x7f34c297640c]
[bt] (4) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x48e) [0x7f34c2b8d5fe]
[bt] (5) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x15f9e) [0x7f34c2b8ef9e]
[bt] (6) python(PyEval_EvalFrameEx+0x98d) [0x5244dd]
[bt] (7) python(PyEval_EvalCodeEx+0x2b1) [0x555551]
[bt] (8) python(PyEval_EvalFrameEx+0x1a10) [0x525560]
[bt] (9) python(PyEval_EvalCodeEx+0x2b1) [0x555551]

Can you tell me how to solve this problem? @pangyupo Thank you very much!

换成GPU 后速度超慢

如题,我把设备换成GPU后速度比CPU 慢很多,要6s ,这是为啥。是跟库的版本有关系嘛

Understanding cascading of sizes in mtcnn

Hi,
Im trying to follow through the code and understand how mtcnn works. I understand that for each image, for each scale the detection comes from each of the networks. In particular I am talking about the Pnet right now.

# Code file: mtcnn_detector.py
local_boxes = self.Pool.map( detect_first_stage_warpper, izip(repeat(img), self.PNets[:len(batch)], [scales[i] for i in batch], repeat(self.threshold[0])) )

The image is rescaled according to the scales produced earlier and the rescaled image (now called input_buf) goes into the Pnet.

# Code file: helper.py
# ORIGINAL Height:  340
# ORIGINAL Width:  151
# SCALE USED (were computed before):  0.107493555074
# RESCALED Height:  37
# RESCALED Width:  17 
output = net.predict(input_buf)  

For reference I have printed out the original size and the rescaled size.
The net corresponds to Pnet and in det1.prototxt (PNet) the input size should have h=12 and w=12.

# Code file: det1.prototxt 
input_dim: 1
input_dim: 3
input_dim: 12
input_dim: 12

What I don't understand is where is the size going from size of input_buf to 12x12?

GPU memory leak issue

Hi,
When I use GPU to do face detection, I found that the memory used of the GPU keep increasing. Maybe there is an memory leak issue.

The detector I used as flowing:
mtcnn_detector = MtcnnDetector(model_folder='model', ctx=mx.gpu(0), num_worker = 1, minsize = 40, accurate_landmark = True)

improve speed by opening mxnet_cudnn_autotune option

not an issue.

first great jobs.
you can open mxnet_cudnn_autotune option by export MXNET_CUDNN_AUTOTUNE_DEFAULT=1 when using gpu and benchmark at the second detection pass.
on gtx 1080, I get 90ms with your result image.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.