【深度学习实践】面部表情识别,深度学习分类模型,mmpretrain用于分类的实用教程,多任务网络头

news2024/9/21 12:42:05

文章目录

  • 数据集
  • 数据集的进一步处理
    • 转换training.csv
    • 转换validation.csv
  • 剔除无法使用的图片数据
  • 选择mmpretrain框架来训练
  • 配置四个文件
    • 改写base model
    • 改写base datasets
    • schedules
    • default_runtime
  • 总配置
  • 开始训练
  • 训练分析
    • 考虑在网络上增加facial_landmarks回归head
    • 考虑是否可以两阶段
    • 是否可以在特征后加一层512
  • 多任务学习
    • 多头网络
    • 联合损失函数,带权重的多任务损失
    • DDP 单机多卡训练
    • 余弦退火的学习率变动策略
    • 指标评测
  • 过采样(重采样)
  • 如何改进53的准确率

数据集

AffectNet数据集
AffectNet – Mohammad H. Mahoor, PhD

超过42万张图,AffectNet数据集的标注类型包括表情类型和幅度,其中表情类型包括中⽴、⾼兴、悲伤、惊讶、害怕、厌恶、愤怒和轻蔑8种基本表情,以及⽆表情、不确定和⽆⼈脸。

数据下载:

链接:https://pan.baidu.com/s/1R2ZdWPlHDDd4Z8tE7N5vtg 
提取码:1234

11个类别,标记是0到10。
在这里插入图片描述
Neutral
Happy
Sad
Surprise
Fear
Disgust
Anger
Contempt
None
Uncertain
NonFace

使用下面的代码可以将拿出10张图片放单独文件夹看一下这个数据集:

# 读取validation.csv为表,然后读取expression列,这一列的数字就是图片类别
# subDirectory_filePath列是图片路径
import pandas as pd
import os

src = r"validation.csv"
df = pd.read_csv(src)
class_list = df["expression"].unique()
fth = r"/ssd/xiedong/src_data/Manually_Annotated_Images/"

dst = r"/ssd/xiedong/src_data/val_examples/"
os.makedirs(dst, exist_ok=True)

# 每个类别复制10张图到dst的子目录,子目录名字是类别数字要创建
for c in class_list:
    sub_df = df[df["expression"] == c]
    sub_df = sub_df.sample(n=10)
    for i, row in sub_df.iterrows():
        src_file = os.path.join(fth, row["subDirectory_filePath"])
        dst_file = os.path.join(dst, str(c))
        os.makedirs(dst_file, exist_ok=True)
        os.system("cp {} {}".format(src_file, dst_file))
        print("cp {} {}".format(src_file, dst_file))

执行后会看到11个类别:

├── val_examples
│   ├── 0
│   ├── 1
│   ├── 10
│   ├── 2
│   ├── 3
│   ├── 4
│   ├── 5
│   ├── 6
│   ├── 7
│   ├── 8
│   └── 9

数据集的进一步处理

为了让mmpretrain方便训练,需要组成mmpretrain可以识别的数据集样式。

当前的数据集如下图,Manually_Annotated_Images/是多个子文件夹,子文件夹下是具体图片。
在这里插入图片描述
training.csv的前几行是这样的:
在这里插入图片描述

具体拿前2行看:
subDirectory_filePath,face_x,face_y,face_width,face_height,facial_landmarks,expression,valence,arousal
689/737db2483489148d783ef278f43f486c0a97e140fc4b6b61b84363ca.jpg,134,134,899,899,181.64;530.91;188.32;627.82;195.1;723.37;205.24;819.26;235.82;911.05;295.18;982.18;376.29;1042.33;471.12;1086.0;580.62;1095.39;686.25;1084.29;767.62;1040.37;835.76;980.69;881.37;900.39;898.21;810.86;903.09;718.35;909.41;632.04;912.71;557.24;272.31;455.02;324.2;399.25;397.75;381.28;475.46;391.38;548.4;415.29;666.88;423.52;732.98;404.65;799.61;401.4;857.29;423.11;888.86;473.73;607.14;483.05;608.91;537.83;609.27;593.64;611.04;654.61;515.31;694.98;556.72;713.3;599.07;730.13;638.32;719.39;673.94;709.59;368.89;495.52;407.82;474.54;450.23;475.29;487.48;500.47;448.86;503.7;406.67;503.2;696.84;509.42;739.53;489.14;780.68;494.3;812.04;518.24;780.27;524.1;739.38;520.31;432.72;828.9;495.08;802.44;553.6;792.73;594.12;805.31;632.55;800.26;685.77;814.54;726.14;843.06;682.25;865.78;628.51;873.12;588.43;874.66;549.8;870.79;489.27;854.55;453.19;831.06;551.34;821.61;592.47;828.18;631.76;827.79;706.12;842.32;629.81;841.72;590.19;844.72;550.35;838.36,1,0.785714,-0.0555556

csv文件类似excel表,第一列是subDirectory_filePath表示了图片路径,expression这一列就是表情的类别,其他列暂时无用。

按照下图中的要求格式,需要给一个annotation file来指定类别。
在这里插入图片描述

转换training.csv

转换training.csv成转换training.txt,每一行就是:“图片名 所属类别”

执行这个代码:

import pandas as pd

src = r"training.csv"
dst = r"training.txt"
df = pd.read_csv(src)
# 第一行是列名,需要取subDirectory_filePath列和expression列,然后写入txt,每行都是一个样本,格式是subDirectory_filePath expression
with open(dst, "w") as f:
    f.write("\n".join(df["subDirectory_filePath"] + " " + df["expression"].astype(str)))

转换成功后:
在这里插入图片描述

转换validation.csv

转换validation.csv成转换validation.txt,每一行就是:“图片名 所属类别”

执行这个代码:

import pandas as pd

src = r"validation.csv"
dst = r"validation.txt"
df = pd.read_csv(src)
# 第一行是列名,需要取subDirectory_filePath列和expression列,然后写入txt,每行都是一个样本,格式是subDirectory_filePath expression
with open(dst, "w") as f:
    f.write("\n".join(df["subDirectory_filePath"] + " " + df["expression"].astype(str)))

转换成功后:

在这里插入图片描述

剔除无法使用的图片数据

有的图片无法正常读取,依靠下面的程序可以过滤validation.txt中不正常的行,同理可以过滤training.txt.

import cv2
import os
import multiprocessing


def process_image(line):
    root_path = r"/ssd/xiedong/src_data/Manually_Annotated_Images/"
    image_path, label = line.strip().split()
    image_path = os.path.join(root_path, image_path)

    try:
        img = cv2.imread(image_path)
    except:
        img = None

    if img is None:
        print(f"Deleting line: {line.strip()}")
        return None
    else:
        return line


def main():
    root_path = r"/ssd/xiedong/src_data/Manually_Annotated_Images/"
    training_file = "validation.txt"
    training_filex = "validation.txt"

    # 读取training.txt的每一行
    with open(training_file, 'r') as file:
        lines = file.read().splitlines()

    print(f"Total {len(lines)} lines to process")
    # lines = lines[:100]

    # 多进程处理图片
    with multiprocessing.Pool() as pool:
        results = pool.map(process_image, lines)

    # 保存处理后的内容回到training.txt
    lines_new = [line for line in results if line is not None]
    with open(training_filex, 'w') as f:
        f.write("\n".join(lines_new))

    print(f"Done. {len(lines_new)} lines saved to {training_filex}")


if __name__ == "__main__":
    main()

选择mmpretrain框架来训练

安装环境:

conda create -n open-mmlab python=3.8 pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3 -c pytorch -y
conda activate open-mmlab
pip3 install openmim
git clone https://github.com/open-mmlab/mmpretrain.git
cd mmpretrain
mim install -e .

配置四个文件

教程:https://mmpretrain.readthedocs.io/en/latest/user_guides/config.html

改写base model

文件相对路径是这里:
在这里插入图片描述

改为这样,表示11个类别:

# model settings
model = dict(
    type='ImageClassifier',
    backbone=dict(type='EfficientNet', arch='b0'),
    neck=dict(type='GlobalAveragePooling'),
    head=dict(
        type='LinearClsHead',
        num_classes=11,
        in_channels=1280,
        loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
        # topk=(1, 5),  不要测试这个指标
    ))

改写base datasets

下面这个路径下需要定义出数据集给入训练时候得pipeline:
在这里插入图片描述

新建文件:facebiaoqing_bs_224.py

# preprocessing configuration
data_preprocessor = dict(
    # Input image data channels in 'RGB' order
    mean=[127.5, 127.5, 127.5],
    std=[127.5, 127.5, 127.5],
    to_rgb=True,  # Whether to flip the channel from BGR to RGB or RGB to BGR
)

train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='Resize', scale=224),  # RandomResizedCrop RandomCrop CenterCrop
    dict(type='RandomFlip', prob=0.5, direction='horizontal'),
    dict(type='PackInputs'),  # prepare images and labels
]

test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='Resize', scale=224),  # RandomResizedCrop RandomCrop CenterCrop
    dict(type='PackInputs'),  # prepare images and labels
]

dataset_type = 'Biaoqing'
metainfo = dict(
    classes=[
        "Neutral",
        "Happy",
        "Sad",
        "Surprise",
        "Fear",
        "Disgust",
        "Anger",
        "Contempt",
        "Nonex",
        "Uncertain",
        "NonFace",
    ])
data = dict(
    samples_per_gpu=64,
    workers_per_gpu=8,
    train=dict(
        type=dataset_type,
        data_root='/ssd/xiedong/src_data/Manually_Annotated_Images',
        data_prefix="",
        ann_file="/ssd/xiedong/src_data/training.txt",
        metainfo=metainfo,
        pipeline=train_pipeline),
    val=dict(
        type=dataset_type,
        data_root='/ssd/xiedong/src_data/Manually_Annotated_Images',
        data_prefix="",
        ann_file="/ssd/xiedong/src_data/validation.txt",
        metainfo=metainfo,
        pipeline=test_pipeline),
    test=dict(
        type=dataset_type,
        data_root='/ssd/xiedong/src_data/Manually_Annotated_Images',
        data_prefix="",
        ann_file="/ssd/xiedong/src_data/validation.txt",
        metainfo=metainfo,
        pipeline=test_pipeline))

# evaluation = dict(interval=10, metric='accuracy')
# Construct training set dataloader
train_dataloader = dict(
    batch_size=64,  # batchsize per GPU
    num_workers=8,  # Number of workers to fetch data per GPU
    dataset=data['train'],  # Training dataset
    sampler=dict(type='DefaultSampler', shuffle=True),  # default sampler
    persistent_workers=True,  # Whether to keep the process, can shorten the preparation time of each epoch
)
test_dataloader = dict(
    batch_size=64,  # batchsize per GPU
    num_workers=8,  # Number of workers to fetch data per GPU
    dataset=data['val'],  # Testing dataset
    sampler=dict(type='DefaultSampler', shuffle=False),  # default sampler
    persistent_workers=True,  # Whether to keep the process, can shorten the preparation time of each epoch
)
val_dataloader = test_dataloader

val_evaluator = dict(type='Accuracy', topk=(1, 5))
test_evaluator = dict(type='Accuracy', topk=(1, 5))

新建数据处理方式data_biaoqing.py:

在这里插入图片描述

# Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Union

from mmengine import fileio
from mmengine.logging import MMLogger

from mmpretrain.registry import DATASETS
from .categories import IMAGENET_CATEGORIES
from .custom import CustomDataset


@DATASETS.register_module()
class Biaoqing(CustomDataset):
    """
    Args:
        data_root (str): The root directory for ``data_prefix`` and
            ``ann_file``. Defaults to ''.
        split (str): The dataset split, supports "train", "val" and "test".
            Default to ''.
        data_prefix (str | dict): Prefix for training data. Defaults to ''.
        ann_file (str): Annotation file path. Defaults to ''.
        metainfo (dict, optional): Meta information for dataset, such as class
            information. Defaults to None.
        **kwargs: Other keyword arguments in :class:`CustomDataset` and
            :class:`BaseDataset`.
    """  # noqa: E501

    IMG_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif')

    def __init__(self,
                 data_root: str = '',
                 split: str = '',
                 data_prefix: Union[str, dict] = '',
                 ann_file: str = '',
                 metainfo: Optional[dict] = None,
                 **kwargs):
        kwargs = {'extensions': self.IMG_EXTENSIONS, **kwargs}
        super().__init__(
            data_root=data_root,
            data_prefix=data_prefix,
            ann_file=ann_file,
            metainfo=metainfo,
            **kwargs)

    def extra_repr(self) -> List[str]:
        """The extra repr information of the dataset."""
        body = [
            f'Root of dataset: \t{self.data_root}',
        ]
        return body

__init__.py 中注册上类。

在这里插入图片描述

schedules

在这里插入图片描述

imagenet_bs2048_coslr.py

# optimizer
optim_wrapper = dict(
    optimizer=dict(
        type='SGD', lr=0.8, momentum=0.9, weight_decay=0.0001, nesterov=True))

# learning policy
param_scheduler = [
    # warm up learning rate scheduler
    dict(
        type='LinearLR',
        start_factor=0.25,
        by_epoch=True,
        begin=0,
        # about 2500 iterations for ImageNet-1k
        end=5,
        # update by iter
        convert_to_iter_based=True),
    # main learning rate scheduler
    dict(
        type='CosineAnnealingLR',
        T_max=95,
        by_epoch=True,
        begin=5,
        end=100,
    )
]

# train, val, test setting
train_cfg = dict(by_epoch=True, max_epochs=100, val_interval=1)
val_cfg = dict()
test_cfg = dict()

# NOTE: `auto_scale_lr` is for automatically scaling LR,
# based on the actual training batch size.
# auto_scale_lr = dict(base_batch_size=2048)

default_runtime

在这里插入图片描述

# defaults to use registries in mmpretrain
default_scope = 'mmpretrain'

# configure default hooks
default_hooks = dict(
    # record the time of every iteration.
    timer=dict(type='IterTimerHook'),

    # print log every 100 iterations.
    logger=dict(type='LoggerHook', interval=100),

    # enable the parameter scheduler.
    param_scheduler=dict(type='ParamSchedulerHook'),

    # save checkpoint per epoch.
    checkpoint=dict(type='CheckpointHook', interval=1),

    # set sampler seed in distributed evrionment.
    sampler_seed=dict(type='DistSamplerSeedHook'),

    # validation results visualization, set True to enable it.
    visualization=dict(type='VisualizationHook', enable=False),
)

# configure environment
env_cfg = dict(
    # whether to enable cudnn benchmark
    cudnn_benchmark=False,

    # set multi process parameters
    mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),

    # set distributed parameters
    dist_cfg=dict(backend='nccl'),
)

# set visualizer
vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(type='UniversalVisualizer', vis_backends=vis_backends)

# set log level
log_level = 'INFO'

# load from which checkpoint
load_from = None

# whether to resume training from the loaded checkpoint
resume = False

# Defaults to use random seed and disable `deterministic`
randomness = dict(seed=None, deterministic=False)

总配置

efficientnet-b0_8xb32-01norm_in1k

在这里插入图片描述

_base_ = [
    '../_base_/models/efficientnet_b0.py',
    '../_base_/datasets/facebiaoqing_bs_224.py',
    '../_base_/schedules/imagenet_bs2048_coslr.py',
    '../_base_/default_runtime.py',
]

开始训练

官方教程:https://mmpretrain.readthedocs.io/en/latest/user_guides/train.html

单卡训练:

python tools/train.py configs/efficientnet/efficientnet-b0_8xb32-01norm_in1k.py

多卡训练:

CUDA_VISIBLE_DEVICES=0,1 PORT=29500 ./tools/dist_train.sh configs/efficientnet/efficientnet-b0_8xb32-01norm_in1k.py 2

训练分析

准确率在12轮训练后还是有点低,损失没有很大的下降趋势,考虑到现在才是第12轮,再等一等看损失是否能降低。
同时,考虑为什么是这样的结果。把表情识别当成图片分类来处理是没问题的,但这个任务估计没有很大的指导性,训练难度太大。

在这里插入图片描述

考虑在网络上增加facial_landmarks回归head

做表情识别任务,识别图片中人脸是什么表情,当成一个分类任务来做是可以的。
但如果使用人脸的facial_landmarks来在分类头上增加一个回归头,可以起到辅助的作用。请问这是什么原因?

在做表情识别任务时,将其视为一个分类任务是非常常见的做法,因为表情识别的本质是将图像中的人脸表情分为几个预定义的类别,如快乐、悲伤、惊讶等。使用人脸的facial_landmarks来在分类头上增加一个回归头可以起到辅助的作用,原因有以下几点:

更丰富的特征信息:Facial landmarks提供了关于面部结构的详细信息,这些信息可以帮助网络更好地理解面部表情的微妙变化。例如,微笑可能会导致嘴角的特定上扬,眉毛的位置和形状变化可以表示惊讶等。

多任务学习:通过在模型中同时进行分类和回归任务,可以实现多任务学习。这种方法通常能够提高模型的泛化能力,因为模型不仅要学会识别整体的表情类别,还要能够准确地预测面部的关键点位置。这种学习任务的多样性可以增强模型对面部表情细节的捕捉能力。

正则化效应:在模型中加入额外的任务(如回归facial landmarks)可以起到一定的正则化作用,帮助避免过拟合,尤其是在数据量有限的情况下。

考虑是否可以两阶段

可以先回归出facial_landmarks,然后在facial_landmarks后面再增加分类头吗?

是否可以先回归出facial_landmarks,然后在facial_landmarks后面再增加分类头,这是一个可行的方法。这种方法通常被称为两阶段方法,首先利用一部分网络结构预测面部关键点,然后将预测出的关键点信息(可能经过一定的处理)作为额外的特征输入到后续的分类网络中。这种方法的好处是可以明确地利用facial_landmarks信息来辅助表情分类,但可能会增加模型的复杂性和计算量。

是否可以在特征后加一层512

不行,准确率还是低,要考虑别的方法。

2024-03-18 10:57:30.037685 Epoch [97/100], Validation Loss: 0.004361435066569935, Classification Loss: 0.0, Regression Loss: 0.0, Top-1 Acc: 0.45454545454545453, Recall: 0.4500706195750172, Class Accs: [0.4186991869918699, 0.7028571428571428, 0.5009310986964618, 0.48333333333333334, 0.5888223552894212, 0.5167037861915368, 0.4474708171206226, 0.5065913370998116, 0.07482993197278912, 0.20077220077220076, 0.509765625], Class Recalls: [0.31402439024390244, 0.5970873786407767, 0.4446280991735537, 0.41207815275310833, 0.5587121212121212, 0.4377358490566038, 0.45544554455445546, 0.4125766871165644, 0.2129032258064516, 0.3501683501683502, 0.6675191815856778]

多任务学习

这个就不使用mmpretrain了,自己写一个网络来做这个任务。

多头网络

调整EfficientNet模型以同时进行分类和回归:

# 调整EfficientNet模型以同时进行分类和回归
class MyEfficientNet(nn.Module):
    def __init__(self, num_classes=11, num_landmarks=68 * 2):
        super(MyEfficientNet, self).__init__()
        self.efficientnet = models.efficientnet_b0(pretrained=True)

        # 获取特征层的特征数量
        num_features = self.efficientnet.classifier[1].in_features

        # 新的分类器和回归器
        self.classifier = nn.Linear(num_features, num_classes)
        self.regressor = nn.Linear(num_features, num_landmarks)

        # 删除原始模型的分类层
        self.efficientnet.classifier = nn.Identity()

    def forward(self, x):
        # 通过修改后的EfficientNet获取特征
        features = self.efficientnet(x)

        # 使用新的分类器和回归器
        return self.classifier(features), self.regressor(features)

联合损失函数,带权重的多任务损失

class CombinedLoss(nn.Module):
    def __init__(self):
        super(CombinedLoss, self).__init__()
        self.classification_loss = nn.CrossEntropyLoss()
        self.regression_loss = nn.MSELoss()

    def forward(self, classification_output, regression_output, classification_targets, regression_targets):
        classification_loss = self.classification_loss(classification_output, classification_targets)

        # 计算回归损失时仅考虑有landmarks的样本
        valid_indices = regression_targets.ne(-1).any(dim=1)  # 假设没有标记的landmarks为-1
        regression_loss = self.regression_loss(regression_output[valid_indices],
                                               regression_targets[valid_indices]) if valid_indices.any() else 0

        # 带权重的多任务损失
        loss = 1.0 * classification_loss + 0.5 * regression_loss
        return loss, classification_loss, regression_loss

DDP 单机多卡训练

开启训练:

CUDA_VISIBLE_DEVICES=2,0 python -m torch.distributed.launch --node_rank=0 --master_addr="127.0.0.1" --master_port=29550 --nnodes=1 --nproc_per_node=2  train.py

余弦退火的学习率变动策略

在这里插入图片描述

指标评测

Validation loss: 0.0111
Validation classification loss: 0.0111
Validation regression loss: 0.0001
Validation mean regression loss: 0.0000
Validation top-1 accuracy: 0.3607
Validation recall: 0.3607
Validation class accuracies: [0.736, 0.918, 0.44, 0.33, 0.258, 0.046, 0.484, 0.0, 0.058, 0.038, 0.66]
Validation class recalls: [0.215962441314554, 0.34075723830734966, 0.45081967213114754, 0.45081967213114754, 0.6972972972972973, 0.8518518518518519, 0.3884430176565008, nan, 0.2396694214876033, 0.5588235294117647, 0.5454545454545454]
Validation total samples: 5500
Validation class accuracies mean: 0.3607272727272727
Validation class recalls mean: nan

由上面的指标可以看出,倒数第四个类别居然一个没预测正确。轻蔑这个表情只有4k多张,可能是类别不均衡导致的,需要采用一些策略。

过采样(重采样)

https://github.com/ufoym/imbalanced-dataset-sampler

在这里插入图片描述
在这里插入图片描述

再次训练:

    # 训练数据集
    annofile = r"/ssd/xiedong/src_data/training.csv"
    train_dataset = AffectNetDataset(prefix, annofile)
    train_sampler = ImbalancedDatasetSampler(train_dataset)
    train_loader = DataLoader(dataset=train_dataset, batch_size=batch_size, sampler=train_sampler, num_workers=16)

训练结束后:

2024-03-17 16:59:40.335762 Epoch [50/50], Validation Loss: 0.0042626089182767005, Classification Loss: 0.004238856727426702, Regression Loss: 8.637177180652777e-09, Top-1 Acc
0.4632727272727273, Recall: 0.4648315447804144, Class Accs: [0.44421487603305787, 0.7257731958762886, 0.49056603773584906, 0.505091649694501, 0.5852156057494866, 0.47556390
97744361, 0.5076335877862596, 0.5797665369649806, 0.0688976377952756, 0.15841584158415842, 0.5720081135902637], Class Recalls: [0.32526475037821484, 0.5808580858085809, 0.463
3663366336634, 0.42980935875216636, 0.6063829787234043, 0.46083788706739526, 0.4463087248322148, 0.436950146627566, 0.20348837209302326, 0.28368794326241137, 0.705]

八个类别的平均准确率是 0.5392281749518575

官网的weighted-loss模型的指标是58,

在这里插入图片描述
而多任务的b2网络是63。

在这里插入图片描述

所以现在我们的多任务b0得到53%,还是不错的。

网址:https://paperswithcode.com/sota/facial-expression-recognition-on-affectnet

这里有b2网路做的表情识别:

https://github.com/av-savchenko/face-emotion-recognition

如何改进53的准确率

其实53这个数值已经是够用了,AffectNet 数据集本身就难,实际使用表情稍微做大一点,都能准确识别,但为了进一步,就再思考改进方式:

1、肯定还是选b0,这个网络足够小,才能没显卡也能尽量快
2、损失函数权重,将回归部分的权重设置为更小的0.2,学习率设置得低一些,在之前的数据基础上训练
3、增加一些别的数据集进去,加更多的数据

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

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

相关文章

论文解析:V3D: Video Diffusion Models are Effective 3DGenerators

摘要: 自动三维生成最近引起了广泛关注。最近的方法大大加快了生成速度,但由于模型容量有限或三维数据,生成的物体通常不够精细。在视频扩散模型最新进展的推动下,我们引入了 V3D,利用预训练视频扩散模型的世界模拟能…

【已解决】MySQL:常用的除法运算+精度处理+除数为0处理

目录 问题现象: 问题分析: 拓展: 1、除法运算: 拓展:MySQL中常用的几种除法运算 1、取整除法 2、浮点数除法 3、取余除法 4、向上取整除法 5、向下取整除法 2、运算结果的精度处理 1.1、浮点数 1.2、总位数 1.3、…

蓝桥杯练习题——健身大调查

在浏览器中预览 index.html 页面效果如下: 目标 完成 js/index.js 中的 formSubmit 函数,用户填写表单信息后,点击蓝色提交按钮,表单项隐藏,页面显示用户提交的表单信息(在 id 为 result 的元素显示&#…

2024年敏捷产品负责人CSPO认证培训

课程名称:Scrum Product Owner CSPO产品负责人认证 课程类型:经理级 课程简介: Scrum Product Owner产品负责人在Scrum产品开发当中扮演“舵手”的角色,他决定产品的愿景、路线图以及投资回报,他需要回答为什么做&am…

【ZooKeeper】2、安装

本文基于 Apache ZooKeeper Release 3.7.0 版本书写 作于 2022年3月6日 14:22:11 转载请声明 下载zookeeper安装包 wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz解压 tar -zxvf apache-zookeeper-3.7.0-b…

OpenCV Steger算法提取条纹中心线

文章目录 一、简介二、实现代码三、实现效果参考资料一、简介 Steger 算法是一种常用的图像边缘检测算法,可以用于提取图像中的中心线或边缘信息。它的理论假设是:条纹的亮度是按照高斯分布呈现的,即中心亮两侧渐暗。 其计算过程如下所述: 1、首先,我们需要计算每个点Hess…

汽车制造业供应商管理会面临哪些问题?要如何解决?

汽车行业的供应链是及其复杂的,并且呈全球化分布,企业在知识产权方面的优势很可能是阶段性的。企业需要持续保持领先,将面临巨大的挑战,尽快地将产品推向市场是保持领先的唯一途径。然而,如果没有正确的方式去实现安全…

Flutter 运行 flutter doctor 命令长时间未响应

由于 Flutter 运行 flutter doctor 命令,会从 pub(https://pub.dev/ 类似于 Node.js 的 npm) 上进行资源的下载,如果没有配置国内镜像,可能会由于其服务器在国外导致资源下载慢或者下载不下来,所以出现了运行 flutter doctor 命令…

中国银行信息系统应用架构发展历程

概述: 从 20 世纪 80 年代开始至今,我国银行业信息化历程已 有四十年历史。虽然相对于发达国家来讲,我国银行业务信 息化起步较晚,但发展速度很快, 目前我国一些大型商业银行的信息化程度已经处于全球领先水平。 “银行…

【IC设计】Verilog线性序列机点灯案例(四)(小梅哥课程)

文章目录 该系列目录:设计环境设计目标设计思路RTL及Testbench代码RTL代码Testbenchxdc约束 仿真结果 声明:案例和代码来自小梅哥课程,本人仅对知识点做做笔记,如有学习需要请支持官方正版。 该系列目录: Verilog线性…

使用Composer安装Laravel框架

使用Composer安装Laravel框架,不指定版本则安装当下最新版本 composer create-project laravel/laravel laravel-demo 至此,安装框架完成,这里安装的是Laravel11.0.7版本的 进入项目根目录,运行项目 cd laravel.11.0.7 // 进…

maven一点通

1.maven简介 Maven是一个基于Java的工程构建工具,用于管理和构建项目的依赖关系。它提供了一种标准的项目结构和一组约定,使得项目的开发、构建、部署和文档化更加容易和可靠。 Maven的主要功能包括: 依赖管理:Maven可以自动下载…

最细致最简单的 Arm 架构搭建 Harbor

更好的阅读体验:点这里 ( www.doubibiji.com ) ARM离线版本安装 官方提供了一个 arm 版本,但是好久都没更新了,地址:https://github.com/goharbor/harbor-arm 。 也不知道为什么不更新,我看…

Cookie 信息泄露 Cookie未设置http only属性 原理以及修复方法

漏洞名称:Cookie信息泄露、Cookie安全性漏洞、Cookie未设置httponly属性 漏洞描述: cookie的属性设置不当可能会造成系统用户安全隐患,Cookie信息泄露是Cookiehttp only配置缺陷引起的,在设置Cookie时,可以设置的一个…

利用textarea和white-space实现最简单的文章编辑器 支持缩进和换行

当你遇到一个非常基础的文章发布和展示的需求,只需要保留换行和空格缩进,你是否会犹豫要使用富文本编辑器?实际上这个用原生的标签两步就能搞定! 1.直接用textarea当编辑器 textarea本身就可以保存空格和换行符,示例如…

Spring mvc的响应

1、static是静态页面的存放 templates是动态模板,不需要可以直接删掉 2、我们要是想访问static下的页面我们只需要他的文件名字就可以访问(如果有多层可以在url中加入相关路径) 3、get可以缓存(是幂等的) post 不能被缓存 4、返回Json响应 …

【数据挖掘】练习2:数据管理2

课后作业2&#xff1a;数据管理2 一&#xff1a;上机实验2 # 编写函数stat&#xff0c;要求该函数同时计算均值&#xff0c;最大值&#xff0c;最小值&#xff0c;标准差&#xff0c;峰度和偏度。 install.packages("timeDate") library(timeDate) stat <- func…

面试经典150题【81-90】

文章目录 面试经典150题【81-90】530.二叉搜索树的最小绝对差值230.二叉搜索树中第k小的元素98.验证二叉搜索树92.反转链表II25.K个一组翻转链表146.LRU缓存909. 蛇梯棋&#xff08;未做&#xff09;433.最小基因变化127.单词接龙&#xff08;未做&#xff09;17.电话号码的字母…

HTTP 工作流程请求响应 - 面试常问

文章目录 HTTP 工作流程请求和响应格式HTTP请求格式请求行&#xff1a;请求头部字段&#xff1a;空行&#xff1a;消息正文&#xff08;请求正文&#xff09;&#xff1a; HTTP响应格式状态行&#xff1a;响应头部字段&#xff1a;空行&#xff1a; HTTP方法HTTP状态码常用HTTP…

论文笔记:液体管道泄漏综合检测与定位模型

0 简介 An integrated detection and location model for leakages in liquid pipelines 1 摘要 许多液体&#xff0c;如水和油&#xff0c;都是通过管道运输的&#xff0c;在管道中可能发生泄漏&#xff0c;造成能源浪费、环境污染和对人类健康的威胁。本文描述了一种集成的…