caffe_inference-optimize跑video报错

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; }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值