参照 macOS Sierra (10.12.3)编译Caffe 编译成功 Caffe
后,开始尝试使用 Caffe
的 Python
接口,执行如下命令:
$ make pycaffe
编译一切成功,但是当执行
import caffe
的时候,程序崩溃,提示如下内容:
Segmentation fault: 11
继续阅读macOS Sierra (10.12.4)编译pycaffe成功后,执行时候崩溃,错误“Segmentation fault: 11”
参照 macOS Sierra (10.12.3)编译Caffe 编译成功 Caffe
后,开始尝试使用 Caffe
的 Python
接口,执行如下命令:
$ make pycaffe
编译一切成功,但是当执行
import caffe
的时候,程序崩溃,提示如下内容:
Segmentation fault: 11
继续阅读macOS Sierra (10.12.4)编译pycaffe成功后,执行时候崩溃,错误“Segmentation fault: 11”
macOS Sierra
(10.12.4
)下使用Python
操作视频,FFMPEG
是目前来说最好的一个选择,但是没有为Python
专门提供适配接口,网上搜索了比较长时间,才找到PyAV
来操作FFMPEG
。
PyAV
的文档地址在:https://mikeboers.github.io/PyAV/
代码地址在:https://github.com/mikeboers/PyAV
首先需要通过HomeBrew
安装FFMPEG
:
$ brew install ffmpeg
接下来安装PyAV
,安装方式两种:
一种是直接通过PIP
来安装:
$ pip install av
另外一种是通过下载代码来手工安装
$ git clone https://github.com/mikeboers/PyAV.git $ cd PyAV $ python setup.py install
安装好后的例子如下:
import av from av.frame import Frame from av.packet import Packet from av.stream import Stream from av.utils import AVError from av.video import VideoFrame container = av.open('san.mp4') for frame in container.decode(video=0): frame.to_image().save('./pyav/frame-%04d.jpg' % frame.index)