OAID / Tengine

Tengine is a lite, high performance, modular inference engine for embedded device
Apache License 2.0
4.65k stars 998 forks source link

Gender-age detection inside Tengine. #71

Closed rahulsharma11 closed 5 years ago

rahulsharma11 commented 5 years ago

Hi, Thanks for the support till now. Face detection is running good inside Tengine. For Gender- age detection, i was checking this link -"https://github.com/deepinsight/insightface/tree/master/gender-age". That uses very light mxnet based model for gender-age detection. So my question is something similar to it already exist inside Tengine? Thanks.

hey-yahei commented 5 years ago

Hi, rahulsharma11 There are no examples of gender-age detection yet. However, if operators of your model are all supported, Tengine would load and run it successfully. Operators that Tengine support are listed here. Thanks

rahulsharma11 commented 5 years ago

Hi, Thanks for reply.

Can i use Caffe-HRT with Tengine instead of caffe? As i have built Caffe-HRT for FaceDetection and Recognition. Now when i am building Tengine with Caffe support, i did in makefile.config of Tengine-

uncomment to build the reference operators wrapped on Caffe

CONFIG_CAFFE_REF=y

Set the path of caffe used for compile and link,

if caffe's operator calculation is enabled.

CAFFE_ROOT = /home/rock64/rahul/Caffe-HRT

Tengine is built successfully but when i make examples , it throws error- 20%] Linking CXX executable FASTER_RCNN [ 22%] Linking CXX executable YOLOV2 [ 25%] Building CXX object ssd/CMakeFiles/SSD.dir/__/common/common.cpp.o //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::CLConvolutionLayer::configure(arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, arm_compute::ICLTensor*, arm_compute::PadStrideInfo const&, arm_compute::WeightsInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NEPoolingLayer::NEPoolingLayer()' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::CLDirectConvolutionLayer::configure(arm_compute::ICLTensor*, arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, arm_compute::ICLTensor*, arm_compute::PadStrideInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference totypeinfo for arm_compute::INESimpleFunction' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEBatchNormalizationLayer::NEBatchNormalizationLayer()' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NEActivationLayer::configure(arm_compute::ITensor, arm_compute::ITensor, arm_compute::ActivationLayerInfo)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEDirectConvolutionLayer::configure(arm_compute::ITensor*, arm_compute::ITensor const*, arm_compute::ITensor const*, arm_compute::ITensor*, arm_compute::PadStrideInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::INESimpleFunction::INESimpleFunction()' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEFullyConnectedLayer::configure(arm_compute::ITensor const*, arm_compute::ITensor const*, arm_compute::ITensor const*, arm_compute::ITensor*, bool, bool)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NEDepthConcatenateLayer::NEDepthConcatenateLayer()' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::CLBatchNormalizationLayer::configure(arm_compute::ICLTensor*, arm_compute::ICLTensor*, arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, arm_compute::ICLTensor const*, float)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference tovtable for arm_compute::INESimpleFunction' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEDirectConvolutionLayer::NEDirectConvolutionLayer(std::shared_ptr<arm_compute::IMemoryManager>)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NELocallyConnectedLayer::NELocallyConnectedLayer(std::shared_ptr)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NENormalizationLayer::configure(arm_compute::ITensor const*, arm_compute::ITensor*, arm_compute::NormalizationLayerInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NELocallyConnectedLayer::configure(arm_compute::ITensor const, arm_compute::ITensor const, arm_compute::ITensor const, arm_compute::ITensor, arm_compute::PadStrideInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::INESimpleFunction::run()' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::CLSubTensor::CLSubTensor(arm_compute::ICLTensor, arm_compute::TensorShape const&, arm_compute::Coordinates const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NENormalizationLayer::NENormalizationLayer(std::shared_ptr<arm_compute::IMemoryManager>)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NEConvolutionLayer::NEConvolutionLayer(std::shared_ptr)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to `arm_compute::NEBatchNormalizationLayer::configure(arm_compute::ITensor, arm_compute::ITensor, arm_compute::ITensor const, arm_compute::ITensor const, arm_compute::ITensor const, arm_compute::ITensor const, float)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to `arm_compute::NEDepthConcatenateLayer::configure(std::vector<arm_compute::ITensor, std::allocator<arm_compute::ITensor> >, arm_compute::ITensor)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::SubTensor::SubTensor(arm_compute::ITensor*, arm_compute::TensorShape const&, arm_compute::Coordinates const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NESoftmaxLayer::configure(arm_compute::ITensor, arm_compute::ITensor, float)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEFullyConnectedLayer::NEFullyConnectedLayer(std::shared_ptr<arm_compute::IMemoryManager>)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NEPoolingLayer::configure(arm_compute::ITensor, arm_compute::ITensor, arm_compute::PoolingLayerInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference to arm_compute::NEConvolutionLayer::configure(arm_compute::ITensor const*, arm_compute::ITensor const*, arm_compute::ITensor const*, arm_compute::ITensor*, arm_compute::PadStrideInfo const&, arm_compute::WeightsInfo const&)' //home/rock64/rahul/Caffe-HRT/build/lib/libcaffe.so.1.0.0-rc5: undefined reference toarm_compute::NESoftmaxLayer::NESoftmaxLayer(std::shared_ptr)' collect2: error: ld returned 1 exit status yolov2/CMakeFiles/YOLOV2.dir/build.make:144: recipe for target 'yolov2/YOLOV2' failed make[2]: [yolov2/YOLOV2] Error 1 CMakeFiles/Makefile2:140: recipe for target 'yolov2/CMakeFiles/YOLOV2.dir/all' failed make[1]: [yolov2/CMakeFiles/YOLOV2.dir/all] Error 2 [ 30%] Building CXX object mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn.cpp.o [ 32%] Building CXX object mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn_with_gender.cpp.o In file included from /home/rock64/rahul/Tengine/examples/mtcnn/test_mtcnn_with_gender.cpp:35:0: /usr/local/AID/Caffe-HRT/include/caffe/blob.hpp:8:10: fatal error: caffe/common.hpp: No such file or directory

include "caffe/common.hpp"

      ^~~~~~~~~~~~~~~~~~

compilation terminated. mtcnn/CMakeFiles/MTCNN.dir/build.make:101: recipe for target 'mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn_with_gender.cpp.o' failed make[2]: [mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn_with_gender.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... ^Cmtcnn/CMakeFiles/MTCNN.dir/build.make:88: recipe for target 'mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn.cpp.o' failed ssd/CMakeFiles/SSD.dir/build.make:88: recipe for target 'ssd/CMakeFiles/SSD.dir/__/multiwebcam/multiWebCam.cpp.o' failed make[2]: [mtcnn/CMakeFiles/MTCNN.dir/test_mtcnn.cpp.o] Interrupt make[2]: [ssd/CMakeFiles/SSD.dir/__/multiwebcam/multiWebCam.cpp.o] Interrupt CMakeFiles/Makefile2:195: recipe for target 'ssd/CMakeFiles/SSD.dir/all' failed make[1]: [ssd/CMakeFiles/SSD.dir/all] Interrupt CMakeFiles/Makefile2:85: recipe for target 'mtcnn/CMakeFiles/MTCNN.dir/all' failed make[1]: [mtcnn/CMakeFiles/MTCNN.dir/all] Interrupt Makefile:83: recipe for target 'all' failed make: *** [all] Interrupt

Is there any version issue? Thanks.

lyuchuny3 commented 5 years ago

Hi, I have update tengine doc, rm CAFFE_REF in makefile.config.example, you can pull the lastest Tengine,and rebuild your project.

Caffe model support is by the key CONFIG_CAFFE_SERIALIZER=y (which default is open) https://github.com/OAID/Tengine/blob/master/makefile.config.example#L37

thanks

rahulsharma11 commented 5 years ago

Thanks.

rahulsharma11 commented 5 years ago

Hi, I want to continue this thread with one last question. I am integrating classification example of Tengine caffe_wrapper with test_mtcnn.cpp. I have done the following- 1) added include path of wrapper_include in CMakeList of mtcnn. (for caffe.hpp header) 2) copied some part of classification.cpp code such as classifier, preprocess and all necessary functions for classification in test_mtcnn.cpp. Is it correct to do? as while make, It is throwing error for undefined references like- In function 'Classifier::Preprocess(cv::Mat const& std::vector<cv::Mat std::allocator >)': /home/rahul/Tengine/examples/mtcnn/test_mtcnn.cpp:258: undefined reference to 'caffe::Blob_wrap::cpu_data() const' /home/rahul/Tengine/examples/mtcnn/test_mtcnn.cpp:258: undefined reference to 'google::LogMessageFatal::LogMessageFatal(char const, int)' ....... and so on.... Any suggestion? Thanks.

lyuchuny3 commented 5 years ago

Hi, If you want to run https://github.com/OAID/Tengine/tree/master/examples/caffe_wrapper/mtcnn

Step1, install tengine with wrapper

If your want to run tengine caffe_wrapper, in your makefile.config, you should open:

# Enable Wrappers
CONFIG_FRAMEWORK_WRAPPER=y

and then make & make install, this will auto copy wrapper_include into include/ directory

Step2. build caffe_wrapper example

cd caffe_wrapper/mtcnn
mkdir build
cd build
cmake -DTENGINE_DIR=/home/your_dir/tengine ..
make

If you still have problem, you can reply below. Thanks.

rahulsharma11 commented 5 years ago

Hi, Thanks for the support.