https://github.com/01org/caffe
build完caffe,执行
build/tools/caffe-fp16.bin test -model models/yolo/yolo416/yolo_fused_test.prototxt -phase TEST -iterations 1000000 -weights models/yolo/yolo416/fused_yolo.caffemodel -gpu 0
报错
Unable to stop the stream: Inappropriate ioctl for device
F0824 18:45:43.096151 22955 video_data_layer.cpp:53] Failed to open video: examples/videos/ILSVRC2015_train_00755001.mp4
*** Check failure stack trace: ***
@ 0x7f8fc9f67e6d (unknown)
@ 0x7f8fc9f69ced (unknown)
@ 0x7f8fc9f67a5c (unknown)
@ 0x7f8fc9f6a63e (unknown)
@ 0x7f8fcafb8bca caffe::VideoDataLayer<>::DataLayerSetUp()
@ 0x7f8fcae460f4 caffe::BasePrefetchingDataLayer<>::LayerSetUp()
@ 0x7f8fcafec116 caffe::Net<>::Init()
@ 0x7f8fcafee69d caffe::Net<>::Net()
@ 0x414681 test()
@ 0x4117fc main
@ 0x7f8fc0072b35 __libc_start_main
@ 0x412229 (unknown)
Aborted (core dumped)
解决:将ffmpeg_test.cpp替换opencv/cmake/checks 目录下的同名文件,重新编译安装
ffmpeg_test.cpp
#include <stdlib.h>
#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
#undef _STDINT_H
#endif
# include <stdint.h>
#endif
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
}
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
static void test()
{
AVFormatContext* c = 0;
AVCodec* avcodec = 0;
AVFrame* frame = 0;
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
int err = avformat_open_input(&c, "", NULL, NULL);
#else
int err = av_open_input_file(&c, "", NULL, 0, NULL);
#endif
}
int main() { test(); return 0; }