chineseocr / darknet-ocr

darknet text detect and darknet cnn ocr
MIT License
1.14k stars 287 forks source link

make出错 #28

Open jnkr36 opened 4 years ago

jnkr36 commented 4 years ago

看到更新了ocr识别的模型,马上拿来用一下,自己是windows10的系统,也没有gpu,但是在编译的时候出错了,我电脑上装的MinGW来make的,请问windows系统应该怎么编译呢 是不是要改一下makefile文件,谢谢哈,或者是否可以将build好的library也直接传上来下载后直接用呢 E:\pycharm_workspace\darknet-ocr-master\darknet>make make: *** No rule to make target 'obj', needed by 'all'. Stop.

etmwb commented 4 years ago

https://github.com/chineseocr/darknet-ocr/issues/17#issuecomment-565322639

w-Bro commented 4 years ago

我也是,照着@etmwb 好像也不行。你解决了吗?win10、GNU Make 4.2

w-Bro commented 4 years ago

我手动创建了obj、backup、results这三个文件夹。出现的是这个错误。 gcc -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o, ...) failed. make (e=2): 系统找不到指定的文件。 make.exe: *** [makefile:89: obj/gemm.o] Error 2

jnkr36 commented 4 years ago

我也是makefile里面加了如下, obj: mkdir -p obj backup: mkdir backup results: mkdir results 然后重新build,结果也是报错,还没有解决 E:\pycharm_workspace\darknet-ocr-master\darknet>make gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o In file included from ./src/utils.h:5:0, from ./src/gemm.c:2: include/darknet.h:6:21: fatal error: pthread.h: No such file or directory

include

                 ^

compilation terminated. Makefile:89: recipe for target 'obj/gemm.o' failed make: *** [obj/gemm.o] Error 1

wenlihaoyu commented 4 years ago

还需要安装GCC才行

w-Bro commented 4 years ago

@jnkr36 我改了几处地方,运行成功了。但是识别结果是乱码,不知道和我的修改是否有关系。仅供参考。 环境:win10、python3.6.5、无GPU

  1. 没有做make那个步骤
  2. 修改config.py GPU为 False
  3. 修改dnn/ocr.py 第8行 为 with open(p, encoding='utf8') as f:
  4. 修改dnn/ocr.py 第19行 为 if GPU:
  5. 参考这个 #9 修改template.py
  6. 修改 dnn/main.py 第9行 为 from dnn.ocr import predict_cpu as ocrModel
  7. 运行app.py即可

image

etmwb commented 4 years ago

Um..我是在ubuntu+gpu下遇到这个错误,之后是原作者代码的一些问题。 @jnkr36 的错误我推荐google为什么找不到pthread.h; @w-Bro 出现乱码是因为make这个步骤是必不可少的。

w-Bro commented 4 years ago

@etmwb @wenlihaoyu emm。。我已经装了gcc还是不行 mingw32-make: *** No rule to make target 'obj/gemm.o', needed by 'libdarknet.so'. Stop. 是不是windows无解。。

jnkr36 commented 4 years ago

还需要安装GCC才行

有安装gcc哈,gcc和g++的版本如下,build的时候还是开始那个错误

C:\Users\Administrator>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe Target: mingw32 Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls Thread model: win32 gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

C:\Users\Administrator>g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe Target: mingw32 Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls Thread model: win32 gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

w-Bro commented 4 years ago

@jnkr36 hhh,我把ocr的部分换成另外一个项目的了 image

jnkr36 commented 4 years ago

@w-Bro 请问怎么换的呢 参考一下 效果如何

w-Bro commented 4 years ago

@jnkr36 效果一般,不知道相对于这个项目效果怎样

w-Bro commented 4 years ago

@jnkr36 make成功了。参照这个装cygwin再make就可以了。

https://blog.csdn.net/qq_31290747/article/details/80800415