happynear / caffe-windows

Configure Caffe in one hour for Windows users.
Other
1.32k stars 649 forks source link

caffe.binding #277

Open goxiaobu opened 6 years ago

goxiaobu commented 6 years ago

Great work,thanks for sharing, I appreciate it! I am trying to apply caffe.binding project to encapsulate a DLL to extract face features. I am not very clear on how to use the functions you have supplied. Can you give an example to explain how to use it or give some annotation about the function, especially the function Forward,SetBlobData and GetBlobData? Anticipates your reply~~

happynear commented 6 years ago

I have an example of using it to do face detection. Load network: https://github.com/happynear/MTCNN_face_detection_alignment/blob/master/code/codes/vs/Test/TestFaceDetection.inc.h#L58

Forward one sample: https://github.com/happynear/MTCNN_face_detection_alignment/blob/master/code/codes/vs/Test/TestFaceDetection.inc.h#L78

Forward many samples: https://github.com/happynear/MTCNN_face_detection_alignment/blob/master/code/codes/vs/Test/TestFaceDetection.inc.h#L274

SetBlobData: kCaffeBinding->SetBlobData("stitch_data", {100,3,112,96}, data_ptr, net_id); Here data_ptr is a float pointer of the data.

SetBlobData: caffe::DataBlob data_blob = kCaffeBinding->GetBlobData("stitch_data", net_id); Then you can read the size, name and a float pointer of the targeting blob.