前言
?
操作過程
NCNN:
https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-linux-x86;
?
vector初始化:
int num[4] = { 1, 4, 3, 2 }; int numLength = sizeof(num) / sizeof(num[0]); vector<int> nums(num, num + numLength); //使用數組初始化向量
Q:
make[2]: *** No rule to make target 'ncnn/src/libncnn.a', needed by 'mtcnn'.? Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mtcnn.dir/all' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mtcnn.dir/all' failed
A:
No rule to make?target?`XXX'.
No rule to make?target?` XXX ', needed by `yyy'.
無法為重建目標“XXX”找到合適的規則,包括明確規則和隱含規則。
修正這個錯誤的方法是:在Makefile中添加一個重建目標的規則。其它可能導致這些錯誤的原因是Makefile中文件名拼寫錯誤,或者破壞了源文件樹(一個文件不能被重建,可能是由于依賴文件的問題)。
No rule to make?target?` XXX ', needed by `yyy'.
無法為重建目標“XXX”找到合適的規則,包括明確規則和隱含規則。
修正這個錯誤的方法是:在Makefile中添加一個重建目標的規則。其它可能導致這些錯誤的原因是Makefile中文件名拼寫錯誤,或者破壞了源文件樹(一個文件不能被重建,可能是由于依賴文件的問題)。
?
仔細檢查之后發現是文件路徑不對;需要將libncnn.a文件復制到需要的文件目錄;
cmake之后需要將./MTCNN_cpuimage/ncnn/build/src目錄下的libncnn.a文件復制到./MTCNN_cpuimage/build/ncnn/src目錄下,才可以正常make編譯;
Q:
/home/rjzheng/uisee/code/MTCNN/MTCNN_cpuimage/src/main.cpp: In function ‘void saveImage(const char*, int, int, int, unsigned char*)’:
/home/rjzheng/uisee/code/MTCNN/MTCNN_cpuimage/src/main.cpp:57:20: error: ‘browse’ was not declared in this scope
???? browse(saveFile);
/home/rjzheng/uisee/code/MTCNN/MTCNN_cpuimage/src/main.cpp:57:20: error: ‘browse’ was not declared in this scope
???? browse(saveFile);
A:
static函數的定義位于頭文件中,在main文件中調用,這種可以直接調用嗎???我將該函數直接添加到main文件中可以編譯通過,這可以證明該函數再頭文件中不能直接被拿來調用;
struct Bbox {
??? float score;
??? int x1;
??? int y1;
??? int x2;
??? int y2;
??? float area;
??? float ppoint[10];
??? float regreCoord[4];
};
?運行
$./mtcnn ../models/ ../sample.jpg
?
參考
1. MTCNN人臉檢測 附完整C++代碼;
2. https://github.com/cpuimage/MTCNN;
3. NCNN_github;
4. NCNN_Build for Linux x86;
完