常用损失函数

2023-05-16

损失函数汇总

  • 1 目标检测类
    • 1.1 分类
      • 1.1.1 centerloss
      • 1.1.2 arcsoftmax
      • 1.1.3 focalloss
    • 1.2 人脸
      • 1.2.1GIOU_loss
      • 1.2.2 DIOU_LOSS
      • 1.2.3 CIOU_LOSS
      • 1.2.4 IOU_LOSS
  • 2 图像分割类
    • 2.1 Dice loss

1 目标检测类

1.1 分类

1.1.1 centerloss

class Centerloss(nn.Module):
    def __init__(self, lambdas, feature_num=2, class_num=10):
        super().__init__()
        self.lambdas = lambdas
        self.center = nn.Parameter(torch.randn(class_num, feature_num), requires_grad=True)

    def forward(self, feature, label):
        '''每个lable对应的中心点列成一个新的矩阵'''

        feature=nn.functional.normalize(feature)


        center_exp = self.center.index_select(dim=0, index=label.long())
        count = torch.histc(label, bins=int(max(label).item() + 1), min=0, max=int(max(label).item()))
        '''每个lable对应种类的个数形成的一个新的一维向量'''
        count_exp = count.index_select(dim=0, index=label.long())
        loss = self.lambdas / 2 * torch.mean(torch.div(torch.sum(torch.pow(feature - center_exp, 2), dim=1), count_exp))
        return loss

1.1.2 arcsoftmax

class ArcNet(nn.Module):
    def __init__(self,feature_dim=2,cls_dim=10):
        super().__init__()
        #生成一个隔离带向量,训练这个向量和原来的特征向量尽量分开,达到增加角度的目的
        self.W=nn.Parameter(torch.randn(feature_dim,cls_dim).cuda(),requires_grad=True)
    def forward(self, feature,m=1,s=10):
        #对特征维度进行标准化
        x = F.normalize(feature,dim=1)#shape=【100,2】
        w = F.normalize(self.W, dim=0)#shape=【2,10】
        # print(x.shape)
        # print(w.shape)
        # s=64
        s = torch.sqrt(torch.sum(torch.pow(x, 2))) * torch.sqrt(torch.sum(torch.pow(w, 2)))
        # print(torch.sqrt(torch.sum(torch.pow(x, 2))))
        # print(torch.sqrt(torch.sum(torch.pow(w, 2))))
        # print(s)
        # 做L2范数化,将cosa变小,防止acosa梯度爆炸
        cosa = torch.matmul(x, w)/s
        # print(cosa)#[-1,1]

        "标准化后的x(-1,1)再求平方(1,1),相当于求它的单位向量(1),所以求x的平方和就是批次100*1=100"
        "同理标准化后的w有10个维度,就等于10*1=10"
        "所以s就等于sqrt(100)*sqrt(10)≈31.6"
        # print(torch.sum(torch.pow(x,2)),torch.sum(torch.pow(w,2)))
        a=torch.acos(cosa)#反三角函数得出的是弧度,而非角度,1弧度=1*180/3.14=57角度
        # 这里对e的指数cos(a+m)再乘回来,让指数函数的输出更大,
        # 从而使得arcsoftmax输出更小,即log_arcsoftmax输出更小,则-log_arcsoftmax更大。
        # m=0.5
        arcsoftmax = torch.exp(
            s * torch.cos(a + m)) / (torch.sum(torch.exp(s * cosa), dim=1, keepdim=True) - torch.exp(
            s * cosa) + torch.exp(s * torch.cos(a + m)))
        # print(arcsoftmax)
        # 这里arcsomax的概率和不为1,小于1。这会导致交叉熵损失看起来很大,且最优点损失也很大
        # print(torch.sum(arcsoftmax, dim=1))
        # exit()

        # lmsoftmax = (torch.exp(cosa) - m) / (
        #         torch.sum(torch.exp(cosa) - m, dim=1, keepdim=True) - (torch.exp(cosa) - m) + (torch.exp(cosa) - m))

        return arcsoftmax

1.1.3 focalloss

from torch import nn
import torch
from torch.nn import functional as F


class focal_loss(nn.Module):
    def __init__(self, alpha=0.25, gamma=2, num_classes=2, size_average=True):
        """
        focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi)
        步骤详细的实现了 focal_loss损失函数.
        :param alpha:   阿尔法α,类别权重.      当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25
        :param gamma:   伽马γ,难易样本调节参数. retainnet中设置为2
        :param num_classes:     类别数量
        :param size_average:    损失计算方式,默认取均值
        """
        super(focal_loss, self).__init__()
        self.size_average = size_average
        if isinstance(alpha, list):
            assert len(alpha) == num_classes  # α可以以list方式输入,size:[num_classes] 用于对不同类别精细地赋予权重
            # print(" --- Focal_loss alpha = {}, 将对每一类权重进行精细化赋值 --- ".format(alpha))
            self.alpha = torch.Tensor(alpha)
        else:
            assert alpha < 1  # 如果α为一个常数,则降低第一类的影响,在目标检测中为第一类
            # print(" --- Focal_loss alpha = {} ,将对背景类进行衰减,请在目标检测任务中使用 --- ".format(alpha))
            self.alpha = torch.zeros(num_classes)
            self.alpha[0] += alpha
            self.alpha[1:] += (1 - alpha)  # α 最终为 [ α, 1-α, 1-α, 1-α, 1-α, ...] size:[num_classes]

        self.gamma = gamma

    def forward(self, preds, labels):
        """
        focal_loss损失计算
        :param preds:   float32 cpu  预测类别. size:[B,N,C] or [B,C]    分别对应与检测与分类任务, B 批次, N检测框数, C类别数
        :param labels:  int64 cpu 实际类别. size:[B,N] or [B]
        :return:
        """
        # assert preds.dim()==2 and labels.dim()==1
        preds = preds.view(-1, preds.size(-1))
        self.alpha = self.alpha.to(preds.device)
        preds_logsoft = F.log_softmax(preds, dim=1)  # log_softmax
        preds_softmax = torch.exp(preds_logsoft)  # softmax

        preds_softmax = preds_softmax.gather(1, labels.reshape(-1, 1))  # 这部分实现nll_loss ( crossempty = log_softmax + nll )
        preds_logsoft = preds_logsoft.gather(1, labels.reshape(-1, 1))
        self.alpha = self.alpha.gather(0, labels.view(-1))
        loss = -torch.mul(torch.pow((1 - preds_softmax), self.gamma),
                          preds_logsoft)  # torch.pow((1-preds_softmax), self.gamma) 为focal loss中 (1-pt)**γ

        loss = torch.mul(self.alpha, loss.t())
        if self.size_average:
            loss = loss.mean()
        else:
            loss = loss.sum()
        return loss

1.2 人脸

1.2.1GIOU_loss

1、解决具有相同重叠面积,损失相同的问题
2、解决不相交的情况,损失都为0

def Giou(rec1,rec2):
    #分别是第一个矩形左右上下的坐标
    x1,x2,y1,y2 = rec1 
    x3,x4,y3,y4 = rec2
    iou = Iou(rec1,rec2)
    area_C = (max(x1,x2,x3,x4)-min(x1,x2,x3,x4))*(max(y1,y2,y3,y4)-min(y1,y2,y3,y4))
    area_1 = (x2-x1)*(y1-y2)
    area_2 = (x4-x3)*(y3-y4)
    sum_area = area_1 + area_2

    w1 = x2 - x1   #第一个矩形的宽
    w2 = x4 - x3   #第二个矩形的宽
    h1 = y1 - y2
    h2 = y3 - y4
    W = min(x1,x2,x3,x4)+w1+w2-max(x1,x2,x3,x4)    #交叉部分的宽
    H = min(y1,y2,y3,y4)+h1+h2-max(y1,y2,y3,y4)    #交叉部分的高
    Area = W*H    #交叉的面积
    add_area = sum_area - Area    #两矩形并集的面积

    end_area = (area_C - add_area)/area_C    #闭包区域中不属于两个框的区域占闭包区域的比重
    giou = iou - end_area
    return giou

1.2.2 DIOU_LOSS

def Diou(bboxes1, bboxes2):
    rows = bboxes1.shape[0]
    cols = bboxes2.shape[0]
    dious = torch.zeros((rows, cols))
    if rows * cols == 0:#
        return dious
    exchange = False
    if bboxes1.shape[0] > bboxes2.shape[0]:
        bboxes1, bboxes2 = bboxes2, bboxes1
        dious = torch.zeros((cols, rows))
        exchange = True
    # #xmin,ymin,xmax,ymax->[:,0],[:,1],[:,2],[:,3]
    w1 = bboxes1[:, 2] - bboxes1[:, 0]
    h1 = bboxes1[:, 3] - bboxes1[:, 1] 
    w2 = bboxes2[:, 2] - bboxes2[:, 0]
    h2 = bboxes2[:, 3] - bboxes2[:, 1]

    area1 = w1 * h1
    area2 = w2 * h2

    center_x1 = (bboxes1[:, 2] + bboxes1[:, 0]) / 2 
    center_y1 = (bboxes1[:, 3] + bboxes1[:, 1]) / 2 
    center_x2 = (bboxes2[:, 2] + bboxes2[:, 0]) / 2
    center_y2 = (bboxes2[:, 3] + bboxes2[:, 1]) / 2

    inter_max_xy = torch.min(bboxes1[:, 2:],bboxes2[:, 2:]) 
    inter_min_xy = torch.max(bboxes1[:, :2],bboxes2[:, :2]) 
    out_max_xy = torch.max(bboxes1[:, 2:],bboxes2[:, 2:]) 
    out_min_xy = torch.min(bboxes1[:, :2],bboxes2[:, :2])

    inter = torch.clamp((inter_max_xy - inter_min_xy), min=0)
    inter_area = inter[:, 0] * inter[:, 1]
    inter_diag = (center_x2 - center_x1)**2 + (center_y2 - center_y1)**2
    outer = torch.clamp((out_max_xy - out_min_xy), min=0)
    outer_diag = (outer[:, 0] ** 2) + (outer[:, 1] ** 2)
    union = area1+area2-inter_area
    dious = inter_area / union - (inter_diag) / outer_diag
    dious = torch.clamp(dious,min=-1.0,max = 1.0)
    if exchange:
        dious = dious.T
    return dious

1.2.3 CIOU_LOSS

def Ciou(bboxes1, bboxes2):
    rows = bboxes1.shape[0]
    cols = bboxes2.shape[0]
    cious = torch.zeros((rows, cols))
    if rows * cols == 0:
        return cious
    exchange = False
    if bboxes1.shape[0] > bboxes2.shape[0]:
        bboxes1, bboxes2 = bboxes2, bboxes1
        cious = torch.zeros((cols, rows))
        exchange = True

    w1 = bboxes1[:, 2] - bboxes1[:, 0]
    h1 = bboxes1[:, 3] - bboxes1[:, 1]
    w2 = bboxes2[:, 2] - bboxes2[:, 0]
    h2 = bboxes2[:, 3] - bboxes2[:, 1]

    area1 = w1 * h1
    area2 = w2 * h2

    center_x1 = (bboxes1[:, 2] + bboxes1[:, 0]) / 2
    center_y1 = (bboxes1[:, 3] + bboxes1[:, 1]) / 2
    center_x2 = (bboxes2[:, 2] + bboxes2[:, 0]) / 2
    center_y2 = (bboxes2[:, 3] + bboxes2[:, 1]) / 2

    inter_max_xy = torch.min(bboxes1[:, 2:],bboxes2[:, 2:])
    inter_min_xy = torch.max(bboxes1[:, :2],bboxes2[:, :2])
    out_max_xy = torch.max(bboxes1[:, 2:],bboxes2[:, 2:])
    out_min_xy = torch.min(bboxes1[:, :2],bboxes2[:, :2])

    inter = torch.clamp((inter_max_xy - inter_min_xy), min=0)
    inter_area = inter[:, 0] * inter[:, 1]
    inter_diag = (center_x2 - center_x1)**2 + (center_y2 - center_y1)**2
    outer = torch.clamp((out_max_xy - out_min_xy), min=0)
    outer_diag = (outer[:, 0] ** 2) + (outer[:, 1] ** 2)
    union = area1+area2-inter_area
    u = (inter_diag) / outer_diag
    iou = inter_area / union
    with torch.no_grad():
        arctan = torch.atan(w2 / h2) - torch.atan(w1 / h1)
        v = (4 / (math.pi ** 2)) * torch.pow((torch.atan(w2 / h2) - torch.atan(w1 / h1)), 2)
        S = 1 - iou
        alpha = v / (S + v)
        w_temp = 2 * w1
    ar = (8 / (math.pi ** 2)) * arctan * ((w1 - w_temp) * h1)
    cious = iou - (u + alpha * ar)
    cious = torch.clamp(cious,min=-1.0,max = 1.0)
    if exchange:
        cious = cious.T
    return cious

1.2.4 IOU_LOSS

import numpy as np
def Iou(box1, box2, wh=False):
    if wh == False:
    xmin1, ymin1, xmax1, ymax1 = box1
    xmin2, ymin2, xmax2, ymax2 = box2
    else:
    xmin1, ymin1 = int(box1[0]-box1[2]/2.0), int(box1[1]-box1[3]/2.0)
    xmax1, ymax1 = int(box1[0]+box1[2]/2.0), int(box1[1]+box1[3]/2.0)
    xmin2, ymin2 = int(box2[0]-box2[2]/2.0), int(box2[1]-box2[3]/2.0)
    xmax2, ymax2 = int(box2[0]+box2[2]/2.0), int(box2[1]+box2[3]/2.0)
    # 获取矩形框交集对应的左上角和右下角的坐标(intersection)
    xx1 = np.max([xmin1, xmin2])
    yy1 = np.max([ymin1, ymin2])
    xx2 = np.min([xmax1, xmax2])
    yy2 = np.min([ymax1, ymax2])    
    # 计算两个矩形框面积
    area1 = (xmax1-xmin1) * (ymax1-ymin1) 
    area2 = (xmax2-xmin2) * (ymax2-ymin2)
    inter_area = (np.max([0, xx2-xx1])) * (np.max([0, yy2-yy1])) #计算交集面积
    iou = inter_area / (area1+area2-inter_area+1e-6)  #计算交并比

    return iou

2 图像分割类

2.1 Dice loss

class SoftDiceLoss(nn.Module):
    def __init__(self, weight=None, size_average=True, sigmoid=False):
        super(SoftDiceLoss, self).__init__()
        self.sigmoid = sigmoid

    def forward(self, logits, targets):
        num = targets.size(0)
        smooth = 1

        if self.sigmoid == True:
            logits = torch.sigmoid(logits)
        m1 = logits.view(num, -1)
        m2 = targets.view(num, -1)
        intersection = (m1 * m2)

        dice = 2. * (intersection.sum() + smooth) / ((m1 ** 2).sum() + (m2 ** 2).sum() + smooth)
        loss = 1 - dice.mean()
        return loss
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

常用损失函数 的相关文章

  • 面向对象(3)

    私有权限 封装的意义 xff1a 将属性和方法放到一起做为一个整体 xff0c 然后通过实例化对象来处理 xff1b 隐藏内部实现细节 xff0c 只需要和对象及其属性和方法交互就可以了 xff1b 对类的属性和方法增加 访问权限控制 私有
  • 【vnc远程桌面】未联网状态下使用离线包配置vnc

    系统为ubuntu18 04 amd64版本 本教程使用vino配置远程服务器 首先 xff0c 离线安装vino包后远程传输给待控制服务器 xff1a sudo apt update sudo apt get download apt c
  • 7.用选择排序法对一个数组进行排序。

    include lt stdio h gt define N 5 void datesort int a int i j k temp for i 61 0 i lt N 1 i 43 43 k 61 i for j 61 i 43 1 j
  • error while loading shared libraries: xxx.so.x"错误的原因和解决办法

    一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误 比如 tmux error while loading shared libraries libevent 1 4 so 2 cannot open shared o
  • Linux终端进度条显示进程执行进度

    在Linux执行费时操作 xff08 如tar xff09 时显示进度条 xff0c 以不至于让用户觉得程序卡死了 效果 文本进度条 结束后 xff1a 图形化字符进度条 文本进度条怎么做 进度条实现 网上有一些老六会说要下载一些工具 xf
  • 判断页面相似度的python实现

    判断页面相似度的python实现 xff1a 两天时间实现了一小部分 xff0c 大量其实是xpath解析以及字符串和文件操作 xff0c 性能还需要改善 xff0c 下面说一下步骤 xff1a 动态获取DOM树结构 xff1a 因为主要是
  • Win10下VScode+MSVC+CMake搭建C++开发环境

    最近工作需要大规模C 43 43 开发 xff0c 以往都是使用Visual Studio xff08 以下简称VS xff09 xff0c 虽然VS是一款很强大的IDE xff0c 但也同样带来过于庞大 xff0c 运行卡顿等问题 xff
  • iOS 表视图

    基本概念 1 表头视图 xff08 table header view xff09 表视图最上边的视图 xff0c 用于展示表视图的信息 2 表脚视图 xff08 table footer view xff09 表视图最下面的视图 xff0
  • ISBN从10到13位的算法

    图书的ISBN有两种编码 xff0c 一种长度是10位的 xff0c 另一种是13位的 两者其实是可以用特定的算法相互推导的 xff0c 关键在于最后一位校验码的计算 1 10位到13位 10位的isbn编号是7111165616 xff0
  • 阿里云服务器(ECS)实战--安全组策略配置(端口放行)

    什么是阿里云安全组策略 xff1f 阿里云安全组是一种虚拟防火墙 也是阿里云处于安全考虑的一种策略 一台ECS云服务器实例必须至少属于一个安全组 我们知道服务器的各种服务要依赖端口来实现 我们可以将安全组想象成服务器各个端口的开关 默认创建
  • 字符串的排序(全排序)

    一 前言 剑指Offer 中题38 二 题目 输入一个字符串 xff0c 打印出该字符串中字符的所有排列 例如 xff0c 输入字符串abc xff0c 则打印出由字符a b c所能排列出来的所有字符串abc xff0c acb xff0c
  • 自己总结的一些c语言概念 练习题

    c语言的一些基础概念 局部变量的作用域为局部变量所在的局部范围 xff0c 局部变量优于全局变量 举例如下 xff1a span class token keyword int span num span class token opera
  • iOS本地搜索(谓词)

    Use Code 默认搜索 64 param fieldArray 搜索字段数组 64 param inputString 输入文字 64 param array 搜索数据源 64 return 搜索结果 NSArray searchWit
  • zabbix 发送邮件和短信的脚本

    对接sms和监控的脚本 xff0c 其实原理很简单 xff0c zabbix会通过参数的方式传送给脚本三个参数 1 user 2 subject 3 message body 然后通过curl 通过get的方式提交网页就ok了 bin ba
  • gcc/clang编译带pthread.h头文件的源码时需要的参数

    今天敲了一个小程序 xff0c 编译时出现错误 xff1a undefined reference pthread create 原来由于pthread库不是Linux系统默认的库 xff0c 连接时需要使用库libpthread a 所以
  • python 让cpu满载

    今天弄监控报警阈值 xff0c 想要让一台linux主机满载 xff0c 却发现这个很简单的任务实现起来很难 首先从网上下载的各种bench xff0c 基本全都运行不了 在不就是无法让cpu满载 xff0c 晚上看python想起来了与来
  • windows server 服务器搭建AD、Exchange 2010

    0x01 关于windows server 在vsphere 虚拟化环境中搭建win 服务器 xff0c 并安装exchange 通过这次对win的服务器配置 xff0c 多少对win系服务有了一些了解 在win中每一种服务都能以一种集群式
  • python国内镜像站

    pipy国内镜像目前有 xff1a http pypi douban com 豆瓣 http pypi hustunique com 华中理工大学 http pypi sdutlinux org 山东理工大学 http pypi mirro
  • 能不用yum安装就不用yum装

    能不用yum安装就不用yum装 xff01 能不用yum安装就不用yum装 xff01 能不用yum安装就不用yum装 xff01 重要的事情说三遍
  • zabbix 使用JMX 监控tomcat

    JMX Java Management Extensions 是java提供的一种管理接口 xff0c 通常使用JMX来监控系统的运行状态或管理系统的某些方面 xff0c 比如清空缓存 重新加载配置文件等 百度百科介绍 xff1a JMX

随机推荐

  • python 核心编程第二版 9-9

    原题 xff1a 进入python标准库所在的目录 检查每个 py 文件看是否有doc xff0c 如果有 xff0c 对其格式进行适当的整理归类 你的程序执行完毕后 xff0c 应该生成一个漂亮的清单 里边列出哪些模块有文档字符串 xff
  • 源码安装python后,运行某些模块提示缺少libpython2.7.so

    源码安装python后 xff0c 运行某些模块提示缺少libpython2 7 so 造成这个问题的原因是使用 configure 时没有附加 enable shared 编译时使用如下命令编译 span class hljs strin
  • 2021/04/28 前端post请求传数组

    背景 xff1a 后端需要这种格式的数据 xff0c 接口文档要求如下 我也是第一次见 xff0c 后端说这叫 xff0c post一个表单数组 xff0c 原来的项目里有现成的 xff0c 参考如下 网上看 xff0c 这种描述大致是 x
  • 树莓派3B+,Lubuntu16.04安装vscode个人经验总结

    个人经验总结 xff0c 如有更好办法 xff0c 还请不吝赐教 xff01 适合树莓派3B 43 的ubuntu16 04 43 ROS Kinetic系统下载网址 xff1a https learn ubiquityrobotics c
  • 远程命令/代码执行漏洞(RCE)总结

    介绍 Command Injection xff0c 即命令注入 xff0c 是指通过提交恶意构造的参数破坏命令语句结构 xff0c 从而达到执行恶意命令的目的 PHP命令注入攻击漏洞是PHP应用程序中常见的脚本漏洞之一 当应用需要调用一些
  • 大话数据结构

    数据结构按照视点的不同可分逻辑结构和物理结构 逻辑结构 xff1a 1 集合结构 2 线性结构 3 树形结构 4 图形结构 物理结构 xff1a 1 顺序存储结构 2 链式存储结构 算法定义 xff1a 算法是解决特定问题求解步骤的 描述
  • hive常用函数

    hive常用函数 1 字符串函数1 1 字符串长度函数 xff1a length1 2 字符串反转函数 xff1a reverse1 3 字符串连接函数 xff1a concat1 4 带分隔符字符串连接函数 xff1a concat ws
  • bash:command&nbsp;not&nbsp;found以及原理

    如果新装的系统 xff0c 运行一些很正常的诸如 xff1a shutdown xff0c fdisk的命令时 xff0c 悍然提示 xff1a bash command not found 那么 首先就要考虑root 的 PATH里是否已
  • Codeforces Round #356 (Div. 1) 题解(待补)

    Bear and Prime 100Bear and Tower of CubesBear and Square GridBear and Chase Bear and Prime 100 This is an interactive pr
  • Centos 7 /local_lim.h:38:26: fatal error: linux/limits.h: No such file or directory

    今天在给一台全新的CENTOS 7 编译 部署GITHUB 项目时遇到如下问题 xff1a In file included from usr include bits posix1 lim h 160 0 from usr include
  • INTEL 傲腾16G 的再利用

    虽然当年INTEL 傲腾上市时自称是 MEMORY xff0c 不过时至2021年 xff0c 把傲腾看成一个 NVME 的SSD就可以了 技术参数 性能测试这些网上已经有很多了 xff0c 不再赘述了 缺点很明显 xff1a 容量太小 x
  • Dell 服务器 用板载网口访问iDrac 并设置风扇静音

    最近需要在办公区域放一台DELL R230 进行测试 xff0c 由于加装了 C2000 pro NVME SSD作为数据盘 xff0c 导致风扇开机后就直奔15000 43 转 xff1b 官方的解释是 xff1a 由于PCIE通道上使用
  • sina 股票接口 2022.1.21 更新

    常年以来 xff0c 作为数据挖掘的一部分 xff0c 作为模拟交易的接口 xff0c 一直使用 sina 的股票接口 http hq sinajs cn 白嫖 xff1b 2022年1月21日 xff0c 这次新浪接口更新后增加了 htt
  • 使用nginx 反向代理 wordpress

    最近需要使用WORDPRESS 建立一个知识库 WIKI xff0c nginx 和wordpress的安装教程网上已经有很多了 xff0c 不再赘述 具体配置参照如下 xff0c 达到效果 xff1a 访问 https www abc c
  • linux 查看CPU 核心温度

    以下命令直接查看CPU 核心温度 echo cat sys class thermal thermal zone0 temp 1000
  • 加速github下载

    前言 由于github 的服务器在海外 xff0c 在国内下载github资源很慢 xff0c 或者无法下载 尤其是最近AI 大火 提供一种加速方式 git config global url 34 https g blfrp cn 34
  • 后ARM时代,嵌入式工程师的自我修养

    1 嵌入式学习的一些概念理解误区 很多嵌入式初学者认为 xff0c 学嵌入式 xff0c 就是学习ARM xff0c 就是学习开发板 买一块开发板 xff0c 然后在上面 移植 u boot Linux内核 xff0c 再使用busybox
  • Linux在shell下输出进度条

    无论下载 xff0c 解压缩 xff0c 复制等情况时 xff0c 我们总能看到进度条这种东西 进度条以图片形式的可视化窗口直观的显示出计算机处理当前任务的速度 xff0c 完成度 xff0c 剩余完成的任务量 xff0c 以及需要的时间等
  • linux ls 按文件大小排序

    ls Sl 其是按照由大到小排序 xff0c 如果想要反过来 xff0c 从小到大 xff0c 那么用 ls Slr 再者 xff0c 如果想要输入是按照 便于人类阅读的方式 xff0c 那么就再加一个 h xff0c 表示 34 huma
  • 常用损失函数

    损失函数汇总 1 目标检测类1 1 分类1 1 1 centerloss1 1 2 arcsoftmax 1 1 3 focalloss 1 2 人脸1 2 1GIOU loss1 2 2 DIOU LOSS1 2 3 CIOU LOSS1