cyberfire / tensorflow-mtcnn Goto Github PK
View Code? Open in Web Editor NEWC++ and python Inference only for MTCNN face detector on Tensorflow. Based on davidsandberg's facenet project:
License: MIT License
C++ and python Inference only for MTCNN face detector on Tensorflow. Based on davidsandberg's facenet project:
License: MIT License
Thanks for the code. how the model is freeze to mtcnn_frozen_model.pb?
I trained pnet, rnet and onets with tensoflow and the layer names things is quite different from yours and wondering how you freeze the model to a frozen .pb and .npy file.
i am doing face recognition,using your c++ implement,but i want to test the time of under cpu and gpu,tensorflow defaultly use gpu ,and all the memory,you use the c api,i am not know which function to set the two value,i hope you can help me.Thank you!
hello,first thank you contribute your codes!
now i have a problem,originally,there are three models. How do you convert to the mtcnn_frozen_model.pb?
Is there have codes to convert?thanks!
Can I please know how to align face after detection in c++ as done in https://github.com/davidsandberg/facenet/blob/master/src/align/align_dataset_mtcnn.py
I have imported the c++ code into eclipse,
I am trying to run test.cpp , but I am unable to read .jpg images , though am able to read .png images
~/tensorflow-mtcnn-master/cpp/standalone$ sudo make test
the error is :
g++ test.o -o test tensorflow_mtcnn.o comm_lib.o utils.o -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -Wl,-rpath,/usr/local/include/lib -L/usr/local/include/lib -ltensorflow
/usr/bin/ld: warning: libmklml_intel.so, needed by /usr/local/lib/libtensorflow.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libiomp5.so, needed by /usr/local/lib/libtensorflow.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libtensorflow.so:对‘dnnLRNCreateForward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConcatCreate_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLRNCreateBackward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutDelete_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnBatchNormalizationCreateBackward_v2_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘cblas_dgemm’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnPoolingCreateForward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutDeserialize_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘cblas_cgemm’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutGetMemorySize_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnBatchNormalizationCreateForward_v2_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnExecute_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘omp_in_parallel@VERSION’未定义的引用
/usr/local/lib/libtensorflow.so:对‘cblas_zgemm’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutSerializationBufferSize_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnPoolingCreateBackward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConvolutionCreateBackwardBias_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConvolutionCreateForward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘cblas_sgemm’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutCompare_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConvolutionCreateForwardBias_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConversionExecute_F32’未定义的引用
//usr/local/lib/libtensorflow_framework.so:对‘i_calloc’未定义的引用
/usr/local/lib/libtensorflow.so:对‘omp_get_max_threads@VERSION’未定义的引用
/usr/local/lib/libtensorflow.so:对‘omp_get_thread_num@VERSION’未定义的引用
//usr/local/lib/libtensorflow_framework.so:对‘i_malloc’未定义的引用
/usr/local/lib/libtensorflow.so:对‘MKL_Domatcopy’未定义的引用
/usr/local/lib/libtensorflow.so:对‘GOMP_barrier@VERSION’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConvolutionCreateBackwardFilter_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘omp_get_num_threads@VERSION’未定义的引用
//usr/local/lib/libtensorflow_framework.so:对‘i_free’未定义的引用
/usr/local/lib/libtensorflow.so:对‘MKL_Zomatcopy’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnDelete_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutCreate_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutSerialize_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnLayoutCreateFromPrimitive_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘MKL_Comatcopy’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnSumCreate_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘GOMP_parallel@VERSION’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConversionCreate_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘MKL_Somatcopy’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnReLUCreateBackward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnReLUCreateForward_F32’未定义的引用
/usr/local/lib/libtensorflow.so:对‘dnnConvolutionCreateBackwardData_F32’未定义的引用
//usr/local/lib/libtensorflow_framework.so:对‘i_realloc’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:45: recipe for target 'test' failed
make: *** [test] Error 1
how can i solve this problem?everybody give me recipe will thanks!!
I am using face detection using tensorflow 1.4 , but get below error while executing the code
/home/ashok/eclipseWorkspace/faceRecognition-x86_64_MTCNN/Libraries/tensorflow/include/tensorflow/core/lib/core/refcount.h:79] Check failed: ref_.load() == 0 (1 vs. 0)
generated from
Status run_status = sess->Run(input_tname,output_tname,output_node,&output_tensor);
form
run_PNet(std::unique_ptr<tensorflow::Session>& sess, cv::Mat& img, scale_window& win, std::vector<face_box>& box_list)
function
Please help resolve the issue
hello,i don't know the function of this code: working_img=working_img.t() ;why should do this? @cyberfire
Hi, cyberfire, Thanks for you codes. when I build the C++ version (tf_embedded) use bazel, there were some errors. It looks like that the tensorflow version dost not match well. I want to know which tensorflow version you used
./tensorflow/core/framework/tensor_shape.h:507: error: undefined reference to 'tensorflow::TensorShapeRep::DestructorOutOfLine()'
./tensorflow/core/public/session_options.h:28: error: undefined reference to 'tensorflow::ConfigProto::~ConfigProto()'
tensorflow/examples/mtcnn/main.cc:80: error: undefined reference to 'tensorflow::GraphDef::GraphDef()'
tensorflow/examples/mtcnn/main.cc:82: error: undefined reference to 'tensorflow::Env::Default()'
tensorflow/examples/mtcnn/main.cc:82: error: undefined reference to 'tensorflow::ReadBinaryProto(tensorflow::Env*, std::string const&, google::protobuf::MessageLite*)'
tensorflow/examples/mtcnn/main.cc:87: error: undefined reference to 'tensorflow::SessionOptions::SessionOptions()'
tensorflow/examples/mtcnn/main.cc:87: error: undefined reference to 'tensorflow::NewSession(tensorflow::SessionOptions const&)'
tensorflow/examples/mtcnn/main.cc:92: error: undefined reference to 'tensorflow::GraphDef::~GraphDef()'
tensorflow/examples/mtcnn/main.cc:92: error: undefined reference to 'tensorflow::GraphDef::~GraphDef()'
tensorflow/examples/mtcnn/main.cc:116: error: undefined reference to 'tensorflow::cpu_allocator()'
tensorflow/examples/mtcnn/main.cc:126: error: undefined reference to 'tensorflow::Tensor::Tensor(tensorflow::DataType, tensorflow::TensorShape const&, tensorflow::TensorBuffer*)'
./tensorflow/core/framework/tensor_shape.h:288: error: undefined reference to 'tensorflow::TensorShapeBasetensorflow::TensorShape::TensorShapeBase(tensorflow::gtl::ArraySlice)'
/usr/include/c++/4.9/bits/stl_pair.h:96: error: undefined reference to 'tensorflow::Tensor::~Tensor()'
tensorflow/examples/mtcnn/main.cc:205: error: undefined reference to 'cv::_OutputArray::_OutputArray(cv::Mat&)'
tensorflow/examples/mtcnn/main.cc:205: error: undefined reference to 'cv::_InputArray::_InputArray(cv::Mat const&)'
tensorflow/examples/mtcnn/main.cc:256: error: undefined reference to 'tensorflow::TensorShapeBasetensorflow::TensorShape::dim_size(int) const'
tensorflow/examples/mtcnn/main.cc:257: error: undefined reference to 'tensorflow::TensorShapeBasetensorflow::TensorShape::dim_size(int) const'
tensorflow/examples/mtcnn/main.cc:262: error: undefined reference to 'tensorflow::Tensor::tensor_data() const'
tensorflow/examples/mtcnn/main.cc:263: error: undefined reference to 'tensorflow::Tensor::tensor_data() const'
tensorflow/examples/mtcnn/main.cc:226: error: undefined reference to 'tensorflow::Tensor::~Tensor()'
Please review MTCNN TensorFlow code at https://github.com/look4pritam/TensorFlowMTCNN on CelebA branch.
since I want to use MTCNN for detection and alignment of another kind of object instead of face, I need to train on my own data. how to train on self-define data which has already been formatted same as FDDB?
Hello,
How can I add another .pb model that does face recognition and runs after ONet is run? All I was able to do is add it beneath the run_ONet function with its own session and graph:
run_ONet(sess,graph,working_img, rnet_boxes,total_onet_boxes);
//Our face recognition model
run_Ours(sess2, graph2,working_img, total_onet_boxes,total_our_boxes);
total_onet_boxes = total_our_boxes;
Hi,
I compiled the mtcnn embeded codes,then run it,got an error as below:
../../lib:/usr/local/lib:/usr/local/cuda-8.0/lib64:/usr/local/cuda-8.0/lib64:/usr/local/lib:
2017-12-27 11:02:44.944551: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2017-12-27 11:02:45.084213: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:895] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-12-27 11:02:45.084773: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1062] Found device 0 with properties:
name: GeForce GTX 970M major: 5 minor: 2 memoryClockRate(GHz): 1.038
pciBusID: 0000:01:00.0
totalMemory: 5.94GiB freeMemory: 5.36GiB
2017-12-27 11:02:45.084792: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1152] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 970M, pci bus id: 0000:01:00.0, compute capability: 5.2)
run PNet error
2017-12-27 11:02:45.539095: F ../../include/tensorflow/core/lib/core/refcount.h:79] Check failed: ref_.load() == 0 (1 vs. 0)
./run.sh: line 6: 9237 Aborted (core dumped) ./mtcnn_embeded
can you help me!
thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.