deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
23.33k stars 5.41k forks source link

Paid help request C++ #399

Closed AnjeliquePink closed 5 years ago

AnjeliquePink commented 6 years ago

Hi,

We have small budget to use:

We need to use model from C++ and extract futures like in test.py

Is there anyone who expert on the both C++ and mxnet to spare a few hours?

Best

hoavt-54 commented 5 years ago

Did you solve it?

MyraBaba commented 5 years ago

not exactly.. I have the c++ feature extraction but still miles to go..

do you know how we can do this ? or wanna help?

hoavt-54 commented 5 years ago

I started with the classification example from Mxnet cpp. And that's all you need. Did you try that? I got the same accuracy as I got on Python. However, on my dataset Facenet performs much better.

AnjeliquePink commented 5 years ago

@hoavt-54

There is steps I need to follow to get same results as python (%99.8) from pre trained model.

1 - Preprocessing of the face picture should be the same as in the pythons. Aligning etc . Which is :

def get_input(self, face_img): ret = self.detector.detect_face(face_img, det_type = self.args.det) if ret is None: return None , None bbox, points = ret if bbox.shape[0]==0: return None bbox = bbox[0,0:4] points = points[0,:].reshape((2,5)).T

print(bbox)

print(points)

nimg = face_preprocess.preprocess(face_img, bbox, points, image_size='112,112') nimg = cv2.cvtColor(nimg, cv2.COLOR_BGR2RGB) aligned = np.transpose(nimg, (2,0,1)) return aligned , points part.

I have not the same functionality in c++ . Specially face_preprocess part.

2 - Extract futures :

I can extract futures from the model. Thats ok. Need to test same input image from both python and c++

3 - Compare :

compare two extracted futures :

NDARRAY has some * for squra I think we can handle..

sim = np.dot(compare_desc, people_desc_np) dist = np.sum(np.square(compare_desc - people_desc_np))

On 12 Nov 2018, at 13:02, hoavt-54 notifications@github.com wrote:

I started with the classification example from Mxnet cpp https://github.com/apache/incubator-mxnet/tree/master/example/image-classification/predict-cpp. And that's all you need. Did you try that? I got the same accuracy as I got on Python. However, on my dataset Facenet performs much better.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/deepinsight/insightface/issues/399#issuecomment-437822625, or mute the thread https://github.com/notifications/unsubscribe-auth/AqE8hlpNpUzGskeO7_V-DYn5m2DMlqZIks5uuUccgaJpZM4XtfRY.

stereomatchingkiss commented 5 years ago

I solve the problem already, I use dlib to detect, align the face, compare features with deepinsight, you can find the example at youtube

MyraBaba commented 5 years ago

Can you share the c++ part of the deepinsight ? Or you used the python for recognition ?

stereomatchingkiss commented 5 years ago

Can you share the c++ part of the deepinsight ? Or you used the python for recognition ?

Sure, source codes located at github Writing a blog for this small example, will post it at here after it is done.

If you need more helps, you can find my upwork account at here.

By the way, that youtube video, the algorithm is finding most similar faces in 25 faces.

MyraBaba commented 5 years ago

Thanks.. I looked . It developed in windows so little bir painfull for linux :)

will touch you

stereomatchingkiss commented 5 years ago

I know, this is one of the biggest drawback of c++ if you ask me(another is tiny standard library). You can try vcpkg, it is a package manager create for c++, maybe save you some paint of building different libraries on different platform

MyraBaba notifications@github.com 於 2019年2月17日 週日 上午4:39寫道:

Thanks.. I looked . It developed in windows so little bir painfull for linux :)

will touch you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/deepinsight/insightface/issues/399#issuecomment-464382686, or mute the thread https://github.com/notifications/unsubscribe-auth/ABt-uqdepuZ3TcdjSo5BLxX1-16RRMDOks5vOGxmgaJpZM4XtfRY .

stereomatchingkiss commented 5 years ago

Post a blog to explain how to use opencv, dlib and mxnet to create a face recognition application.

MyraBaba commented 5 years ago

@stereomatchingkiss

did you try to align face with mtcnn ? Is there any way in c++ align faces after detecting with mtcnn ? I am detecting with mtcnn so I have mtcnn square and the 5 points .

stereomatchingkiss commented 5 years ago

did you try to align face with mtcnn ?

No, don't think it worth the troubles

Is there any way in c++ align faces after detecting with mtcnn ?

There are a few ways

  1. Write the alignment algorithm algorithm by yourself
  2. Use the class in cpp-align
  3. Use the function of dlib--extract_image_chip
MyraBaba commented 5 years ago

is dlib extract image requires to detect faces again after mtcnn ?

is there any small working example of the cpp-align usage ?

best

stereomatchingkiss commented 5 years ago

is dlib extract image requires to detect faces again after mtcnn ?

no, you can use face detector of dlib, it is a marvelous one

small working example of the cpp-align usage

don't know, never tried it before, and don't have much interest to use it in my free, open source project

MyraBaba commented 5 years ago

We used dlib thats very good.

But when you need to run on CPU dlib slower than the mtcnn (dlib non DNN face detection)

stereomatchingkiss commented 5 years ago

You can use opencv, dlib or mtcnn to detect face, alignment is an algorithm independent with face detect algorithm

MyraBaba notifications@github.com 於 2019年2月19日 週二 下午9:06寫道:

We used dlib thats very good.

But when you need to run on CPU dlib slower than the mtcnn (dlib non DNN face detection)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/deepinsight/insightface/issues/399#issuecomment-465120818, or mute the thread https://github.com/notifications/unsubscribe-auth/ABt-uqtRw0t6tGqmbslJB_GrqXN4ktdnks5vO_a3gaJpZM4XtfRY .

njvisionpower commented 5 years ago

I implement the full insightface cpp pipeline recognition with camera, and also some optimization on mtcnn, make speed up than original python version: mxnet-insightface-cpp This project only depends on mxnet and opencv. Hope it's helpful.

MyraBaba commented 5 years ago

@stereomatchingkiss

Hi,

We have 1080p RTSP video feed and 1060ti Nvidia card. It looks like a bit slow and can't reach the video feed even we reduce the fps 14. Do we need to have another step to increase DlibCNN detector such as sending two frames at once? what is your suggestion for 1080p RTSP video stream for fast and accurate detection?

youthM commented 5 years ago

Hi, the link can't be opened. @njvisionpower

symisc commented 4 years ago

@MyraBaba Checkout the SOD project which handle face detection and recognition at real-time on the CPU (No GPU needed). https://sod.pixlab.io

stereomatchingkiss commented 4 years ago

@stereomatchingkiss

Hi,

We have 1080p RTSP video feed and 1060ti Nvidia card. It looks like a bit slow and can't reach the video feed even we reduce the fps 14. Do we need to have another step to increase DlibCNN detector such as sending two frames at once? what is your suggestion for 1080p RTSP video stream for fast and accurate detection?

I convert the model to onnx model and load it by opencv, works well, much easier to make it work compare with mxnet