YOLOv5:解读metrics.py

news2024/7/6 18:45:45

前言

  • 记录一下自己阅读metrics.py代码的一些重要点,方便自己查阅。特别感谢,在参考里,列举的博文链接,写得很好,对本人阅读理解yolo.py代码,有很大帮助。
  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入YOLO系列专栏、自然语言处理
    专栏或我的个人主页查看
  • 基于DETR的人脸伪装检测
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • YOLOv5:TensorRT加速YOLOv5模型推理
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集
  • YOLOv5:使用7.0版本训练自己的实例分割模型(车辆、行人、路标、车道线等实例分割)
  • 使用Kaggle GPU资源免费体验Stable Diffusion开源项目

前提条件

  • 熟悉Python

相关介绍

  • Python是一种跨平台的计算机程序设计语言。是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越多被用于独立的、大型项目的开发。
  • PyTorch 是一个深度学习框架,封装好了很多网络和深度学习相关的工具方便我们调用,而不用我们一个个去单独写了。它分为 CPU 和 GPU 版本,其他框架还有 TensorFlow、Caffe 等。PyTorch 是由 Facebook 人工智能研究院(FAIR)基于 Torch 推出的,它是一个基于 Python 的可续计算包,提供两个高级功能:1、具有强大的 GPU 加速的张量计算(如 NumPy);2、构建深度神经网络时的自动微分机制。
  • YOLOv5是一种单阶段目标检测算法,该算法在YOLOv4的基础上添加了一些新的改进思路,使其速度与精度都得到了极大的性能提升。它是一个在COCO数据集上预训练的物体检测架构和模型系列,代表了Ultralytics对未来视觉AI方法的开源研究,其中包含了经过数千小时的研究和开发而形成的经验教训和最佳实践。

metrics.py

fitness

  • fitness函数用来计算最终的mAP,通过对P、R、mAP@0.5、mAP@0.5:0.95的加权平均计算mAP
  • m A P = 0.0 ∗ P + 0.0 ∗ R + 0.1 ∗ ( m A P @ 0.5 ) + 0.9 ∗ ( m A P @ 0.5 : 0.95 ) mAP=0.0*P+0.0*R+0.1*(mAP@0.5)+0.9*(mAP@0.5:0.95) mAP=0.0P+0.0R+0.1(mAP@0.5)+0.9(mAP@0.50.95)
def fitness(x):
    # Model fitness as a weighted combination of metrics
    w = [0.0, 0.0, 0.1, 0.9]  # weights for [P, R, mAP@0.5, mAP@0.5:0.95]
    return (x[:, :4] * w).sum(1)

smooth

  • smooth函数用来计算预测框和真实框之间的差异的平滑值。
  • 具体来说,它通过将每个预测框的置信度与与其重叠度最高的真实框的重叠度进行加权平均来计算平滑值。这个平滑值可以用来评估模型的性能。
  • 例如,它可以用来计算模型在检测任务中的平均准确度和召回率等指标。在训练过程中,平滑值可以作为损失函数的一部分,帮助模型更好地学习预测框和真实框之间的差异。
def smooth(y, f=0.05):
    # Box filter of fraction f
    nf = round(len(y) * f * 2) // 2 + 1  # number of filter elements (must be odd)
    p = np.ones(nf // 2)  # ones padding
    yp = np.concatenate((p * y[0], y, p * y[-1]), 0)  # y padded
    return np.convolve(yp, np.ones(nf) / nf, mode='valid')  # y-smoothed

box_iou

  • loU,英文全称为Intersection of Union,中文称作交并比。对于目标检测识别而言它是一种用来衡量真实框与预测框的贴合程度的方法。
  • 假设真实框为 A A A,预测框为 B B B A ∩ B A\cap B AB表示真实框与预测框的交集, A ∪ B A\cup B AB表示真实框与预测框的并集loU具体的计算方式,如图所示。
    在这里插入图片描述
  • 使用 unsqueeze(1) 和 unsqueeze(0) 扩展了 box1 和 box2 的维度,这样我们就可以在第二个维度上进行分割。
  • 使用 chunk(2, 2) 将扩展后的张量在第二个维度上分割成两个部分。这样,我们得到了两个元组 (a1, a2) 和 (b1, b2),每个元组都包含两个元素。
  • 计算两个矩形的交集面积。这里使用了两个矩形的对角线坐标:torch.min(a2, b2) 和 torch.max(a1, b1),然后计算它们的差值的乘积。如果交集面积为负,则使用 clamp(0) 将其限制为 0。
  • .prod(2) 是对张量的第二个维度进行元素乘法运算,并返回一个标量或一维张量。对于一个形状为 (batch_size, n) 的张量,.prod(2) 将返回一个形状为 (batch_size,) 的标量,其中每个元素是该张量中对应行的所有元素的乘积。
def box_iou(box1, box2, eps=1e-7):
    # https://github.com/pytorch/vision/blob/master/torchvision/ops/boxes.py
    """
    Return intersection-over-union (Jaccard index) of boxes.
    Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
    Arguments:
        box1 (Tensor[N, 4])
        box2 (Tensor[M, 4])
    Returns:
        iou (Tensor[N, M]): the NxM matrix containing the pairwise
            IoU values for every element in boxes1 and boxes2
    注: N表示预测框数,M表示真实框数,计算预测框与真实框IoU值
    """

    # inter(N,M) = (rb(N,M,2) - lt(N,M,2)).clamp(0).prod(2)
    (a1, a2), (b1, b2) = box1.unsqueeze(1).chunk(2, 2), box2.unsqueeze(0).chunk(2, 2)
    inter = (torch.min(a2, b2) - torch.max(a1, b1)).clamp(0).prod(2)

    # IoU = inter / (area1 + area2 - inter)
    return inter / ((a2 - a1).prod(2) + (b2 - b1).prod(2) - inter + eps)

ConfusionMatrix ★ ★ \bigstar\bigstar ★★

在这里插入图片描述

class ConfusionMatrix:
    # Updated version of https://github.com/kaanakan/object_detection_confusion_matrix
    def __init__(self, nc, conf=0.25, iou_thres=0.45):
        self.matrix = np.zeros((nc + 1, nc + 1))
        self.nc = nc  # number of classes
        self.conf = conf
        self.iou_thres = iou_thres

    def process_batch(self, detections, labels):
        """
        Return intersection-over-union (Jaccard index) of boxes.
        Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
        Arguments:
            detections (Array[N, 6]), x1, y1, x2, y2, conf, class
            labels (Array[M, 5]), class, x1, y1, x2, y2
        Returns:
            None, updates confusion matrix accordingly
        """
        if detections is None: # 预测为背景,即negative
            gt_classes = labels.int() # 实际为某一目标类别
            for gc in gt_classes:
                self.matrix[self.nc, gc] += 1  # background FN
            return

        detections = detections[detections[:, 4] > self.conf] # 获取到>conf的预测框
        gt_classes = labels[:, 0].int() # 真实框类别
        detection_classes = detections[:, 5].int() # 预测框类别
        iou = box_iou(labels[:, 1:], detections[:, :4]) # 计算真实框与预测框IoU值,shape:(Tensor[N, M]),表示N个真实框与M个预测框的IoU值(二维数组表示)

        x = torch.where(iou > self.iou_thres) # 在张量(tensor)中执行条件语句iou > self.iou_thres并返回满足条件的元素的位置。
        if x[0].shape[0]:
            matches = torch.cat((torch.stack(x, 1), iou[x[0], x[1]][:, None]), 1).cpu().numpy() # array([[ 0,  1, 0.85],[1, 2,  0.6],]) # [0,  1, 0.85]表示第0个真实框与第1个预测框的置信度为0.85
            if x[0].shape[0] > 1:
                matches = matches[matches[:, 2].argsort()[::-1]] # 以置信度为条件基准,排序,这里-1为降序
                matches = matches[np.unique(matches[:, 1], return_index=True)[1]] # 去重(列维度)
                matches = matches[matches[:, 2].argsort()[::-1]] # 降序
                matches = matches[np.unique(matches[:, 0], return_index=True)[1]] # 去重(行维度)
        else: # x为空的情况
            matches = np.zeros((0, 3))

        n = matches.shape[0] > 0 # 判断真实和预测框匹配数是否>0
        # transpose()是NumPy数组的一个方法,用于转置数组。它会返回一个转置后的新数组,而不会在原地修改原始数组。
        # astype(int)是NumPy数组的另一个方法,用于将数组中的元素转换为整数类型。它会返回一个新的数组,其中所有元素都转换为整数类型。
        # 注意的是,transpose()和astype(int)都会返回一个新的数组,不会修改原始数组。如果需要修改原始数组,可以将返回值赋值给原始数组。
        m0, m1, _ = matches.transpose().astype(int) # m0表示第m0[i]个真实框,m1表示第m1[i]个预测框
        for i, gc in enumerate(gt_classes): # 遍历真实框
            j = m0 == i # array([False, False])
            sumj = sum(j)
            if n and sum(j) == 1: # (真实框和预测框匹配数不为0) 且 (当前遍历真实框与matches记录的m0一致)
                self.matrix[detection_classes[m1[j]], gc] += 1  # correct # 预测框与真实框一致
            else: # 预测为背景,真实为gc
                self.matrix[self.nc, gc] += 1  # true background

        if n:
            for i, dc in enumerate(detection_classes):# 遍历预测框
                if not any(m1 == i): # 预测为dc,真实为背景
                    self.matrix[dc, self.nc] += 1  # predicted background

    def tp_fp(self):
        tp = self.matrix.diagonal()  # true positives # 获取混淆矩阵对角线元素
        fp = self.matrix.sum(1) - tp  # false positives # atrix.sum(1) 用于计算混淆矩阵的每一列元素之和
        # fn = self.matrix.sum(0) - tp  # false negatives (missed detections)
        return tp[:-1], fp[:-1]  # remove background class

    @TryExcept('WARNING ⚠️ ConfusionMatrix plot failure')
    def plot(self, normalize=True, save_dir='', names=()):
        import seaborn as sn

        array = self.matrix / ((self.matrix.sum(0).reshape(1, -1) + 1E-9) if normalize else 1)  # normalize columns
        array[array < 0.005] = np.nan  # don't annotate (would appear as 0.00)

        fig, ax = plt.subplots(1, 1, figsize=(12, 9), tight_layout=True)
        nc, nn = self.nc, len(names)  # number of classes, names
        sn.set(font_scale=1.0 if nc < 50 else 0.8)  # for label size
        labels = (0 < nn < 99) and (nn == nc)  # apply names to ticklabels
        ticklabels = (names + ['background']) if labels else 'auto'
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')  # suppress empty matrix RuntimeWarning: All-NaN slice encountered
            sn.heatmap(array,
                       ax=ax,
                       annot=nc < 30,
                       annot_kws={
                           'size': 8},
                       cmap='Blues',
                       fmt='.2f',
                       square=True,
                       vmin=0.0,
                       xticklabels=ticklabels,
                       yticklabels=ticklabels).set_facecolor((1, 1, 1))
        ax.set_xlabel('True')
        ax.set_ylabel('Predicted')
        ax.set_title('Confusion Matrix')
        fig.savefig(Path(save_dir) / 'confusion_matrix.png', dpi=250)
        plt.close(fig)

    def print(self):
        for i in range(self.nc + 1):
            print(' '.join(map(str, self.matrix[i])))

bbox_iou ★ ★ \bigstar\bigstar ★★

  • 在yolov5中,bbox_iou函数会用于预测框回归损失的计算,比如IoU_loss、GIoU_loss、DIoU_loss、CIoU_loss
  • 详细可查阅YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU:https://blog.csdn.net/FriendshipTang/article/details/129969044
def bbox_iou(box1, box2, xywh=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-7):
    # Returns Intersection over Union (IoU) of box1(1,4) to box2(n,4)

    # Get the coordinates of bounding boxes
    if xywh:  # transform from xywh to xyxy
        (x1, y1, w1, h1), (x2, y2, w2, h2) = box1.chunk(4, -1), box2.chunk(4, -1)
        w1_, h1_, w2_, h2_ = w1 / 2, h1 / 2, w2 / 2, h2 / 2
        b1_x1, b1_x2, b1_y1, b1_y2 = x1 - w1_, x1 + w1_, y1 - h1_, y1 + h1_
        b2_x1, b2_x2, b2_y1, b2_y2 = x2 - w2_, x2 + w2_, y2 - h2_, y2 + h2_
    else:  # x1, y1, x2, y2 = box1
        b1_x1, b1_y1, b1_x2, b1_y2 = box1.chunk(4, -1)
        b2_x1, b2_y1, b2_x2, b2_y2 = box2.chunk(4, -1)
        w1, h1 = b1_x2 - b1_x1, (b1_y2 - b1_y1).clamp(eps)
        w2, h2 = b2_x2 - b2_x1, (b2_y2 - b2_y1).clamp(eps)

    # Intersection area
    inter = (b1_x2.minimum(b2_x2) - b1_x1.maximum(b2_x1)).clamp(0) * \
            (b1_y2.minimum(b2_y2) - b1_y1.maximum(b2_y1)).clamp(0)

    # Union Area
    union = w1 * h1 + w2 * h2 - inter + eps

    # IoU
    iou = inter / union
    if CIoU or DIoU or GIoU:
        cw = b1_x2.maximum(b2_x2) - b1_x1.minimum(b2_x1)  # convex (smallest enclosing box) width
        ch = b1_y2.maximum(b2_y2) - b1_y1.minimum(b2_y1)  # convex height
        if CIoU or DIoU:  # Distance or Complete IoU https://arxiv.org/abs/1911.08287v1
            c2 = cw ** 2 + ch ** 2 + eps  # convex diagonal squared
            rho2 = ((b2_x1 + b2_x2 - b1_x1 - b1_x2) ** 2 + (b2_y1 + b2_y2 - b1_y1 - b1_y2) ** 2) / 4  # center dist ** 2
            if CIoU:  # https://github.com/Zzh-tju/DIoU-SSD-pytorch/blob/master/utils/box/box_utils.py#L47
                v = (4 / math.pi ** 2) * (torch.atan(w2 / h2) - torch.atan(w1 / h1)).pow(2)
                with torch.no_grad():
                    alpha = v / (v - iou + (1 + eps))
                return iou - (rho2 / c2 + v * alpha)  # CIoU
            return iou - rho2 / c2  # DIoU
        c_area = cw * ch + eps  # convex area
        return iou - (c_area - union) / c_area  # GIoU https://arxiv.org/pdf/1902.09630.pdf
    return iou  # IoU

compute_ap

  • compute_ap函数用于计算单个类别的AP值
def compute_ap(recall, precision):
    """ Compute the average precision, given the recall and precision curves
    # Arguments
        recall:    The recall curve (list)
        precision: The precision curve (list)
    # Returns
        Average precision, precision curve, recall curve

    计算某个类别在某个iou阈值下的mAP
    """

    # Append sentinel values to beginning and end
    mrec = np.concatenate(([0.0], recall, [1.0]))
    mpre = np.concatenate(([1.0], precision, [0.0]))

    # Compute the precision envelope
    mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))

    # Integrate area under curve
    method = 'interp'  # methods: 'continuous', 'interp'
    if method == 'interp':
        x = np.linspace(0, 1, 101)  # 101-point interp (COCO)
        ap = np.trapz(np.interp(x, mrec, mpre), x)  # integrate
    else:  # 'continuous'
        i = np.where(mrec[1:] != mrec[:-1])[0]  # points where x axis (recall) changes
        ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1])  # area under curve

    return ap, mpre, mrec

ap_per_class(难度: ⋆ ⋆ ⋆ ⋆ ⋆ \star\star\star\star\star

  • ap_per_class函数,用于计算每一个类的平均precision并绘制P-R曲线
  • 下面这些图,就是这个函数计算来的。
    在这里插入图片描述
def ap_per_class(tp, conf, pred_cls, target_cls, plot=False, save_dir='.', names=(), eps=1e-16, prefix=''):
    """ Compute the average precision, given the recall and precision curves.
    Source: https://github.com/rafaelpadilla/Object-Detection-Metrics.
    # Arguments
        tp:  True positives (nparray, nx1 or nx10).
        conf:  Objectness value from 0-1 (nparray).
        pred_cls:  Predicted object classes (nparray).
        target_cls:  True object classes (nparray).
        plot:  Plot precision-recall curve at mAP@0.5
        save_dir:  Plot save directory
    # Returns
        The average precision as computed in py-faster-rcnn.

        计算每一个类的平均precision并绘制P-R曲线

参数:
    tp:true positive
    conf:预测框的conf
    pred_cls:预测框的class
    target_cls:GT的class
    plot:是否绘制PR曲线
    save_dir:保存路径

返回值:
    p:最大平均f1时每个类别的precision
    r:最大平均f1时每个类别的recall
    ap:每个类别在10个iou阈值下的mAP
    f1:最大平均f1时每个类别的f1
    unique_classes:数据集中所有的类别index
    """

    # Sort by objectness
    i = np.argsort(-conf) # 对 conf 数组从大到小排序
    tp, conf, pred_cls = tp[i], conf[i], pred_cls[i] # 使tp,conf,pred_cls对应从大到小排序

    # Find unique classes
    unique_classes, nt = np.unique(target_cls, return_counts=True) # 独一的类别,去掉重复
    nc = unique_classes.shape[0]  # number of classes, number of detections # 这一批真实框对应的类别数

    # Create Precision-Recall curve and compute AP for each class
    px, py = np.linspace(0, 1, 1000), []  # for plotting
    ap, p, r = np.zeros((nc, tp.shape[1])), np.zeros((nc, 1000)), np.zeros((nc, 1000))
    # 计算每个类别的指标 
    for ci, c in enumerate(unique_classes): # 遍历真实框类别
        i = pred_cls == c
        n_l = nt[ci]  # number of labels # 每一类的类别个数
        n_p = i.sum()  # number of predictions # 
        if n_p == 0 or n_l == 0:
            continue

        # Accumulate FPs and TPs
        # 统计随着预测目标的增多,TP与FP数量的变化
        fpc = (1 - tp[i]).cumsum(0) # 计算累积总和
        tpc = tp[i].cumsum(0) # 计算累积总和

        # 统计精确率与召回率曲线,这里的曲线是指精确率与召回率随着样本数增加的变化
        # p与r是iou阈值为0.5的精确率与召回率曲线(所有类别的,每类对应一条曲线)
        # recall与precision则是所有iou阈值下的精确率与召回率曲线
        # Recall
        recall = tpc / (n_l + eps)  # recall curve # 计算召回率
        r[ci] = np.interp(-px, -conf[i], recall[:, 0], left=0)  # negative x, xp because xp decreases

        # Precision
        precision = tpc / (tpc + fpc)  # precision curve # 计算精确率
        p[ci] = np.interp(-px, -conf[i], precision[:, 0], left=1)  # p at pr_score

        # AP from recall-precision curve
        # 计算每个iou阈值下的ap-->(num_cls, niou)        
        for j in range(tp.shape[1]):
            ap[ci, j], mpre, mrec = compute_ap(recall[:, j], precision[:, j])
            if plot and j == 0:
                py.append(np.interp(px, mrec, mpre))  # precision at mAP@0.5

    # Compute F1 (harmonic mean of precision and recall)
    f1 = 2 * p * r / (p + r + eps)
    names = [v for k, v in names.items() if k in unique_classes]  # list: only classes that have data
    names = dict(enumerate(names))  # to dict
    if plot:# 绘制曲线
        plot_pr_curve(px, py, ap, Path(save_dir) / f'{prefix}PR_curve.png', names)
        plot_mc_curve(px, f1, Path(save_dir) / f'{prefix}F1_curve.png', names, ylabel='F1')
        plot_mc_curve(px, p, Path(save_dir) / f'{prefix}P_curve.png', names, ylabel='Precision')
        plot_mc_curve(px, r, Path(save_dir) / f'{prefix}R_curve.png', names, ylabel='Recall')

    i = smooth(f1.mean(0), 0.1).argmax()  # max F1 index
    p, r, f1 = p[:, i], r[:, i], f1[:, i]
    tp = (r * nt).round()  # true positives
    fp = (tp / (p + eps) - tp).round()  # false positives
    return tp, fp, p, r, f1, ap, unique_classes.astype(int)

未完待续

在metrics.py中,不止上面提到的类和函数,但上面提及的类和函数是metrics.py中最关键的部分。其余函数,有兴趣者,可自行查阅。如果有空,我也会继续补充。

参考

[1] https://github.com/ultralytics/yolov5
[2] https://blog.csdn.net/qq_38253797/article/details/119904518
[3] https://blog.csdn.net/xjunjin/article/details/121475009
[4] https://blog.csdn.net/weixin_51322383/article/details/130454335

  • 记录一下自己阅读YOLOv5:解读metrics.py代码的一些重要点,方便自己查阅。特别感谢,在参考里,列举的博文链接,写得很好,对本人阅读理解yolo.py代码,有很大帮助。
  • 由于本人水平有限,难免出现错漏,敬请批评改正。
  • 更多精彩内容,可点击进入YOLO系列专栏、自然语言处理
    专栏或我的个人主页查看
  • 基于DETR的人脸伪装检测
  • YOLOv7训练自己的数据集(口罩检测)
  • YOLOv8训练自己的数据集(足球检测)
  • YOLOv5:TensorRT加速YOLOv5模型推理
  • YOLOv5:IoU、GIoU、DIoU、CIoU、EIoU
  • 玩转Jetson Nano(五):TensorRT加速YOLOv5目标检测
  • YOLOv5:添加SE、CBAM、CoordAtt、ECA注意力机制
  • YOLOv5:yolov5s.yaml配置文件解读、增加小目标检测层
  • Python将COCO格式实例分割数据集转换为YOLO格式实例分割数据集
  • YOLOv5:使用7.0版本训练自己的实例分割模型(车辆、行人、路标、车道线等实例分割)
  • 使用Kaggle GPU资源免费体验Stable Diffusion开源项目

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/974686.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

openpnp - 底部相机高级矫正后,底部相机看不清吸嘴的解决方法

文章目录 openpnp - 底部相机高级矫正后,底部相机看不清吸嘴的解决方法概述解决思路备注补充 - 新问题 - N1吸嘴到底部相机十字中心的位置差了很多END openpnp - 底部相机高级矫正后,底部相机看不清吸嘴的解决方法 概述 自从用openpnp后, 无论版本(dev/test), 都发现一个大概…

mac建议装双系统吗,详细分析苹果电脑双系统的利弊

mac建议装双系统吗&#xff0c;Mac电脑上安装双系统有哪些利弊呢&#xff0c;一起来看看吧&#xff01; 苹果Mac电脑安装双系统利&#xff1a; 1、用来办公更加方便&#xff1a;苹果系统功能也是很强大的&#xff0c;但是用来办公非常不方便&#xff0c;是由于一些常用的exe软…

Error: The project seems to require yarn but it‘s not installed.

把之前做过的vue项目拷贝到新电脑上&#xff0c;运行启动命令后发现报了如下错误&#xff1a; 我是这么解决的&#xff1a; 是因为项目中存在yarn.lock 文件&#xff0c;先把这个文件删除掉。 把这个文件删除后&#xff0c;执行如下命令&#xff1a; npm install -g yarn 下…

Docker Desktop 设置镜像环境变量

点击run 展开Optional settings container name &#xff1a;容器名称 Ports&#xff1a;根据你需要的端口进行输入&#xff0c;不输入则默认 后面这个 比如我这个 5432 Volumes&#xff1a;卷&#xff0c;也就是做持久化 需要docker 数据保存的地方 Environment variables…

TCP的滑动窗口协议有什么用?

分析&回答 滑动窗口协议&#xff1a; TCP协议的使用维持发送方/接收方缓冲区 缓冲区是 用来解决网络之间数据不可靠的问题&#xff0c;例如丢包&#xff0c;重复包&#xff0c;出错&#xff0c;乱序 在TCP协议中&#xff0c;发送方和接受方通过各自维护自己的缓冲区。通…

react16之前diff算法的理解和总结

此篇文章所讨论的是 React 16 以前的 Diff 算法。而 React 16 启用了全新的架构 Fiber&#xff0c;相应的 Diff 算法也有所改变&#xff0c;本片不详细讨论Fiber。 fiber架构是为了支持react进行可中断渲染&#xff0c;降低卡顿&#xff0c;提升流畅度。 react16之前的版本&…

什么是standard cell (标准单元) ?

参考文章&#xff1a; 聊一聊芯片后端的标准单元-standard cell - 知乎 (zhihu.com) standard cell中的7T和9T中的"T"指的是什么&#xff1f;或者是什么的缩写&#xff1f; - Layout讨论区 - EETOP 创芯网论坛 (原名&#xff1a;电子顶级开发网) - 数字后端基本概念介…

qemu-system-x86_64 命令创建虚拟机,报gtk initialization failed的

因为是ssh命令行启动&#xff0c;增加--nographic # /opt/debug/bin/qemu-system-aarch64 -machine virt-6.2 -qmp tcp:localhost:1238,server,nowait --nographic configure accelerator virt-6.2 start machine init start cpu init start add rom file: virtio-net-pci…

GIT实战篇,教你如何使用GIT可视化工具

系列文章目录 手把手教你安装Git&#xff0c;萌新迈向专业的必备一步 GIT命令只会抄却不理解&#xff1f;看完原理才能事半功倍&#xff01; 快速上手GIT命令&#xff0c;现学也能登堂入室 GIT实战篇&#xff0c;教你如何使用GIT可视化工具 系列文章目录一、GIT有哪些常用工具…

漆包线工厂云MES解决方案

漆包线行业老板痛点&#xff1a; 1.漆包线比较传统的行业&#xff0c;一般都是靠人工去管理&#xff0c;老板想及时知道工厂的生产&#xff0c;销售、出入库、库存情况&#xff1b; 2.型号多称重打印易错&#xff0c;没有系统前 &#xff1a;称重打印&#xff0c;出入库&#x…

解决github连接不上的问题

改 hosts 我们在浏览器输入 GitHub 的网址时&#xff0c;会向 DNS 服务器发送一个请求&#xff0c;获取到 GitHub 网站所在的服务器 IP 地址&#xff0c;从而进行访问。 就像你是一名快递员&#xff0c;在送快递前要先找中间人询问收件人的地址。而 DNS 就是这个告诉你目标地址…

java开发之个微机器人的二次开发

简要描述&#xff1a; 取消消息接收 请求URL&#xff1a; http://域名地址/cancelHttpCallbackUrl 请求方式&#xff1a; POST 请求头Headers&#xff1a; Content-Type&#xff1a;application/json 参数&#xff1a; 参数名类型说明codestring1000成功&#xff0c;1…

顶尖211“小清华”!强过985,不要错过它!

一、学校及专业介绍 西安电子科技大学&#xff08;Xidian University&#xff09;&#xff0c;简称“西电” &#xff0c;位于陕西省西安市&#xff0c;是中央部属高校&#xff0c;直属于教育部&#xff0c;为全国重点大学&#xff0c;位列国家“双一流”“211工程”&#xff…

宝塔面板开心版出问题升级到正版的解决方案,有效解决TypeError: ‘NoneType‘ object is not subscriptable

服务器之前图开心装了个宝塔面板的开心版&#xff0c;前几天突然出现问题&#xff0c;报错TypeError: ‘NoneType’ object is not subscriptable。没法正常打开软件商店&#xff0c;也没法修复和升级系统&#xff0c;很烦躁。因为里面很多业务还在跑&#xff0c;实在不想重装。…

呜呜呼呼无无话

姓名和手机号脱敏 function nameDesen(value) {if (!value) return return value.substring(0, 1) new Array(value.length).join(*) } const bklnameDesen(宝矿力) console.log(bkl) //宝**function telephoneDesen(value) {if (!value) return value value.toString()ret…

伦敦金投资中挂单的优势

在伦敦金交易中&#xff0c;其实挂单具有无可比拟的优势&#xff1f;首先&#xff0c;如果我们不是全职的投资者&#xff0c;我们在交易时间内可能有其他的工作&#xff0c;那么挂单就可以帮助我们捕捉到市场的机会&#xff0c;即便我们不一定会坐在电脑面前&#xff0c;也可以…

Vue中的指令

指令 指令 (Directives) 是带有 v- 前缀的特殊 attribute。指令 attribute 的值预期是单个 JavaScript 表达式。指令的职责是&#xff0c;当表达式的值改变时&#xff0c;将其产生的连带影响&#xff0c;响应式地作用于 DOM。 常用指令预期简短介绍v-showany显示隐藏元素&…

旅游攻略APP外包开发功能

旅游攻略APP是帮助旅行者计划和享受旅行的工具&#xff0c;下面列出了一些常见的旅游攻略APP功能&#xff0c;以及在上线这类应用时需要注意的问题&#xff0c;希望对大家有所帮助。北京木奇移动技术有限公司&#xff0c;专业的软件外包开发公司&#xff0c;欢迎交流合作。 常见…

6517B|吉时利keithley 6517B高阻表

181/2461/8938Keithley 6517B 静电计 / 高阻表是全球科研实验室灵敏测量的标准。吉时利在弱电测量方面拥有 60 多年的专业经验&#xff0c;吉时利静电计能够可靠地测量最低 10 aA (1010-18A) 电流、最低 1 fC 电荷&#xff0c;并支持最高 1018Ω 的电阻测量。6517B 还能够测量高…

自动化驱动程序管理

在部署操作系统时&#xff0c;每次都从下载和分发所需的驱动程序中实现真正的独立性可能是一场艰苦的战斗。特别是具有硬件多样化的环境&#xff0c;并且需要支持新的硬件类型时。借助 OS Deployer&#xff0c;可以对所有端点使用一个映像&#xff0c;无论品牌和型号如何&#…