19 种损失函数,你能认识几个?

机器学习的19 种损失函数总结(Pytorch 计算) 1 基本用法 criterion = LossCriterion() #构造函数有自己的参数 loss = criterion(x, y) #调用标准时也有参数 2 损失函数 2-1 L1 范数损失 L1Loss 计算 output 和 target 之差的绝对值。 torch.nn.L1Loss(reduction='mean') 参数: reduction - 三个值,non... 阅读详情

作者:mingo_敏

zenRRan稍有有添加

https://blog.csdn.net/shanglianlm/article/details/85019768

来自:深度学习自然语言处理

tensorflow和pytorch很多都是相似的,这里以pytorch为例。

19种损失函数

1. L1范数损失 L1Loss

计算 output 和 target 之差的绝对值。

torch.nn.L1Loss(reduction='mean')

参数:

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

2 均方误差损失 MSELoss

计算 output 和 target 之差的均方差。

torch.nn.MSELoss(reduction='mean')

参数:

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

3 交叉熵损失 CrossEntropyLoss

当训练有 C 个类别的分类问题时很有效. 可选参数 weight 必须是一个1维 Tensor, 权重将被分配给各个类别. 对于不平衡的训练集非常有效。

在多分类任务中,经常采用 softmax 激活函数+交叉熵损失函数,因为交叉熵描述了两个概率分布的差异,然而神经网络输出的是向量,并不是概率分布的形式。所以需要 softmax激活函数将一个向量进行“归一化”成概率分布的形式,再采用交叉熵损失函数计算 loss。

torch.nn.CrossEntropyLoss(weight=None,ignore_index=-100, reduction='mean')

参数:

weight (Tensor, optional) – 自定义的每个类别的权重. 必须是一个长度为 C 的 Tensor

ignore_index (int, optional) – 设置一个目标值, 该目标值会被忽略, 从而不会影响到 输入的梯度。

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

4 KL 散度损失 KLDivLoss

计算 input 和 target 之间的 KL 散度。KL 散度可用于衡量不同的连续分布之间的距离, 在连续的输出分布的空间上(离散采样)上进行直接回归时 很有效.

torch.nn.KLDivLoss(reduction='mean')

参数:

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

5 二进制交叉熵损失 BCELoss

二分类任务时的交叉熵计算函数。用于测量重构的误差, 例如自动编码机. 注意目标的值 t[i] 的范围为0到1之间.

torch.nn.BCELoss(weight=None, reduction='mean')

参数:

weight (Tensor, optional) – 自定义的每个 batch 元素的 loss 的权重. 必须是一个长度为 “nbatch” 的 的 Tensor

6 BCEWithLogitsLoss

BCEWithLogitsLoss损失函数把 Sigmoid 层集成到了 BCELoss 类中. 该版比用一个简单的 Sigmoid 层和 BCELoss 在数值上更稳定, 因为把这两个操作合并为一个层之后, 可以利用 log-sum-exp 的 技巧来实现数值稳定.

torch.nn.BCEWithLogitsLoss(weight=None, reduction='mean', pos_weight=None)

参数:

weight (Tensor, optional) – 自定义的每个 batch 元素的 loss 的权重. 必须是一个长度 为 “nbatch” 的 Tensor

7 MarginRankingLoss
torch.nn.MarginRankingLoss(margin=0.0, reduction='mean')

对于 mini-batch(小批量) 中每个实例的损失函数如下:

参数:

margin:默认值0


8 HingeEmbeddingLoss
torch.nn.HingeEmbeddingLoss(margin=1.0,  reduction='mean')

对于 mini-batch(小批量) 中每个实例的损失函数如下:

参数:

margin:默认值1

9 多标签分类损失 MultiLabelMarginLoss
torch.nn.MultiLabelMarginLoss(reduction='mean')

对于mini-batch(小批量) 中的每个样本按如下公式计算损失:

10 平滑版L1损失 SmoothL1Loss

也被称为 Huber 损失函数。

torch.nn.SmoothL1Loss(reduction='mean')


其中

11 2分类的logistic损失 SoftMarginLoss
torch.nn.SoftMarginLoss(reduction='mean')



12 多标签 one-versus-all 损失 MultiLabelSoftMarginLoss
torch.nn.MultiLabelSoftMarginLoss(weight=None, reduction='mean')


13 cosine 损失 CosineEmbeddingLoss
torch.nn.CosineEmbeddingLoss(margin=0.0, reduction='mean')


参数:

margin:默认值0

14 多类别分类的hinge损失 MultiMarginLoss
torch.nn.MultiMarginLoss(p=1, margin=1.0, weight=None,  reduction='mean')


参数:

p=1或者2 默认值:1
margin:默认值1

15 三元组损失 TripletMarginLoss

和孪生网络相似,具体例子:给一个A,然后再给B、C,看看B、C谁和A更像。

torch.nn.TripletMarginLoss(margin=1.0, p=2.0, eps=1e-06, swap=False, reduction='mean')


其中:

16 连接时序分类损失 CTCLoss

CTC连接时序分类损失,可以对没有对齐的数据进行自动对齐,主要用在没有事先对齐的序列化数据训练上。比如语音识别、ocr识别等等。

torch.nn.CTCLoss(blank=0, reduction='mean')

参数:

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

17 负对数似然损失 NLLLoss

负对数似然损失. 用于训练 C 个类别的分类问题.

torch.nn.NLLLoss(weight=None, ignore_index=-100,  reduction='mean')

参数:

weight (Tensor, optional) – 自定义的每个类别的权重. 必须是一个长度为 C 的 Tensor

ignore_index (int, optional) – 设置一个目标值, 该目标值会被忽略, 从而不会影响到 输入的梯度.

18 NLLLoss2d

对于图片输入的负对数似然损失. 它计算每个像素的负对数似然损失.

torch.nn.NLLLoss2d(weight=None, ignore_index=-100, reduction='mean')

参数:

weight (Tensor, optional) – 自定义的每个类别的权重. 必须是一个长度为 C 的 Tensor

reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。

19 PoissonNLLLoss

目标值为泊松分布的负对数似然损失

torch.nn.PoissonNLLLoss(log_input=True, full=False,  eps=1e-08,  reduction='mean')

参数:

log_input (bool, optional) – 如果设置为 True , loss 将会按照公 式 exp(input) - target * input 来计算, 如果设置为 False , loss 将会按照 input - target * log(input+eps) 计算.

full (bool, optional) – 是否计算全部的 loss, i. e. 加上 Stirling 近似项 target * log(target) - target + 0.5 * log(2 * pi * target).

eps (float, optional) – 默认值: 1e-8

参考资料

pytorch loss function 总结

http://www.voidcn.com/article/p-rtzqgqkz-bpg.html

Ollama+FAISS+Embedding+Rerank+LLM 详细部署指南 下载安装Ollama 双击运行安装程序 安装完成后会自动启动服务 修改默认安装路径(避免C盘爆满) 或使用PowerShell: 验证安装 Linux系统部署: (二)准备模型 1. 拉取Embedding模型 2. 拉取LLM模型 注意:原文中提到的可能需要从自定义仓库拉取: 3. 下载Rerank模型 (三)安装依赖库 创建项目目录和虚拟环境: 二、主要功能实现 项目结构 (一)配置文件(config/config.yaml) (二)文本分块策略实现 创建 : (三)文档读取 阅读详情

相关推荐

微波无源器件 功分器1 新型方波导双模无功功分器

本名证明了一种基于有着特定功能的(dedicated)T性匹配元件(散射件)的进化结点的新型波导双模两路功分器的可行性。这个散射件,有着面向三个部分的匹配部分,提供了等效功分并且朝着对应的输出端口传输矩形波导的两个TE10/TE01正交模式。所提出的设计紧凑,易于比例变化并且能够级联来获得。

qq_45245770的博客 1397

损失函数(lossfunction)的全面介绍(简单易懂版)

此篇文章会带你快速了解lossfunction(损失函数),用简单的语言,方便理解!!!!!

小林学编程的博客 17万+

YOLO26涨点改进 | 独家创新,细节涨点改进篇 | CVPR 2025顶会 | YOLO26引入Mona即插即用模块, 含MoCAA和DyTMona二次创新改进,含多种创新改进高效发论文

本文给大家介绍Mona即插即用模块, 含MoCAA和DyTMona二次创新模块优化YOLO26模型。YOLO26引入 Mona通过引入多尺度视觉友好型卷积滤波器(如3x3、5x5、7x7深度卷积)和可伸缩归一化层来优化适配器设计,以更好地处理视觉信号并调节输入特征分布。YOLO26引入Mona即插即用模块, 含MoCAA和DyTMona二次创新改进,含多种创新改进高效发论文。适合目标检测、图像分割、图像分类等所有CV任务通用即插即用模块。

Ai缝合怪、助力小伙伴高效发论文 249

【深度学习】最全的十九种损失函数汇总

【深度学习】最全的十九种损失函数汇总

wzk4869的博客 3万+

自动驾驶---Planning模块详细介绍(以Apollo为例)

主要介绍高速场景下Planning模块,至于低速的泊车场景对比高速场景或者城区场景有比较大的差距(后面也会介绍泊车场景),本篇Planning介绍主要包括三大子模块Routing,Behavioural Planning以及Motion Planining,并且对比较重要的Decider和Optimizer都做了通俗化的说明供大家思考,以便于后续理解更深入的内容,后面有时间会再开一些篇幅对这些模块进行更加深入的讲解。

智能汽车人的博客 2095

`tokenizer.decode` 出现乱码或异常输出,怎么处理

摘要: 在使用Hugging Face Transformers库时,tokenizer.decode出现乱码或异常输出的解决方案包括:1)确保模型与分词器严格匹配,加载时使用trust_remote_code=True;2)谨慎处理特殊token,先保留所有token再针对性清理;3)校验模型输出token的维度和数值是否合法;4)通过convert_tokens_to_string替代解码;5)检查生成配置如max_new_tokens等参数。核心思路是确保模型与分词器逻辑对齐、输出token合法,必要

ZhangJiqun&191cm&85kg 592

神经网络中的损失函数(Loss Function)

损失函数通常是一个非负实数函数,表示为L(Y, f(X)),其中Y是实际值(也称为标签或真实值),f(X)是模型的预测值(也称为输出值或估计值),X是输入数据。损失函数的值越小,表示模型的预测结果与实际值越接近,模型的性能也就越好。在这些任务中,模型的目标是尽可能准确地预测连续变量的值,而MAE则提供了一个衡量模型预测精度的有效指标。在这些任务中,模型的目标是准确预测样本所属的类别,而交叉熵损失则提供了一个衡量模型预测精度的有效指标。RMSE是通过计算预测值与实际值之间差的平方的平均值的平方根来衡量的。

搏博的专栏 1万+

疾风气象大模型4.0白皮书

《疾风气象大模型白皮书摘要》 疾风气象大模型(J-AFM)是国内首个基于3D建模的气象智能平台,突破传统二维气象分析的局限,采用体素化技术构建"x-y-z-t"四维统一模型,实现从分钟级短临到30天跨时效的连续预测。核心技术包括:1)多源数据三维同化,融合雷达、卫星、风廓线等异构数据;2)物理约束AI解码器,嵌入能量守恒、湍流封闭等气象原理;3)行业适配插件,服务风电、光伏、航空等领域,如山地风场尾流校正、云影短临预测。平台支持批流一体推理与边缘部署,提供概率化输出和误差溯源能力,显著降

专注AI大模型,软件混淆,授权 551

十九种损失函数,你能认识几个?

点击上方,选择星标或置顶,每天给你送干货!阅读大概需要10分钟跟随小博主,每天进步一丢丢作者:mingo_敏zenRRan稍有有添加链接:https://blog.csdn.net/sh...

zenRRan的博客 336

【已解决】WorkBuddy 国内版与国际版共存 + 关闭自动更新 教程

本文介绍在Windows系统中同时安装并共存WorkBuddy国内版与国际版的完整方案,通过修改product.json文件关闭启动自动更新,修复缓存配置污染问题,确保两版本互不干扰、数据独立。重点解决因共享身份标识导致的更新源错乱、进程锁冲突及自动覆盖风险,提供命令行备份与修改步骤,并强调手动升级时需避免使用应用内更新功能,以规避平台参数错位缺陷。

人生是一场修行 1831

【即插即用模块】卷积篇 | TGRS 2025 | HLKConv:小核+空洞=大核,感受野一致,但更轻更准!

本文介绍了分层大核卷积模块HLKConv,该模块通过动态大核+空洞卷积实现高效感受野扩展,将超大核卷积分解为小核+空洞卷积(如53×53核用17×17+dilation=3实现),计算量仅为普通大核的1/10。模块采用双分支设计:基础卷积分支捕捉局部细节,大核空洞分支捕捉长距离关联,通过1×1卷积融合。实验表明HLKConv在红外小目标检测中优于传统大核卷积,适用于高分辨率视觉任务。代码实现了不同核尺寸的配置,输入输出特征维度保持不变,计算效率显著提升。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 354

损失函数详解

是一种衡量模型与数据吻合程度的算法。损失函数测量实际测量值和预测值之间差距的一种方式。损失函数的值越高预测就越错误,损失函数值越低则预测越接近真实值。对每个单独的观测(数据点)计算损失函数。将所有损失函数(loss function)的值取平均值的函数称为代价函数(cost function),更简单的理解就是损失函数是针对单个样本的,而代价函数是针对所有样本的。。在构建模型的过程中,如果特征的权重发生了变化得到了更好或更差的预测,就需要利用损失函数来判断模型中特征的权重是否需要改变,以及改变的方向。

金石软件 8730

Origin教程004:Origin图形导出

需要编辑的话,双击图形,会自动用origin软件打开图形,这种方式是最开始导出图形的功能,方式一和二都是后面增加的。如果导出的图片边距较大的时候,会影响图片的美观,可以通过。也可以设置在PPT中直接编辑,找到。解决方法是,选择一条线,

WwLK123的博客 6355

19种损失函数,你能认识几个?

作者:mingo_敏链接:https://blog.csdn.net/shanglianlm/article/details/85019768tensorflow和pyt...

爱编程 219

深度学习工具包 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")

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

【深度学习】19 种损失函数,你能认识几个?

作者:mingo_敏zenRRan稍有有添加https://blog.csdn.net/shanglianlm/article/details/85019768转载自:深度学习自然语言处理tensorflow和pytorch很多都是相似的,这里以pytorch为例。19种损失函数1. L1范数损失 L1Loss计算 output 和 target 之差的绝对值。torch.nn.L1Loss(re...

fengdu78的博客 1931

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

超全!19 种损失函数,你能认识几个?

磐创AI分享来源 | 智能算法作者 |mingo_敏编辑| 深度学习自然语言处理小编zenRRan【导读】tensorflow和pytorch很多都是相似的,这里以pytor...

机器学习算法那些事 824

c++ log函数_19 种损失函数,你能认识几个?

作者:mingo_敏zenRRan稍有有添加https://blog.csdn.net/shanglianlm/article/details/85019768来自:深度学习自然语言处理tensorflow和pytorch很多都是相似的,这里以pytorch为例。19种损失函数1. L1范数损失 L1Loss计算 output 和 target 之差的绝对值。torch.nn.L1Los...

weixin_39638603的博客 126

c++ log函数_收藏 | 深度学习19种损失函数,你能认识几个?

点上方蓝字人工智能算法与Python大数据获取更多干货在右上方···设为星标★,第一时间获取资源仅做学术分享,如有侵权,联系删除转载于 :作者:mingo_敏zenRRan稍有有添加https://blog.csdn.net/shanglianlm/article/details/85019768tensorflow和pytorch很多都是相似的,这里以pytorch为例。19种损...

weixin_39640767的博客 140

19种损失函数汇总

19种损失函数 目录 1. L1范数损失 L1Loss 2 均方误差损失 MSELoss 3 交叉熵损失 CrossEntropyLoss 4 KL 散度损失 KLDivLoss 5 二进制交叉熵损失 BCELoss 6 BCEWithLogitsLoss 7 MarginRankingLoss 8 HingeEmbeddingLoss 9 多标签分类损失 MultiLabelMarginLoss 10 平滑版L1损失 SmoothL1Loss 11. 2分类的logistic损失

1294

深度学习19种损失函数

tensorflow和pytorch很多都是相似的,这里以pytorch为例。计算 output 和 target 之差的绝对值。 参数:计算 output 和 target 之差的均方差。 参数:当训练有 C 个类别的分类问题时很有效. 可选参数 weight 必须是一个1维 Tensor, 权重将被分配给各个类别. 对于不平衡的训练集非常有效。在多分类任务中,经常采用 softmax 激活函数+交叉熵损失函数,因为交叉熵描述了两个概率分布的差异,然而神经网络输出的是向量,并不是概率分布的形式。所

VIEO 2265

深度学习的19种损失函数

损失函数通过torch.nn包实现 基本用法 criterion = LossCriterion() #构造函数有自己的参数loss = criterion(x, y) #调用标准时也有参数19种损失函数 L1范数损失 L1Loss 计算 output 和 target 之差的绝对值。 torch.nn.L1Loss(reduction=‘mean’)参数: reduction-三个值,none: 不使用约简;mean:返回loss和的平均值;sum:返回loss的和。默认:mean。 均方误差损失

qq_35988224的博客 3019

十九种损失函数,你认识几个?

作者:mingo_敏编辑:深度学习自然语言处理小编zenRRan链接:https://blog.csdn.net/shanglianlm/article/details/...

算法channel 816

【机器学习】19种的损失函数汇总

作者:mingo_敏编辑:深度学习自然语言处理链接:https://blog.csdn.net/shanglianlm/article/details/85019768tensorflow和pytorch很多都是相似的,这里以pytorch为例。19种损失函数1. L1范数损失 L1Loss计算 output 和 target 之差的绝对值。torch.nn.L1Loss(reduction='m...

fengdu78的博客 913

pytorch 损失函数_不能更全!Pytorch的19个损失函数总结

公众号关注“Python遇见机器学习”设为“星标”,第一时间知晓最新干货~转自https://blog.csdn.net/shanglianlm/article/details/85019768今天我们来介绍一波 pytorch 中必不可少的损失函数,看看下面十九个超全的损失函数总结中,你都知道几个?pytorch 中的损失函数通过 import torch.nn包来实现调用,基本用法...

weixin_39823299的博客 499
上一篇: 2020 诺贝尔奖「第一棒」:英美三位科学家摘得桂冠!
下一篇: 机器学习:不要低估树模型的威力
机器学习算法那些事
博客等级 码龄9年 1633粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址