赞
踩
记录废话很多,主要内容:
对darknet整个项目各个部分的一个解释:
src 源文件,包含了darknet最底层的一些定义,包括激活层、全局池化层、归一层等等
example 高层文件,对底层的调用,包括检测和显示
cfg 配置文件,*.cfg 模型架构 *.data模型训练配置
- classes= 80 #训练种类
- train = /home/pjreddie/data/coco/trainvalno5k.txt #训练集路径
- valid = coco_testdev #验证集路径
- #valid = data/coco_val_5k.list
- names = data/coco.names #训练种类的具体名称文件
- backup = /home/pjreddie/backup/ #训练后得到的权重存放位置
python文件即python接口
Darknet: Open Source Neural Networks in C
看了一下官网,这种强烈的中二气息让人欲罢不能,不由得赞叹,包装相当巧妙。
先安装了msys2,教程很详细在window下搭建Darknet环境_橘子都吃不起!的博客-CSDN博客感谢!!
官网MSYS2
在实际安装中的版本:一定要添加清华镜像站!!以下只是一个记录过程,没有实际的意义。用make -j带一个参数,可以把项目在进行并行编译.
- $ pacman -S gcc
- 正在解析依赖关系...
- 正在查找软件包冲突...
-
- 软件包 (9) binutils-2.30-2 gcc-libs-9.1.0-2 isl-0.21-1 mpc-1.1.0-1
- msys2-runtime-devel-3.0.7-6
- msys2-w32api-headers-7.0.0.5479.8db8dd5a-1
- msys2-w32api-runtime-7.0.0.5479.8db8dd5a-1
- windows-default-manifest-6.4-1 gcc-9.1.0-2
-
- 下载大小: 43.98 MiB
- 全部安装大小: 291.77 MiB
- 净更新大小: 288.06 MiB
-
- :: 进行安装吗? [Y/n] y
- :: 正在获取软件包......
- gcc-libs-9.1.0-2... 1183.6 KiB 180 KiB/s 00:07 [#####################] 100%
- binutils-2.30-2-... 4.3 MiB 411 KiB/s 00:11 [#####################] 100%
- isl-0.21-1-x86_64 505.7 KiB 1397 KiB/s 00:00 [#####################] 100%
- mpc-1.1.0-1-x86_64 74.1 KiB 4.02 MiB/s 00:00 [#####################] 100%
- msys2-runtime-de... 5.3 MiB 1842 KiB/s 00:03 [#####################] 100%
- msys2-w32api-hea... 4.6 MiB 2.18 MiB/s 00:02 [#####################] 100%
- msys2-w32api-run... 1825.4 KiB 2.42 MiB/s 00:01 [#####################] 100%
- windows-default-... 1388.0 B 90.4 KiB/s 00:00 [#####################] 100%
- gcc-9.1.0-2-x86_64 26.3 MiB 2.39 MiB/s 00:11 [#####################] 100%
- (9/9) 正在检查密钥环里的密钥 [#####################] 100%
- (9/9) 正在检查软件包完整性 [#####################] 100%
- (9/9) 正在加载软件包文件 [#####################] 100%
- (9/9) 正在检查文件冲突 [#####################] 100%
- (9/9) 正在检查可用存储空间 [#####################] 100%
- :: 正在处理软件包的变化...
- (1/9) 正在更新 gcc-libs [#####################] 100%
- (2/9) 正在安装 binutils [#####################] 100%
- (3/9) 正在安装 isl [#####################] 100%
- (4/9) 正在安装 mpc [#####################] 100%
- (5/9) 正在安装 msys2-runtime-devel [#####################] 100%
- (6/9) 正在安装 msys2-w32api-headers [#####################] 100%
- (7/9) 正在安装 msys2-w32api-runtime [#####################] 100%
- (8/9) 正在安装 windows-default-manifest [#####################] 100%
- (9/9) 正在安装 gcc [#####################] 100%
-
- MSYS ~
- $ pacman -S gdb
- 正在解析依赖关系...
- 正在查找软件包冲突...
-
- 软件包 (4) expat-2.2.9-1 mpdecimal-2.4.2-2 python-3.7.4-1 gdb-8.2.1-3
-
- 下载大小: 18.88 MiB
- 全部安装大小: 114.38 MiB
-
- :: 进行安装吗? [Y/n] y
- :: 正在获取软件包......
- expat-2.2.9-1-x86_64 43.7 KiB 2.85 MiB/s 00:00 [#####################] 100%
- mpdecimal-2.4.2-... 86.7 KiB 363 KiB/s 00:00 [#####################] 100%
- python-3.7.4-1-x... 14.9 MiB 945 KiB/s 00:16 [#####################] 100%
- gdb-8.2.1-3-x86_64 3.9 MiB 1397 KiB/s 00:03 [#####################] 100%
- (4/4) 正在检查密钥环里的密钥 [#####################] 100%
- (4/4) 正在检查软件包完整性 [#####################] 100%
- (4/4) 正在加载软件包文件 [#####################] 100%
- (4/4) 正在检查文件冲突 [#####################] 100%
- (4/4) 正在检查可用存储空间 [#####################] 100%
- :: 正在处理软件包的变化...
- (1/4) 正在安装 expat [#####################] 100%
- (2/4) 正在安装 mpdecimal [#####################] 100%
- (3/4) 正在安装 python [#####################] 100%
- (4/4) 正在安装 gdb [#####################] 100%
-
- MSYS ~
- $ pacman -S make
- 正在解析依赖关系...
- 正在查找软件包冲突...
-
- 软件包 (1) make-4.2.1-1
-
- 下载大小: 0.41 MiB
- 全部安装大小: 1.22 MiB
-
- :: 进行安装吗? [Y/n] y
- :: 正在获取软件包......
- make-4.2.1-1-x86_64 414.8 KiB 531 KiB/s 00:01 [#####################] 100%
- (1/1) 正在检查密钥环里的密钥 [#####################] 100%
- (1/1) 正在检查软件包完整性 [#####################] 100%
- (1/1) 正在加载软件包文件 [#####################] 100%
- (1/1) 正在检查文件冲突 [#####################] 100%
- (1/1) 正在检查可用存储空间 [#####################] 100%
- :: 正在处理软件包的变化...
- (1/1) 正在安装 make [#####################] 100%
-
- MSYS ~
- $ make -v
- GNU Make 4.2.1
- 为 x86_64-pc-msys 编译
- Copyright (C) 1988-2016 Free Software Foundation, Inc.
- 许可证:GPLv3+:GNU 通用公共许可证第 3 版或更新版本<http://gnu.org/licenses/gpl.html>。
- 本软件是自由软件:您可以自由修改和重新发布它。
- 在法律允许的范围内没有其他保证。
-
- MSYS ~
- $ gcc -v
- 使用内建 specs。
- COLLECT_GCC=gcc
- COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/9.1.0/lto-wrapper.exe
- 目标:x86_64-pc-msys
- 配置为:/msys_scripts/gcc/src/gcc-9.1.0/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --with-tune=generic --disable-multilib --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
- 线程模型:posix
- gcc 版本 9.1.0 (GCC)

另外,常用命令参考msys2软件包管理工具pacman常用命令_hustlei的专栏-CSDN博客_msys2 pacman
测试一下!!另外使用的模型参数可以在YOLO: Real-Time Object Detection下载。
- D:\demo\darknet>.\darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/person.jpg
- layer filters size input output
- 0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs
- 1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
- 2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs
- 3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
- 4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs
- 5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
- 6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs
- 7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
- 8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs
- 9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
- 10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
- 11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
- 12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
- 13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs
- 14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
- 15 conv 255 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 255 0.044 BFLOPs
- 16 yolo
- 17 route 13
- 18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs
- 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128
- 20 route 19 8
- 21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs
- 22 conv 255 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 255 0.088 BFLOPs
- 23 yolo
- Loading weights from yolov3-tiny.weights...Done!
- data/person.jpg: Predicted in 0.809380 seconds.
- horse: 94%
- dog: 91%
- dog: 90%
- person: 86%

测试出来的结果和教程一样是狗中狗。
如果需要加载视频的话,是需要用opencv来编译的,在msys64中安装一下opencv
pacman -S mingw-w64-x86_64-opencv
- $ pacman -S mingw-w64-x86_64-opencv
- 正在解析依赖关系...
- 正在查找软件包冲突...
- 警告:检测到循环依赖:
- 警告:mingw-w64-x86_64-harfbuzz 将在它 mingw-w64-x86_64-freetype 的依赖关系之前被安装
-
- 软件包 (90) mingw-w64-x86_64-SDL2-2.0.10-1 mingw-w64-x86_64-binutils-2.33.1-1
- mingw-w64-x86_64-boost-1.72.0-1 mingw-w64-x86_64-bzip2-1.0.8-1
- mingw-w64-x86_64-ca-certificates-20190110-1
- mingw-w64-x86_64-cairo-1.16.0-1
- mingw-w64-x86_64-ceres-solver-1.14.0-4
- mingw-w64-x86_64-cppunit-1.15.1-1
- mingw-w64-x86_64-crt-git-8.0.0.5576.34082b63-1
- mingw-w64-x86_64-eigen3-3.3.7-1 mingw-w64-x86_64-expat-2.2.9-1
- mingw-w64-x86_64-fontconfig-2.13.1-1
- mingw-w64-x86_64-freeglut-3.2.1-1
- mingw-w64-x86_64-freeimage-3.18.0-3
- mingw-w64-x86_64-freetype-2.10.1-1
- mingw-w64-x86_64-fribidi-1.0.8-1 mingw-w64-x86_64-gcc-9.2.0-2
- mingw-w64-x86_64-gcc-libgfortran-9.2.0-2
- mingw-w64-x86_64-gcc-libs-9.2.0-2
- mingw-w64-x86_64-gettext-0.19.8.1-8
- mingw-w64-x86_64-gflags-2.2.2-2 mingw-w64-x86_64-giflib-5.2.1-1
- mingw-w64-x86_64-glib2-2.62.4-1 mingw-w64-x86_64-glog-0.4.0-2
- mingw-w64-x86_64-glsl-optimizer-git-r66914.9a2852138d-1
- mingw-w64-x86_64-gmp-6.1.2-1 mingw-w64-x86_64-graphite2-1.3.13-2
- mingw-w64-x86_64-harfbuzz-2.6.4-3 mingw-w64-x86_64-hdf5-1.10.5-1
- mingw-w64-x86_64-headers-git-8.0.0.5576.34082b63-1
- mingw-w64-x86_64-hlsl2glsl-git-r848.957cd20-1
- mingw-w64-x86_64-icu-65.1-1 mingw-w64-x86_64-ilmbase-2.4.0-2
- mingw-w64-x86_64-intel-tbb-1~2020.0-1 mingw-w64-x86_64-isl-0.22-1
- mingw-w64-x86_64-jasper-2.0.16-1 mingw-w64-x86_64-jxrlib-1.1-3
- mingw-w64-x86_64-lcms2-2.9-1 mingw-w64-x86_64-leptonica-1.78.0-1
- mingw-w64-x86_64-libdatrie-0.2.12-1
- mingw-w64-x86_64-libffi-3.2.1-4 mingw-w64-x86_64-libiconv-1.16-1
- mingw-w64-x86_64-libjpeg-turbo-2.0.4-1
- mingw-w64-x86_64-libpng-1.6.37-3 mingw-w64-x86_64-libraw-0.19.5-1
- mingw-w64-x86_64-libsystre-1.0.1-4
- mingw-w64-x86_64-libtasn1-4.15.0-1
- mingw-w64-x86_64-libthai-0.1.28-2 mingw-w64-x86_64-libtiff-4.1.0-1
- mingw-w64-x86_64-libtre-git-r128.6fb7206-2
- mingw-w64-x86_64-libunwind-9.0.0-5
- mingw-w64-x86_64-libwebp-1.1.0-1
- mingw-w64-x86_64-libwinpthread-git-8.0.0.5574.33e5a2ac-1
- mingw-w64-x86_64-lzo2-2.10-1 mingw-w64-x86_64-metis-5.1.0-3
- mingw-w64-x86_64-mpc-1.1.0-1 mingw-w64-x86_64-mpdecimal-2.4.2-1
- mingw-w64-x86_64-mpfr-4.0.2-2
- mingw-w64-x86_64-ncurses-6.1.20190630-1
- mingw-w64-x86_64-ogre3d-1.12.2-1 mingw-w64-x86_64-openblas-0.3.7-1
- mingw-w64-x86_64-openexr-2.4.0-2
- mingw-w64-x86_64-openjpeg2-2.3.1-1
- mingw-w64-x86_64-openssl-1.1.1.d-1
- mingw-w64-x86_64-p11-kit-0.23.18.1-1
- mingw-w64-x86_64-pango-1.43.0-3 mingw-w64-x86_64-pcre-8.43-1
- mingw-w64-x86_64-pixman-0.38.4-1
- mingw-w64-x86_64-protobuf-3.11.2-1 mingw-w64-x86_64-python-3.8.1-1
- mingw-w64-x86_64-readline-8.0.001-2
- mingw-w64-x86_64-sqlite3-3.30.1-1
- mingw-w64-x86_64-suitesparse-5.6.0-1 mingw-w64-x86_64-szip-2.1.1-2
- mingw-w64-x86_64-tcl-8.6.10-1 mingw-w64-x86_64-termcap-1.3.1-5
- mingw-w64-x86_64-tesseract-ocr-4.1.0-1
- mingw-w64-x86_64-tinyxml-2.6.2-4 mingw-w64-x86_64-tk-8.6.10-1
- mingw-w64-x86_64-uasm-v2.50-1
- mingw-w64-x86_64-vulkan-headers-1.1.127-1
- mingw-w64-x86_64-vulkan-loader-1.1.127-1
- mingw-w64-x86_64-windows-default-manifest-6.4-3
- mingw-w64-x86_64-wineditline-2.205-3
- mingw-w64-x86_64-winpthreads-git-8.0.0.5574.33e5a2ac-1
- mingw-w64-x86_64-xz-5.2.4-1 mingw-w64-x86_64-zlib-1.2.11-7
- mingw-w64-x86_64-zstd-1.4.4-1 mingw-w64-x86_64-zziplib-0.13.69-1
- mingw-w64-x86_64-opencv-4.2.0-1
-
- 下载大小: 325.51 MiB
- 全部安装大小: 1822.64 MiB
-
- :: 进行安装吗? [Y/n] y
- :: 正在获取软件包......
- mingw-w64-x86_64... 833.1 KiB 833 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 155.9 KiB 768 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 623.0 KiB 2.17 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 102.1 KiB 6.23 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 13.6 MiB 3.24 MiB/s 00:04 [#####################] 100%
- mingw-w64-x86_64... 5.1 MiB 2.23 MiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 3.1 MiB 2.61 MiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 645.3 KiB 844 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 486.0 KiB 1482 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 345.9 KiB 4.33 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 78.9 KiB 5.13 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 45.0 KiB 2.75 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 692.4 KiB 2.70 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 12.9 KiB 0.00 B/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 54.6 KiB 0.00 B/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 32.9 MiB 2.71 MiB/s 00:12 [#####################] 100%
- mingw-w64-x86_64... 286.6 KiB 1412 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 31.4 KiB 0.00 B/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 127.3 KiB 4.01 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 580.2 KiB 1769 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 6.7 MiB 2.61 MiB/s 00:03 [#####################] 100%
- mingw-w64-x86_64... 333.9 KiB 2.28 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 3.1 MiB 2.54 MiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 667.7 KiB 342 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 1521.0 KiB 1123 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 168.1 KiB 1788 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 433.8 KiB 423 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 758.3 KiB 1349 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 88.6 KiB 2.79 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 141.3 KiB 2.94 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 3.1 MiB 1915 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 58.2 KiB 6.31 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 885.1 KiB 1211 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 44.9 KiB 2.74 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 254.2 KiB 1453 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 84.2 KiB 5.48 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 24.0 KiB 0.00 B/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 1784.7 KiB 943 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 176.8 KiB 2.50 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 292.6 KiB 4.08 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 352.9 KiB 3.63 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 4.8 MiB 2.24 MiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 33.1 KiB 4.04 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 375.2 KiB 3.52 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 3.0 MiB 3.17 MiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 6.6 MiB 2.79 MiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 1919.6 KiB 1092 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 297.7 KiB 3.34 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 16.7 MiB 1973 KiB/s 00:09 [#####################] 100%
- mingw-w64-x86_64... 4.6 MiB 1894 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 147.6 KiB 1893 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 889.1 KiB 312 KiB/s 00:03 [#####################] 100%
- mingw-w64-x86_64... 347.1 KiB 2.44 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 529.8 KiB 331 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 54.6 KiB 0.00 B/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 10.5 MiB 1450 KiB/s 00:07 [#####################] 100%
- mingw-w64-x86_64... 436.0 KiB 635 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 922.4 KiB 1094 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 133.4 KiB 2.77 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 434.9 KiB 844 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 18.4 MiB 1929 KiB/s 00:10 [#####################] 100%
- mingw-w64-x86_64... 21.2 MiB 1765 KiB/s 00:12 [#####################] 100%
- mingw-w64-x86_64... 213.4 KiB 1872 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 252.3 KiB 5.13 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 288.7 KiB 2.45 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 438.5 KiB 3.27 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 632.1 KiB 3.01 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 220.0 KiB 5.12 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 3.0 MiB 1448 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 541.7 KiB 76.9 KiB/s 00:07 [#####################] 100%
- mingw-w64-x86_64... 705.4 KiB 1100 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 234.8 KiB 2.94 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 483.0 KiB 2.46 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 118.6 KiB 4.63 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 811.4 KiB 1274 KiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 84.5 KiB 3.93 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 131.7 KiB 4.15 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 111.7 MiB 3.03 MiB/s 00:37 [#####################] 100%
- mingw-w64-x86_64... 2.0 MiB 3.76 MiB/s 00:01 [#####################] 100%
- mingw-w64-x86_64... 228.2 KiB 1826 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 101.1 KiB 6.58 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 289.7 KiB 1694 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 804.0 KiB 367 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 1439.4 KiB 885 KiB/s 00:02 [#####################] 100%
- mingw-w64-x86_64... 93.3 KiB 6.08 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 168.7 KiB 3.51 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 290.9 KiB 9.16 MiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 580.0 KiB 1198 KiB/s 00:00 [#####################] 100%
- mingw-w64-x86_64... 4.8 MiB 1811 KiB/s 00:03 [#####################] 100%
- mingw-w64-x86_64... 22.4 MiB 4.39 MiB/s 00:05 [#####################] 100%
- (90/90) 正在检查密钥环里的密钥 [#####################] 100%
- (90/90) 正在检查软件包完整性 [#####################] 100%
- (90/90) 正在加载软件包文件 [#####################] 100%
- (90/90) 正在检查文件冲突 [#####################] 100%
- (90/90) 正在检查可用存储空间 [#####################] 100%
- :: 正在处理软件包的变化...
- ( 1/90) 正在安装 mingw-w64-x86_64-eigen3 [#####################] 100%
- ( 2/90) 正在安装 mingw-w64-x86_64-gflags [#####################] 100%
- ( 3/90) 正在安装 mingw-w64-x86_64-libiconv [#####################] 100%
- ( 4/90) 正在安装 mingw-w64-x86_64-zlib [#####################] 100%
- ( 5/90) 正在安装 mingw-w64-x86_64-binutils [#####################] 100%
- ( 6/90) 正在安装 mingw-w64-x86_64-headers-git [#####################] 100%
- ( 7/90) 正在安装 mingw-w64-x86_64-crt-git [#####################] 100%
- ( 8/90) 正在安装 mingw-w64-x86_64-isl [#####################] 100%
- ( 9/90) 正在安装 mingw-w64-x86_64-gmp [#####################] 100%
- (10/90) 正在安装 mingw-w64-x86_64-mpfr [#####################] 100%
- (11/90) 正在安装 mingw-w64-x86_64-mpc [#####################] 100%
- (12/90) 正在安装 mingw-w64-x86_64-libwinpthrea... [#####################] 100%
- (13/90) 正在安装 mingw-w64-x86_64-gcc-libs [#####################] 100%
- (14/90) 正在安装 mingw-w64-x86_64-windows-defa... [#####################] 100%
- (15/90) 正在安装 mingw-w64-x86_64-winpthreads-git [#####################] 100%
- (16/90) 正在安装 mingw-w64-x86_64-gcc [#####################] 100%
- (17/90) 正在安装 mingw-w64-x86_64-uasm [#####################] 100%
- (18/90) 正在安装 mingw-w64-x86_64-libunwind [#####################] 100%
- (19/90) 正在安装 mingw-w64-x86_64-glog [#####################] 100%
- (20/90) 正在安装 mingw-w64-x86_64-gcc-libgfortran [#####################] 100%
- (21/90) 正在安装 mingw-w64-x86_64-openblas [#####################] 100%
- Set the environment variable OPENBLAS_NUM_THREADS to the
- number of threads to use.
- (22/90) 正在安装 mingw-w64-x86_64-metis [#####################] 100%
- (23/90) 正在安装 mingw-w64-x86_64-suitesparse [#####################] 100%
- (24/90) 正在安装 mingw-w64-x86_64-ceres-solver [#####################] 100%
- (25/90) 正在安装 mingw-w64-x86_64-intel-tbb [#####################] 100%
- (26/90) 正在安装 mingw-w64-x86_64-freeglut [#####################] 100%
- (27/90) 正在安装 mingw-w64-x86_64-libjpeg-turbo [#####################] 100%
- (28/90) 正在安装 mingw-w64-x86_64-jasper [#####################] 100%
- (29/90) 正在安装 mingw-w64-x86_64-bzip2 [#####################] 100%
- (30/90) 正在安装 mingw-w64-x86_64-expat [#####################] 100%
- (31/90) 正在安装 mingw-w64-x86_64-gettext [#####################] 100%
- (32/90) 正在安装 mingw-w64-x86_64-wineditline [#####################] 100%
- (33/90) 正在安装 mingw-w64-x86_64-pcre [#####################] 100%
- (34/90) 正在安装 mingw-w64-x86_64-libffi [#####################] 100%
- (35/90) 正在安装 mingw-w64-x86_64-mpdecimal [#####################] 100%
- (36/90) 正在安装 mingw-w64-x86_64-libtre-git [#####################] 100%
- (37/90) 正在安装 mingw-w64-x86_64-libsystre [#####################] 100%
- (38/90) 正在安装 mingw-w64-x86_64-ncurses [#####################] 100%
- (39/90) 正在安装 mingw-w64-x86_64-libtasn1 [#####################] 100%
- (40/90) 正在安装 mingw-w64-x86_64-p11-kit [#####################] 100%
- (41/90) 正在安装 mingw-w64-x86_64-ca-certificates [#####################] 100%
- (42/90) 正在安装 mingw-w64-x86_64-openssl [#####################] 100%
- (43/90) 正在安装 mingw-w64-x86_64-termcap [#####################] 100%
- (44/90) 正在安装 mingw-w64-x86_64-readline [#####################] 100%
- (45/90) 正在安装 mingw-w64-x86_64-tcl [#####################] 100%
- (46/90) 正在安装 mingw-w64-x86_64-sqlite3 [#####################] 100%
- (47/90) 正在安装 mingw-w64-x86_64-tk [#####################] 100%
- (48/90) 正在安装 mingw-w64-x86_64-xz [#####################] 100%
- (49/90) 正在安装 mingw-w64-x86_64-python [#####################] 100%
- (50/90) 正在安装 mingw-w64-x86_64-glib2 [#####################] 100%
- No schema files found: doing nothing.
- /
- (51/90) 正在安装 mingw-w64-x86_64-graphite2 [#####################] 100%
- (52/90) 正在安装 mingw-w64-x86_64-harfbuzz [#####################] 100%
- mingw-w64-x86_64-harfbuzz 的可选依赖
- mingw-w64-x86_64-icu: harfbuzz-icu support [等待中]
- mingw-w64-x86_64-cairo: hb-view program [等待中]
- (53/90) 正在安装 mingw-w64-x86_64-libpng [#####################] 100%
- (54/90) 正在安装 mingw-w64-x86_64-freetype [#####################] 100%
- (55/90) 正在安装 mingw-w64-x86_64-szip [#####################] 100%
- (56/90) 正在安装 mingw-w64-x86_64-hdf5 [#####################] 100%
- (57/90) 正在安装 mingw-w64-x86_64-zstd [#####################] 100%
- (58/90) 正在安装 mingw-w64-x86_64-libtiff [#####################] 100%
- (59/90) 正在安装 mingw-w64-x86_64-giflib [#####################] 100%
- (60/90) 正在安装 mingw-w64-x86_64-libwebp [#####################] 100%
- (61/90) 正在安装 mingw-w64-x86_64-icu [#####################] 100%
- (62/90) 正在安装 mingw-w64-x86_64-boost [#####################] 100%
- (63/90) 正在安装 mingw-w64-x86_64-cppunit [#####################] 100%
- (64/90) 正在安装 mingw-w64-x86_64-jxrlib [#####################] 100%
- (65/90) 正在安装 mingw-w64-x86_64-lcms2 [#####################] 100%
- (66/90) 正在安装 mingw-w64-x86_64-libraw [#####################] 100%
- (67/90) 正在安装 mingw-w64-x86_64-openjpeg2 [#####################] 100%
- (68/90) 正在安装 mingw-w64-x86_64-ilmbase [#####################] 100%
- (69/90) 正在安装 mingw-w64-x86_64-openexr [#####################] 100%
- (70/90) 正在安装 mingw-w64-x86_64-freeimage [#####################] 100%
- (71/90) 正在安装 mingw-w64-x86_64-glsl-optimiz... [#####################] 100%
- (72/90) 正在安装 mingw-w64-x86_64-hlsl2glsl-git [#####################] 100%
- (73/90) 正在安装 mingw-w64-x86_64-vulkan-headers [#####################] 100%
- (74/90) 正在安装 mingw-w64-x86_64-vulkan-loader [#####################] 100%
- (75/90) 正在安装 mingw-w64-x86_64-SDL2 [#####################] 100%
- (76/90) 正在安装 mingw-w64-x86_64-tinyxml [#####################] 100%
- (77/90) 正在安装 mingw-w64-x86_64-zziplib [#####################] 100%
- mingw-w64-x86_64-zziplib 的可选依赖
- mingw-w64-x86_64-SDL: SDL_rwops for ZZipLib
- (78/90) 正在安装 mingw-w64-x86_64-ogre3d [#####################] 100%
- (79/90) 正在安装 mingw-w64-x86_64-protobuf [#####################] 100%
- (80/90) 正在安装 mingw-w64-x86_64-fontconfig [#####################] 100%
-
- Fontconfig configuration is done via /mingw64/etc/fonts/conf.avail and conf.d.
- Read /mingw64/etc/fonts/conf.d/README for more information.
-
- updating font cache... done.
- (81/90) 正在安装 mingw-w64-x86_64-lzo2 [#####################] 100%
- (82/90) 正在安装 mingw-w64-x86_64-pixman [#####################] 100%
- (83/90) 正在安装 mingw-w64-x86_64-cairo [#####################] 100%
- mingw-w64-x86_64-cairo 的可选依赖
- mingw-w64-x86_64-glib2: libcairo-gobject [已安装]
- (84/90) 正在安装 mingw-w64-x86_64-leptonica [#####################] 100%
- (85/90) 正在安装 mingw-w64-x86_64-fribidi [#####################] 100%
- (86/90) 正在安装 mingw-w64-x86_64-libdatrie [#####################] 100%
- (87/90) 正在安装 mingw-w64-x86_64-libthai [#####################] 100%
- (88/90) 正在安装 mingw-w64-x86_64-pango [#####################] 100%
- (89/90) 正在安装 mingw-w64-x86_64-tesseract-ocr [#####################] 100%
- (90/90) 正在安装 mingw-w64-x86_64-opencv [#####################] 100%
- mingw-w64-x86_64-opencv 的可选依赖
- mingw-w64-x86_64-ffmpeg: support to read and write video files
- mingw-w64-x86_64-python3-numpy: Python 3.x interface

补充一个安装 pacman -S mingw-w64-x86_64-pkg-config
- pacman -S mingw-w64-x86_64-pkg-config
- 警告:mingw-w64-x86_64-pkg-config-0.29.2-1 已经为最新 -- 重新安装
- 正在解析依赖关系...
- 正在查找软件包冲突...
-
- 软件包 (1) mingw-w64-x86_64-pkg-config-0.29.2-1
-
- 全部安装大小: 1.31 MiB
- 净更新大小: 0.00 MiB
-
- :: 进行安装吗? [Y/n] y
- (1/1) 正在检查密钥环里的密钥 [#####################] 100%
- (1/1) 正在检查软件包完整性 [#####################] 100%
- (1/1) 正在加载软件包文件 [#####################] 100%
- (1/1) 正在检查文件冲突 [#####################] 100%
- (1/1) 正在检查可用存储空间 [#####################] 100%
- :: 正在处理软件包的变化...
- (1/1) 正在重新安装 mingw-w64-x86_64-pkg-config [#####################] 100%

注意!打开中间的64bit窗口输入pkg-config才好用!!
PC@LIF MINGW64 ~
$ pkg-config --cflags opencv4
-ID:/msys64/mingw64/include/opencv4/opencv -ID:/msys64/mingw64/include/opencv4
然而还是不行啊!
- 》更改路径的操作 MINGW64 /home
- $ cd "/D/demo/darknetopencv"
-
- 》尝试make MINGW64 /D/demo/darknetopencv
- $ make -j
- g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
- Package opencv was not found in the pkg-config search path.
- Perhaps you should add the directory containing `opencv.pc'
- to the PKG_CONFIG_PATH environment variable
- No package 'opencv' found
- ./src/image_opencv.cpp:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
- 5 | #include "opencv2/opencv.hpp"
- | ^~~~~~~~~~~~~~~~~~~~
- compilation terminated.
- make: *** [Makefile:86:obj/image_opencv.o] 错误 1
- 》看看有没有包 MINGW64 /D/demo/darknetopencv
- $ pkg-config --cflags --libs opencv
- Package opencv was not found in the pkg-config search path.
- Perhaps you should add the directory containing `opencv.pc'
- to the PKG_CONFIG_PATH environment variable
- No package 'opencv' found
-
- 》原来这个坏东西后面有个4 MINGW64 ~
- $ pkg-config --cflags --libs opencv4
- -ID:/msys64/mingw64/include/opencv4/opencv -ID:/msys64/mingw64/include/opencv4 -LD:/msys64/mingw64/lib -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_ovis -lopencv_quality -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core
-
-

注意:opencv2/opencv.hpp 实际路径是 opencv4/opencv2/opencv.hpp,需要添加头文件路径,或者复制出来。不然编译会报找不到头文件。
简单粗暴的办法是直接找到opencv4.pc然后copy一下重命名为opencv.pc,该目录应该在msys64\mingw64\lib\pkgconfig
- 》新问题 MINGW64 /D/demo/darknetopencv
- $ make -j
- g++ -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv` -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/image_opencv.cpp -o obj/image_opencv.o
- ./src/image_opencv.cpp:12:1: error: 'IplImage' does not name a type
- 12 | IplImage *image_to_ipl(image im)
- | ^~~~~~~~
- compilation terminated due to -Wfatal-errors. 》编译出现致命错误而终止。
- make: *** [Makefile:86:obj/image_opencv.o] 错误 1
我想应该是版本问题 opencv4的原因,好巧不巧github不能访问了,今日歇工。
不能因为github歇了就逃避,看了一下其他人安装成功的例子,说明opencv的最新版本是4,但是darknet仅仅支持到2.
果然github上有人碰到过这个问题,并进行了修复。Fix compilation with latest OpenCV by tiagoshibata · Pull Request #1348 · pjreddie/darknet · GitHub
Fix compilation with latest OpenCV by tiagoshibata · Pull Request #1348 · pjreddie/darknet · GitHub
以下是修复的版本
- #ifdef OPENCV
-
- #include "stdio.h"
- #include "stdlib.h"
- #include "opencv2/opencv.hpp"
- #include "opencv2/imgproc/imgproc_c.h"
- #include "image.h"
-
- using namespace cv;
-
- extern "C" {
-
- Mat image_to_mat(image im)
- {
- assert(im.c == 3 || im.c == 1);
- int x,y,c;
- image copy = copy_image(im);
- constrain_image(copy);
- if(im.c == 3) rgbgr_image(copy);
- unsigned char *data = (unsigned char *)malloc(im.w * im.h * im.c);
- for(y = 0; y < im.h; ++y){
- for(x = 0; x < im.w; ++x){
- for(c= 0; c < im.c; ++c){
- float val = copy.data[c*im.h*im.w + y*im.w + x];
- data[y*im.w*im.c + x*im.c + c] = (unsigned char)(val*255);
- }
- }
- }
- Mat m(im.h, im.w, CV_MAKETYPE(CV_8U, im.c), data);
- free_image(copy);
- free(data);
- return m;
- }
-
- image mat_to_image(Mat m)
- {
- int h = m.rows;
- int w = m.cols;
- int c = m.channels();
- image im = make_image(w, h, c);
- unsigned char *data = (unsigned char*)m.data;
- int step = m.step;
- int i, j, k;
-
- for(i = 0; i < h; ++i){
- for(k= 0; k < c; ++k){
- for(j = 0; j < w; ++j){
- im.data[k*w*h + i*w + j] = data[i*step + j*c + k]/255.;
- }
- }
- }
- rgbgr_image(im);
- return im;
- }
-
- void *open_video_stream(const char *f, int c, int w, int h, int fps)
- {
- VideoCapture *cap;
- if(f) cap = new VideoCapture(f);
- else cap = new VideoCapture(c);
- if(!cap->isOpened()) return 0;
- if(w) cap->set(CAP_PROP_FRAME_WIDTH, w);
- if(h) cap->set(CAP_PROP_FRAME_HEIGHT, w);
- if(fps) cap->set(CAP_PROP_FPS, w);
- return (void *) cap;
- }
-
- image get_image_from_stream(void *p)
- {
- VideoCapture *cap = (VideoCapture *)p;
- Mat m;
- *cap >> m;
- if(m.empty()) return make_empty_image(0,0,0);
- return mat_to_image(m);
- }
-
- image load_image_cv(char *filename, int channels)
- {
- int flag = -1;
- if (channels == 0) flag = -1;
- else if (channels == 1) flag = 0;
- else if (channels == 3) flag = 1;
- else {
- fprintf(stderr, "OpenCV can't force load with %d channels\n", channels);
- }
- Mat m;
- m = imread(filename, flag);
- if(!m.data){
- fprintf(stderr, "Cannot load image \"%s\"\n", filename);
- char buff[256];
- sprintf(buff, "echo %s >> bad.list", filename);
- system(buff);
- return make_image(10,10,3);
- //exit(0);
- }
- image im = mat_to_image(m);
- return im;
- }
-
- int show_image_cv(image im, const char* name, int ms)
- {
- Mat m = image_to_mat(im);
- imshow(name, m);
- int c = waitKey(ms);
- if (c != -1) c = c%256;
- return c;
- }
-
- void make_window(char *name, int w, int h, int fullscreen)
- {
- namedWindow(name, WINDOW_NORMAL);
- if (fullscreen) {
- setWindowProperty(name, WND_PROP_FULLSCREEN, WINDOW_FULLSCREEN);
- } else {
- resizeWindow(name, w, h);
- if(strcmp(name, "Demo") == 0) moveWindow(name, 0, 0);
- }
- }
-
- }
-
- #endif

但是事情并没有结束,新问题出现了
- include/darknet.h:780:11: error: unknown type name 'clock_t'; did you mean 'clockid_t'?
- 780 | float sec(clock_t clocks);
- | ^~~~~~~
- | clockid_t
CLOCK_REALTIME not available in OSX, use clock_get_time · pjreddie/darknet@63268da · GitHub
在darknet.h增加#include <time.h>
再次编译:
- ./examples/go.c:786:5: error: unknown type name 'fd_set'
- 786 | fd_set readfds;
- | ^~~~~~
- compilation terminated due to -Wfatal-errors.
- make: *** [Makefile:89:obj/go.o] 错误 1
Compilation Error : "unknown type name 'fd_set' · Issue #318 · pjreddie/darknet · GitHub
exemples / go.c文件中缺少此导入:#include <sys/select.h>
- ./examples/go.c:6:10: fatal error: sys/select.h: No such file or directory
- 6 | #include <sys/select.h>
- | ^~~~~~~~~~~~~~
- compilation terminated.
尝试Windows等价于sys / select.h
#include < winsock2.h >
- more undefined references to `timersub' follow
- collect2.exe: error: ld returned 1 exit status
不可行,参考了一下Yolo+Windows 配置(详细版) - 2师兄不会胖 - 博客园的 f 解决方法。但是会有警告。
- warning: assignment to 'struct timeval *' from 'long long int' makes pointer from integer without a cast [-Wint-conversion]
- 28 | res = a - b;
更为规范的方法可以参考关于 struct timeval - Chinaunix - Powered by Discuz!
根据timeval的结构定义:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
应当为
res->tv_sec = a->tv_sec - b->tv_sec;
一开始我是添加在了include下的darknet.h里面,这样在连接时会有错误:multiple definition of `timersub'
- D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj/demo.o:demo.c:(.text+0x100): multiple definition of `timersub'; obj/gemm.o:gemm.c:(.text+0x0): first defined here
实在想不通就翻time相关系统文件,每一个都去查找了一下,发现msys64\mingw64\x86_64-w64-mingw32\include\_timeval.h文件中有对timeval的定义,但并不包括add和sub,于是添加以下定义。
- #define timeradd(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
- if ((vvp)->tv_usec >= 1000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_usec -= 1000000; \
- } \
- } while (0)
- #define timersub(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
- if ((vvp)->tv_usec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_usec += 1000000; \
- } \
- } while (0)

编译成功了,但是在win命令行中运行会有错误,这是因为编译出来的可执行文件,要依赖 MSYS2 提供的动态链接库。(详见MSYS2 在 windows 上的开发环境_乐吧的博客-CSDN博客_msys2 printf)
MSYS2 有三个执行脚本,分别是 msys2_shell.bat、mingw32_shell.bat 和 mingw64_shell.bat
区别就是对环境变量 PATH 的不同设置,mingw32_shell.bat 优先使用 msys64/mingw32 下的工具,mingw64_shell.bat 优先使用 msys64/mingw64 下的工具,而 msys2_shell.bat 两个都不使用,只用自身 msys 的工具(依赖 msys2xxx.dll)。所以要添加路径。
找到了路径后,添加一下环境变量后再次尝试执行
解决办法:DLL中无法定位程序输入点inflateReset2于动态链接库_wb175208的专栏-CSDN博客_无法定位程序输入点inflatereset2
不过运行完程序后还是应该对系统文件复原。
运行!测试一下视频,找到了一个免费的课程,蛮有帮助的:
YOLO、SSD实战:手把手教你做目标检测-2-Darknet安装与测试-马孔伟的在线视频教程-CSDN程序员研修院
根据提供的命令测试一个本地视频:
结果如下:
找的是一个有鸟有人的视频,可能因为鸟在飞就容易检测不到,效果卡成ppt,fps:1(可能是硬件问题,毕竟在折磨cpu)
- D:\demo\darknet0205>.\darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights data/demo.flv
- Demo
- layer filters size input output
- 0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs
- 1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
- 2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs
- 3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
- 4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs
- 5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
- 6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs
- 7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
- 8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs
- 9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
- 10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
- 11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
- 12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
- 13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs
- 14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
- 15 conv 255 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 255 0.044 BFLOPs
- 16 yolo
- 17 route 13
- 18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs
- 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128
- 20 route 19 8
- 21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs
- 22 conv 255 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 255 0.088 BFLOPs
- 23 yolo
- Loading weights from yolov3-tiny.weights...Done!
- video file: data/demo.flv
- [2J[1;1H
- FPS:162.0
- Objects:
-
- [2J[1;1H
- FPS:1.1
- Objects:
-
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 82%
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 83%
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 89%
- bird: 69%
- person: 52%
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 92%
- bird: 68%
- [2J[1;1H
- FPS:1.0
- Objects:
-
- person: 92%
- bird: 59%
- [2J[1;1H
- FPS:1.1
- Objects:
-
- person: 90%
- person: 51%
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 91%
- person: 54%
- [2J[1;1H
- FPS:1.1
- Objects:
-
- person: 90%
- person: 56%
- [2J[1;1H
- FPS:1.2
- Objects:
-
- person: 91%
- person: 58%
- bird: 52%
- [2J[1;1H
- FPS:1.1
- Objects:

测试视频的命令:
.\darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights data/demo.flv
在调试过程中看到的可能会有用的问题解决方案,备忘一下:
文件名这个修改不错
关于videoio视频 Fixed OpenCV Compilation Errors by eweill · Pull Request #38 · pjreddie/darknet · GitHub
卸载msys2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。