Git Product home page Git Product logo

Comments (5)

nihui avatar nihui commented on May 23, 2024 1

yolov8 激活层使用 relu / leakyrelu 会变快些,swish 无法量化,退回fp16计算导致更大的 overhead

from ncnn.

zhenjing avatar zhenjing commented on May 23, 2024

版本:ncnn-20240410

from ncnn.

zhenjing avatar zhenjing commented on May 23, 2024

ReLU(x)=max(0,x)
LeakyReLU(x)=max(αx,x)

其中,x 是激活函数的输入,α 是一个小的正常数,通常很小(例如 0.01)。这个函数的特点是当 x 为负时,它不会直接输出零,而是输出一个很小的正比例的值 αx。这样,即使在输入为负的情况下,梯度也不会完全消失,从而帮助维持和传递一些有用的梯度信息。
Swish函数 f(x)=x⋅σ(βx)
其中,x 是输入,σ 是Sigmoid函数,而 β 是一个可训练的参数或者固定的常数。在最初的论文中,β 被设置为1或者作为一个可学习的参数。在多个基准测试中,Swish展示了与ReLU相比在深度学习模型中的性能优势。尤其是在深层网络和复杂任务中,Swish往往能够提供更好的准确率和收敛速度。

对于使用 ReLU 和 Leaky ReLU 激活函数的模型,INT8 量化是一个有效的方法来减少模型的大小和提高推理速度,同时保持可接受的精度损失。
Swish激活函数的Sigmoid函数和乘法操作都可能在低精度下引入额外的误差。

from ncnn.

zhenjing avatar zhenjing commented on May 23, 2024

通过配置改激活层,需重新训练
Change activation function of YOLOv8

from ncnn.

zhenjing avatar zhenjing commented on May 23, 2024

激活层使用 leakyrelu ,重新训练
在2并发时,fp16平均耗时100ms,int8 (opt.use_int8_inference = true) 平均耗时125ms。

测试下来,鲲鹏920环境 int8量化对yolov8没效果,有副作用。

from ncnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.