详细的FFmpeg编译流程与脚本分析

FFmpeg 详尽编译过程 个人概率性介绍,我在后来测试的时候,就是把别人的 .sh 脚本程序代码,直接拷贝到,我的 linux 系统下使用 vim 编译器打开的脚本中,然后更换自己的路径。在上面编写的Android.mk中,我们制定了后缀名**.c文件的名字为ffmpeg_jni.c**,所以c文件要与Android.mk的LOCAL_SRC_FILES:= ffmpeg_jni.c与此保持一致;对于整个编译的过程我的感触是非常深刻的,因为我在这个编译的过程中踏到了好多的“雷”,每个来的很是突然,都是触不及防的突然。 阅读详情
AI摘要

本文详细介绍FFmpeg的编译流程、配置选项及模块剪裁方法。从源码准备到编译脚本编写,再到so库剪裁和硬件加速配置,帮助读者掌握FFmpeg在不同平台上的高效编译技巧。

FFmpeg是一个跨平台的多媒体库,也是目前音视频领域应用最广泛的库。它包括libavcodec、libavformat、libavutil、libavdevice、libavfilter、libswscale、libswresample、libpostproc等模块,其中avcodec用于编解码,avformat用于解封装,avutil是提供工具类,avdevice用于各平台的设备接入(包括采集与录像,Android的mediacodec硬解,Intel的VAAPI硬件加速,Nvidia的cuda),avfilter提供滤镜操作,swscale提供图像缩放与像素格式转换,swresample提供音频重采样,postproc提供高级处理。

目录

一、准备工作

1、下载ffmpeg源码

2、下载ndk源码

二、编译ffmpeg源码

1、分析configure结构

2、修改so后缀

3、修改hevc_mvs.c

4、移除avresample

5、编译脚本

6、编译问题分析

三、so库剪裁

1、encoders与decoders

2、muxers与demuxers

3、protocols

4、parsers

 四、编译过程分析

1、预编译

2、编译

3、汇编

4、链接

5、FFmpeg的makefile分析

五、neon加速与硬件加速

1、开启neon

2、硬件加速


一、准备工作

1、下载ffmpeg源码

使用git命令:git clone https://github.com/FFmpeg/FFmpeg.git。

2、下载ndk源码

如果是在Android平台使用FFmpeg,需要在Android开发者文档下载到对应版本的ndk源码,https://developer.android.com/ndk/downloads。mac电脑配置ndk系统环境变量步骤如下:

(1)、在命令行输入vim ~/.bash_profile

(2)、输入i进行编辑模式

(3)、编写export NDK_PATH=xxx/xxx/android-ndk-r20b

(4)、按下esc退出编辑模式,输入:wq保存并退出

二、编译ffmpeg源码

1、分析configure结构

在FFmpeg源码目录有个configure配置脚本,使用./configure --help进行查看,可以看到如下结构的编译选项:

Help options:
  --help                   print this message
  --quiet                  Suppress showing informative output
  --list-decoders          show all available decoders
  --list-encoders          show all available encoders
  --list-hwaccels          show all available hardware accelerators
  --list-demuxers          show all available demuxers
  --list-muxers            show all available muxers
  --list-parsers           show all available parsers
  --list-protocols         show all available protocols
  --list-bsfs              show all available bitstream filters
  --list-indevs            show all available input devices
  --list-outdevs           show all available output devices
  --list-filters           show all available filters

Standard options:
  --logfile=FILE           log tests and output to FILE [ffbuild/config.log]
  --disable-logging        do not log configure debug information
  --prefix=PREFIX          install in PREFIX [/usr/local]

Licensing options:
  --enable-gpl             allow use of GPL code [no]
  --enable-version3        upgrade (L)GPL to version 3 [no]
  --enable-nonfree         allow use of nonfree code [no]

Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --enable-small           optimize for size instead of speed
  --disable-runtime-cpudetect disable detecting CPU capabilities at runtime
  --disable-all            disable building components, libraries and programs
  --disable-autodetect     disable automatically detected external libraries [no]

Program options:
  --disable-programs       do not build command line programs
  --disable-ffmpeg         disable ffmpeg build
  --disable-ffplay         disable ffplay build
  --disable-ffprobe        disable ffprobe build

Documentation options:
  --disable-doc            do not build documentation

Component options:
  --disable-avdevice       disable libavdevice build
  --disable-avcodec        disable libavcodec build
  --disable-avformat       disable libavformat build
  --disable-swresample     disable libswresample build
  --disable-swscale        disable libswscale build
  --disable-postproc       disable libpostproc build
  --disable-avfilter       disable libavfilter build
  --disable-pthreads       disable pthreads [autodetect]
  --disable-network        disable network support [no]

Individual component options:
  --disable-everything     disable all components listed below
  --disable-encoder=NAME   disable encoder NAME
  --enable-encoder=NAME    enable encoder NAME
  --disable-encoders       disable all encoders
  --disable-decoder=NAME   disable decoder NAME
  --enable-decoder=NAME    enable decoder NAME
  --disable-decoders       disable all decoders
  --disable-hwaccel=NAME   disable hwaccel NAME
  --enable-hwaccel=NAME    enable hwaccel NAME
  --disable-hwaccels       disable all hwaccels
  --disable-muxer=NAME     disable muxer NAME
  --enable-muxer=NAME      enable muxer NAME
  --disable-muxers         disable all muxers
  --disable-demuxer=NAME   disable demuxer NAME
  --enable-demuxer=NAME    enable demuxer NAME
  --disable-demuxers       disable all demuxers
  --enable-parser=NAME     enable parser NAME
  --disable-parser=NAME    disable parser NAME
  --disable-parsers        disable all parsers
  --enable-protocol=NAME   enable protocol NAME
  --disable-protocol=NAME  disable protocol NAME
  --disable-protocols      disable all protocols
  --disable-devices        disable all devices
  --enable-filter=NAME     enable filter NAME
  --disable-filter=NAME    disable filter NAME
  --disable-filters        disable all filters

External library support:
  --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
  --enable-jni             enable JNI support [no]
  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
  --enable-libass          enable libass subtitles rendering [no]
  --enable-libdav1d        enable AV1 decoding via libdav1d [no]
  --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
  --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
  --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
  --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  --enable-libopencv       enable video filtering via libopencv [no]
  --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
  --enable-libopus         enable Opus de/encoding via libopus [no]
  --enable-librtmp         enable RTMP[E] support via librtmp [no]
  --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
  --enable-libsoxr         enable Include libsoxr resampling [no]
  --enable-libspeex        enable Speex de/encoding via libspeex [no]
  --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
  --enable-libssh          enable SFTP protoco
ffmpeg源码编译详细过程与使用(含demo) 关于ffmpeg so库的编译,网上存在各种教程。有些基于windows,有些基于linux~而基于linux的:一般会选择安装虚拟机,在其上跑ubuntu系统。其实各种方式都是可以的,只要最后可以编译出我们需要的so库,就是正道。win10开始自带了linux的子系统,我们可以直接使用该子系统进行编译工作,而无需安装虚拟机等繁琐流程。编译新版的ffmpegdemo中会使用ffmpeg新版的api(注:网上好多教程的demo部分其实无法正常使用,部分api在新版已经废弃) 阅读详情

相关推荐

音视频开发三:Windows环境下FFmpeg编译安装

Windows环境下FFmpeg编译安装

qq_38056514的博客 3973

音视频开发系列(11)详细的FFmpeg编译流程与脚本分析

FFmpeg是一个跨平台的多媒体库,也是目前音视频领域应用最广泛的库。它包括libavcodec、libavformat、libavutil、libavdevice、libavfilter、libswscale、libswresample、libpostproc等模块,其中avcodec用于编解码,avformat用于解封装,avutil是提供工具类,avdevice用于各平台的设备接入(包括采集与录像,Android的mediacodec硬解,Intel的VAAPI硬件加速,Nvidia的cuda),av

yinshipin007的博客 1459

FFmpeg添加字幕的详细操作

在视频中添加字幕可以使视频更具可读性,并为观众提供更好的观看体验,这在多语种内容中尤为重要。FFmpeg是一个流行的开源视频处理工具,它可以被用来给视频添加字幕。本文将介绍FFmpeg集成libass的编译流程,介绍SRT和ASS字幕格式及其参数,如何使用FFmpeg向视频添加硬字幕和软字幕,并通过示例演示如何生成单一字幕和多项字幕。 而本文最后实现的效果为:默认中英文字幕,可选英文字幕的软字幕的实现。

秦城季的博客 2万+

ffmpeg命令分析【详细分析合集】

ffmpeg命令分析【内容包括】-vf/ac/b:v/r/re/segment/t/ss/output_ts_offset/vn/acc/print/yuv420p/yuv封装mp4/FFmpeg硬件加速/pix_fmt/拉取TCP流/tee输出多路流/ffmpeg复杂滤镜filter_complex/map_channel/vframe

qq_52703909的博客 2626

ffmpeg源码分析

1 简述 ffmpeg.exe 是一个非常快速的音频视频转换工具, 我们可以通过它进行格式,编码转换,还可以加滤镜。它可以读取普通文件,网络文件,甚至抓取设备数据。ffmpeg 转码的过程如下图所示: ffmpeg 涉及的c 文件有三个:ffmpeg.c , ffmpeg_opt.c,cmdutils.c ,有关ffmpeg.exe 框架,引用雷神画的流程图: 从上图我们可以看到,main() 函数中调用的函数有: 1)av_register_all() 2)show_banner() .

陌上烟雨遥的博客 3655

ffmpeg shell编译脚本详解

编写ffmpeg编译脚本: ffmpeg-build.sh #!/bin/bash #1、首先:定义下载的库名称 source="ffmpeg-3.4" #2、其次:定义".h/.m/.c"文件编译的结果目录 #目录作用:用于保存.h/.m/.c文件编译后的结果.o文件 cache="cache" #3、定义".a"静态库保存目录 #pwd命令:表示获取当前目录 staticdir=`pwd...

安卓兼职framework和app工程师的博客 762

快速编译FFmpeg库的Android平台脚本

FFmpeg是一个非常强大的开源多媒体框架,用于录制、转换数字音视频,并能将其流化处理。其支持几乎所有的音视频格式,包括流行的MP4、AVI、MP3、AC3等。FFmpeg不仅提供了命令行工具供开发者和终端用户直接使用,还包含了丰富的API供开发者二次开发,是多媒体处理领域中不可或缺的工具。在处理多媒体文件方面,FFmpeg提供了全面的功能,包括但不限于:视频和音频的编码与解码。流媒体协议支持,如HTTP、RTSP、HLS等。滤镜处理,例如视频的裁剪、旋转、特效添加等。

weixin_36427956的博客 1066

FFmpeg音视频处理及编译流程教程

FFmpeg是一套开源的多媒体框架,它包括了一系列可执行程序和库,用于处理音视频数据。从初学者到高级开发者,FFmpeg都能为他们提供广泛的音频和视频处理功能,比如转码、流媒体、滤镜处理等。转码: 将音视频文件从一种格式转换为另一种格式。流媒体处理: 实时传输音视频流。滤镜应用: 应用视频滤镜,比如调整亮度、对比度,或者应用水印。音视频同步: 确保音频和视频流保持同步。帧率转换: 改变视频的帧率以适应不同的播放需求。编解码器支持。

weixin_29885875的博客 1033

拆解大疆M300电池BMS:基于TI TIDA-010030方案的硬件架构深度分析

本文深度解析了大疆M300无人机电池管理系统(BMS)基于TI TIDA-010030参考设计的硬件架构。通过对比TI方案与大疆实现的差异,详细介绍了BQ7694003监控前端和BQ34Z100电量计的优化设计,以及通信架构的可靠性改进。文章还揭示了大疆在成本、空间和标准化方面的工程妥协与创新平衡,为锂电池保护方案提供了实践参考。

weixin_27066963的博客 251

Xiaojie雷达之路---毫米波雷达基础知识---角度估计

本篇文章主要介绍毫米波雷达的基础知识中的角度估计,对于本篇文章主要回答5个问题 1.在雷达的前方,如何估计前方一个物体的角度 2.角度测量的准确性 3.如何测量多个物体的角度 4.雷达可测的角度的视场最大值为多少 5.角度分辨率取决于什么因素 文章目录估计雷达前面一个物体的角度角度测量的准确性雷达的最大角视场测量雷达前方多个距离和速度相同的物体角度分辨率角度估计的流程 估计雷达前面一个物体的角度 估计一个物体的角度,最少需要两根接收天线 发射天线发送一个chirp,经过物体发射后信号,信号分别被第一根天

XiaoJie的博客 1万+

基于CANoe的车载以太网测试

以太网测试 CANoe

Yafet 4571

无需Root!用VirtualXposed+JustTrustMe在安卓高版本上抓包拼多多API数据

本文详细介绍了在安卓高版本设备上无需Root权限即可抓取拼多多API数据的完整方案,通过VirtualXposed与JustTrustMe组合技术,有效绕过SSL Pinning限制。文章涵盖工具准备、环境配置、应用处理及实战分析,特别针对PDD应用的混合通信策略提供了专业解决方案,适合开发者进行竞品分析和数据采集。

weixin_28678151的博客 462

第五章 PCIe介绍 5.1-5.7

为什么SSD要用PCIe接口?因为它快,比SATA快。通道,PCIe最多可以有32个通道。两个设备之间的PCIe连接,叫做一个Link。如下图,设备A和设备B是个双向连接,两个PCIe设备之间,有专门的发送和接收通道,数据可以同时往两个方向传输,PCIe Spec称这种工作模式为,可以理解为。和PCIe一样,SATA有独立的发送和接收通道。但与PCIe工作模式不一样,同一时间,SATA只有一条通道可以进行数据传输。这种工作模式称为。与SATA单通道不同,PCIe连接可以通过增加通道数扩展带宽。

fengbaobaola的博客 2974

vLLM 多机多卡推理测试与验证(Kubernetes)vLLM 多机多卡推理 Kubernetes 验证

本文记录在两台 L20 机器,每台机器 4 块 L20 显卡(46G)的环境下,使用 vLLM 部署 Qwen2.5-32B-Instruct-GPTQ-Int4 模型并提供多节点多卡推理服务的过程。服务(Serving)模型服务是指将模型部署到生产环境中,通过 API 或其他接口提供预测服务的过程。【分布式推理与服务】(Distributed Inference and Serving)是指在多个机器或设备之间部署和管理机器学习模型,以高效地处理推理请求并满足大规模服务需求。3、启动 vLLM 服务。

流水_鱼鱼的博客 3467

Yolov8-pose关键点检测:训练准备篇 | 自己数据集从labelme标注到生成yolo格式的关键点数据

yolov8-pose关键点检测系列:从数据集标记到生成适合yolo的关键点格式

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 5884

3. UFS 电气时钟、复位、信号和电源

当接收到用于从 HS-MODE 到 LS-MODE 转换的 DME_POWERMODE.ind 或用于从 HS-MODE 到 HIBERN8 转换的 DME_HIBERNATE_ENTER.ind 时,UFS 主机可以启动一个计时器。在整个 PA_INIT 过程中,不应门控参考时钟。如果 UFS 主机启动从 HS-MODE 到 LS-MODE 或 HIBERN8 的电源模式更改,则应确保在关闭参考时钟之前,至少已经经过了由 bRefClkGatingWaitTime 定义的最小时间间隔,见图 6.3。

qq_42238448的博客 1299

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

上一篇: sox语音开源库的功能剖析
下一篇: 常见FFmpeg命令行全面分析
徐福记456
博客等级 码龄13年 1256粉丝 173原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

徐福记456

您的鼓励和肯定是我创作动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值