当前位置: 首页 > news >正文

Bert-vits2-v2.2新版本本地训练推理整合包(原神八重神子英文模型miko)

在这里插入图片描述

近日,Bert-vits2-v2.2如约更新,该新版本v2.2主要把Emotion 模型换用CLAP多模态模型,推理支持输入text prompt提示词和audio prompt提示语音来进行引导风格化合成,让推理音色更具情感特色,并且推出了新的预处理webuI,操作上更加亲民和接地气。

更多情报请参见Bert-vits2官网:

https://github.com/fishaudio/Bert-VITS2/releases/tag/v2.2

与此同时,基于FastApi的推理web界面项目也同步适配了Bert-vits2-v2.2版本,官网如下:

https://github.com/jiangyuxiaoxiao/Bert-VITS2-UI

本次我们基于此两个项目来克隆原神角色八重神子的英文语音模型miko。

Bert-vits2-v2.2新的底模和情感模型

首先克隆Bert-vits2-v2.2官方项目:

git clone https://github.com/fishaudio/Bert-VITS2/tree/v2.2

安装依赖:

pip3 install -r requirements.txt

这里注意是v2.2的tag分支,因为官方随时都在更新,主分支可能会存在bug。

进入项目的目录:

cd /Bert-VITS2

随后下载新的底模和情感模型,下载地址:

https://openi.pcl.ac.cn/Stardust_minus/Bert-VITS2/modelmanage/show_model

将新的情感模型clap-hatsat-fused放入到项目的emotional目录,结构如下:

E:\work\Bert-VITS2-v22\emotional>tree /f  
Folder PATH listing for volume myssd  
Volume serial number is 7CE3-15AE  
E:.  
├───clap-htsat-fused  
│       .gitattributes  
│       config.json  
│       merges.txt  
│       preprocessor_config.json  
│       pytorch_model.bin  
│       README.md  
│       special_tokens_map.json  
│       tokenizer.json  
│       tokenizer_config.json  
│       vocab.json  
│  
└───wav2vec2-large-robust-12-ft-emotion-msp-dim  .gitattributes  config.json  LICENSE  preprocessor_config.json  pytorch_model.bin  README.md  vocab.json

注意,wav2vec2-large-robust-12-ft-emotion-msp-dim是Bert-vits2-v2.1的情感模型,也需要保留,具体请移步:义无反顾马督工,Bert-vits2V210复刻马督工实践(Python3.10), 这里不再赘述。

至此,新模型就配置好了。

Bert-vits2-v2.2模型训练

首先下载训练集,以原神角色八重神子的英文配音为例子,数据集下载地址:

https://github.com/AI-Hobbyist/Genshin_Datasets

随后新建miko角色目录

mkdir miko

将语音标注文件以esd.list命名,放入miko目录。

同时将分片语音素材放入raw目录。

最后新建miko/configs/config.json配置文件:

{  "train": {  "log_interval": 50,  "eval_interval": 50,  "seed": 42,  "epochs": 1000,  "learning_rate": 0.0002,  "betas": [  0.8,  0.99  ],  "eps": 1e-09,  "batch_size": 6,  "fp16_run": false,  "lr_decay": 0.99995,  "segment_size": 16384,  "init_lr_ratio": 1,  "warmup_epochs": 0,  "c_mel": 45,  "c_kl": 1.0,  "skip_optimizer": false,  "freeze_ZH_bert": false,  "freeze_JP_bert": false,  "freeze_EN_bert": false  },  "data": {  "training_files": "data/miko/train.list",  "validation_files": "data/miko/val.list",  "max_wav_value": 32768.0,  "sampling_rate": 44100,  "filter_length": 2048,  "hop_length": 512,  "win_length": 2048,  "n_mel_channels": 128,  "mel_fmin": 0.0,  "mel_fmax": null,  "add_blank": true,  "n_speakers": 1,  "cleaned_text": true,  "spk2id": {  "miko": 0  }  },  "model": {  "use_spk_conditioned_encoder": true,  "use_noise_scaled_mas": true,  "use_mel_posterior_encoder": false,  "use_duration_discriminator": true,  "inter_channels": 192,  "hidden_channels": 192,  "filter_channels": 768,  "n_heads": 2,  "n_layers": 6,  "kernel_size": 3,  "p_dropout": 0.1,  "resblock": "1",  "resblock_kernel_sizes": [  3,  7,  11  ],  "resblock_dilation_sizes": [  [  1,  3,  5  ],  [  1,  3,  5  ],  [  1,  3,  5  ]  ],  "upsample_rates": [  8,  8,  2,  2,  2  ],  "upsample_initial_channel": 512,  "upsample_kernel_sizes": [  16,  16,  8,  2,  2  ],  "n_layers_q": 3,  "use_spectral_norm": false,  "gin_channels": 256  },  "version": "2.2"  
}

这里注意"version": “2.2”,即版本号为最新的v2.2。

其他参数根据当前的设备环境酌情调整即可。

随后启动预处理页面:

python3 webui_preprocess.py

访问http://127.0.0.1:7860/:

按照页面的步骤进行操作即可,简单且方便。

操作完之后,运行训练命令:

python3 train_ms.py

训练好的模型放在data/miko/models目录,结构如下:

E:\work\Bert-VITS2-v22\Data\miko\models>tree /f  
Folder PATH listing for volume myssd  
Volume serial number is 7CE3-15AE  
E:.  
│   DUR_0.pth  
│   DUR_100.pth  
│   DUR_150.pth  
│   DUR_50.pth  
│   D_0.pth  
│   D_100.pth  
│   D_150.pth  
│   D_50.pth  
│   events.out.tfevents.1702457087.ly.13044.0  
│   events.out.tfevents.1702458207.ly.12416.0  
│   githash  
│   G_0.pth  
│   G_100.pth  
│   G_150.pth  
│   G_50.pth  
│   train.log  
│  
└───eval  events.out.tfevents.1702457087.ly.13044.1  events.out.tfevents.1702458207.ly.12416.1

至此,训练环节结束。

Bert-vits2-v2.2模型推理

推理我们使用Bert-vits2-UI项目的页面,克隆web项目:

git clone https://github.com/jiangyuxiaoxiao/Bert-VITS2-UI

将Web项目放入Bert-vits2-v2.2的根目录中,目录结构如下:

E:\work\Bert-VITS2-v22_lilith\Web>tree /f  
Folder PATH listing for volume myssd  
Volume serial number is 7CE3-15AE  
E:.  
│   index.html  
│  
├───assets  
│       index-21bc6a28.css  
│       index-402c0217.js  
│  
└───img  helps1.png  helps2.png  Hiyori.ico

这里包含主页面、样式文件以及JS文件,基于Hiyori。

随后启动推理页面:

python3 server_fastapi.py

访问:http://127.0.0.1:5000/:

加载模型进行推理即可。

此外,还可以基于FastAPI的接口进行推理,换句话说,发送http请求即可获取推理音频,接口参数如下:

{  "openapi": "3.1.0",  "info": {  "title": "FastAPI",  "version": "0.1.0"  },  "paths": {  "/": {  "get": {  "summary": "Index",  "operationId": "index__get",  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  }  }  }  },  "/voice": {  "post": {  "summary": "Voice",  "description": "语音接口,若需要上传参考音频请仅使用post请求",  "operationId": "voice_voice_post",  "parameters": [  {  "name": "model_id",  "in": "query",  "required": true,  "schema": {  "type": "integer",  "description": "模型ID",  "title": "Model Id"  },  "description": "模型ID"  },  {  "name": "speaker_name",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "说话人名",  "title": "Speaker Name"  },  "description": "说话人名"  },  {  "name": "speaker_id",  "in": "query",  "required": false,  "schema": {  "type": "integer",  "description": "说话人id,与speaker_name二选一",  "title": "Speaker Id"  },  "description": "说话人id,与speaker_name二选一"  },  {  "name": "sdp_ratio",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "SDP/DP混合比",  "default": 0.2,  "title": "Sdp Ratio"  },  "description": "SDP/DP混合比"  },  {  "name": "noise",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "感情",  "default": 0.2,  "title": "Noise"  },  "description": "感情"  },  {  "name": "noisew",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "音素长度",  "default": 0.9,  "title": "Noisew"  },  "description": "音素长度"  },  {  "name": "length",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "语速",  "default": 1,  "title": "Length"  },  "description": "语速"  },  {  "name": "language",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "语言",  "title": "Language"  },  "description": "语言"  },  {  "name": "auto_translate",  "in": "query",  "required": false,  "schema": {  "type": "boolean",  "description": "自动翻译",  "default": false,  "title": "Auto Translate"  },  "description": "自动翻译"  },  {  "name": "auto_split",  "in": "query",  "required": false,  "schema": {  "type": "boolean",  "description": "自动切分",  "default": false,  "title": "Auto Split"  },  "description": "自动切分"  },  {  "name": "emotion",  "in": "query",  "required": false,  "schema": {  "anyOf": [  {  "type": "integer"  },  {  "type": "string"  },  {  "type": "null"  }  ],  "description": "emo",  "title": "Emotion"  },  "description": "emo"  }  ],  "requestBody": {  "required": true,  "content": {  "multipart/form-data": {  "schema": {  "$ref": "#/components/schemas/Body_voice_voice_post"  }  }  }  },  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  },  "get": {  "summary": "Voice",  "description": "语音接口",  "operationId": "voice_voice_get",  "parameters": [  {  "name": "text",  "in": "query",  "required": true,  "schema": {  "type": "string",  "description": "输入文字",  "title": "Text"  },  "description": "输入文字"  },  {  "name": "model_id",  "in": "query",  "required": true,  "schema": {  "type": "integer",  "description": "模型ID",  "title": "Model Id"  },  "description": "模型ID"  },  {  "name": "speaker_name",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "说话人名",  "title": "Speaker Name"  },  "description": "说话人名"  },  {  "name": "speaker_id",  "in": "query",  "required": false,  "schema": {  "type": "integer",  "description": "说话人id,与speaker_name二选一",  "title": "Speaker Id"  },  "description": "说话人id,与speaker_name二选一"  },  {  "name": "sdp_ratio",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "SDP/DP混合比",  "default": 0.2,  "title": "Sdp Ratio"  },  "description": "SDP/DP混合比"  },  {  "name": "noise",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "感情",  "default": 0.2,  "title": "Noise"  },  "description": "感情"  },  {  "name": "noisew",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "音素长度",  "default": 0.9,  "title": "Noisew"  },  "description": "音素长度"  },  {  "name": "length",  "in": "query",  "required": false,  "schema": {  "type": "number",  "description": "语速",  "default": 1,  "title": "Length"  },  "description": "语速"  },  {  "name": "language",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "语言",  "title": "Language"  },  "description": "语言"  },  {  "name": "auto_translate",  "in": "query",  "required": false,  "schema": {  "type": "boolean",  "description": "自动翻译",  "default": false,  "title": "Auto Translate"  },  "description": "自动翻译"  },  {  "name": "auto_split",  "in": "query",  "required": false,  "schema": {  "type": "boolean",  "description": "自动切分",  "default": false,  "title": "Auto Split"  },  "description": "自动切分"  },  {  "name": "emotion",  "in": "query",  "required": false,  "schema": {  "anyOf": [  {  "type": "integer"  },  {  "type": "string"  },  {  "type": "null"  }  ],  "description": "emo",  "title": "Emotion"  },  "description": "emo"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/models/info": {  "get": {  "summary": "Get Loaded Models Info",  "description": "获取已加载模型信息",  "operationId": "get_loaded_models_info_models_info_get",  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  }  }  }  },  "/models/delete": {  "get": {  "summary": "Delete Model",  "description": "删除指定模型",  "operationId": "delete_model_models_delete_get",  "parameters": [  {  "name": "model_id",  "in": "query",  "required": true,  "schema": {  "type": "integer",  "description": "删除模型id",  "title": "Model Id"  },  "description": "删除模型id"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/models/add": {  "get": {  "summary": "Add Model",  "description": "添加指定模型:允许重复添加相同路径模型,且不重复占用内存",  "operationId": "add_model_models_add_get",  "parameters": [  {  "name": "model_path",  "in": "query",  "required": true,  "schema": {  "type": "string",  "description": "添加模型路径",  "title": "Model Path"  },  "description": "添加模型路径"  },  {  "name": "config_path",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "添加模型配置文件路径,不填则使用./config.json或../config.json",  "title": "Config Path"  },  "description": "添加模型配置文件路径,不填则使用./config.json或../config.json"  },  {  "name": "device",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "推理使用设备",  "default": "cuda",  "title": "Device"  },  "description": "推理使用设备"  },  {  "name": "language",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "模型默认语言",  "default": "ZH",  "title": "Language"  },  "description": "模型默认语言"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/models/get_unloaded": {  "get": {  "summary": "Get Unloaded Models Info",  "description": "获取未加载模型",  "operationId": "get_unloaded_models_info_models_get_unloaded_get",  "parameters": [  {  "name": "root_dir",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "搜索根目录",  "default": "Data",  "title": "Root Dir"  },  "description": "搜索根目录"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/models/get_local": {  "get": {  "summary": "Get Local Models Info",  "description": "获取全部本地模型",  "operationId": "get_local_models_info_models_get_local_get",  "parameters": [  {  "name": "root_dir",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "搜索根目录",  "default": "Data",  "title": "Root Dir"  },  "description": "搜索根目录"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/status": {  "get": {  "summary": "Get Status",  "description": "获取电脑运行状态",  "operationId": "get_status_status_get",  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  }  }  }  },  "/tools/translate": {  "get": {  "summary": "Translate",  "description": "翻译",  "operationId": "translate_tools_translate_get",  "parameters": [  {  "name": "texts",  "in": "query",  "required": true,  "schema": {  "type": "string",  "description": "待翻译文本",  "title": "Texts"  },  "description": "待翻译文本"  },  {  "name": "to_language",  "in": "query",  "required": true,  "schema": {  "type": "string",  "description": "翻译目标语言",  "title": "To Language"  },  "description": "翻译目标语言"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/tools/random_example": {  "get": {  "summary": "Random Example",  "description": "获取一个随机音频+文本,用于对比,音频会从本地目录随机选择。",  "operationId": "random_example_tools_random_example_get",  "parameters": [  {  "name": "language",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "指定语言,未指定则随机返回",  "title": "Language"  },  "description": "指定语言,未指定则随机返回"  },  {  "name": "root_dir",  "in": "query",  "required": false,  "schema": {  "type": "string",  "description": "搜索根目录",  "default": "Data",  "title": "Root Dir"  },  "description": "搜索根目录"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  },  "/tools/get_audio": {  "get": {  "summary": "Get Audio",  "operationId": "get_audio_tools_get_audio_get",  "parameters": [  {  "name": "path",  "in": "query",  "required": true,  "schema": {  "type": "string",  "description": "本地音频路径",  "title": "Path"  },  "description": "本地音频路径"  }  ],  "responses": {  "200": {  "description": "Successful Response",  "content": {  "application/json": {  "schema": {}  }  }  },  "422": {  "description": "Validation Error",  "content": {  "application/json": {  "schema": {  "$ref": "#/components/schemas/HTTPValidationError"  }  }  }  }  }  }  }  },  "components": {  "schemas": {  "Body_voice_voice_post": {  "properties": {  "text": {  "type": "string",  "title": "Text"  },  "reference_audio": {  "type": "string",  "format": "binary",  "title": "Reference Audio"  }  },  "type": "object",  "required": [  "text"  ],  "title": "Body_voice_voice_post"  },  "HTTPValidationError": {  "properties": {  "detail": {  "items": {  "$ref": "#/components/schemas/ValidationError"  },  "type": "array",  "title": "Detail"  }  },  "type": "object",  "title": "HTTPValidationError"  },  "ValidationError": {  "properties": {  "loc": {  "items": {  "anyOf": [  {  "type": "string"  },  {  "type": "integer"  }  ]  },  "type": "array",  "title": "Location"  },  "msg": {  "type": "string",  "title": "Message"  },  "type": {  "type": "string",  "title": "Error Type"  }  },  "type": "object",  "required": [  "loc",  "msg",  "type"  ],  "title": "ValidationError"  }  }  }  
}

最后奉上Bert-vits2-v2.2本地训练推理整合包:

https://pan.baidu.com/s/1OVX9seRwZR6bZ-xsE_nRLg?pwd=v3uc

与众乡亲同飨。

相关文章:

Bert-vits2-v2.2新版本本地训练推理整合包(原神八重神子英文模型miko)

近日,Bert-vits2-v2.2如约更新,该新版本v2.2主要把Emotion 模型换用CLAP多模态模型,推理支持输入text prompt提示词和audio prompt提示语音来进行引导风格化合成,让推理音色更具情感特色,并且推出了新的预处理webuI&am…...

认识缓存,一文读懂Cookie,Session缓存机制。

🏆作者简介,普修罗双战士,一直追求不断学习和成长,在技术的道路上持续探索和实践。 🏆多年互联网行业从业经验,历任核心研发工程师,项目技术负责人。 🎉欢迎 👍点赞✍评论…...

关于react native项目中使用react-native-wechat-lib@3.0.4

关于react native项目中使用react-native-wechat-lib3.0.4 插件官网安装依赖包(Android和iOS下载插件完成后记得更新依赖,)Android中配置1.在项目文件夹下面创建文件夹wxapi(如上图)2.在文件MainApplication.java中如下…...

【LeetCode刷题笔记(8-1)】【Python】【接雨水】【动态规划】【困难】

文章目录 引言接雨水题目描述提示 解决方案1:【动态规划】结束语 接雨水 引言 编写通过所有测试案例的代码并不简单,通常需要深思熟虑和理性分析。虽然这些代码能够通过所有的测试案例,但如果不了解代码背后的思考过程,那么这些代…...

pycharm通过ssh连接远程服务器的docker容器进行运行和调试代码

pycharm连接远程服务器的docker容器通常有两种方法: 第一种:pycharm通过ssh连接已在运行中的docker容器 第二种:pycharm连接docker镜像,pycharm运行代码再自动创建容器 第一种方法比较通用简单,作者比较推崇。 条件…...

Chrome2023新版收藏栏UI改回旧版

版本 120.0.6099.109(正式版本)Chrome浏览器菜单新版、旧版的差异 想要将书签、功能内容改回旧版的朋友可以网址栏输入:「chrome://flags」,接着搜寻「Chrome Refresh 2023」。 最后将 Chrome Refresh 2023、Chrome Refresh 2023…...

WebSocket与JavaScript:实现实时获取位置

一、WebSocket介绍 WebSocket是一种在单个TCP连接上进行全双工通信的协议。与传统的HTTP请求相比,WebSocket能够在服务器和客户端之间建立持久连接,实现实时数据传输。WebSocket提供了较低的延迟和高效的数据传输。在实时舆情监测中,它能够实…...

一种解决Qt5发布release文件引发的无法定位程序输入点错误的方法

目录 本地环境问题描述分析解决方案 本地环境 本文将不会解释如何利用Qt5编译生成release类型的可执行文件以及如何利用windeployqt生成可执行的依赖库,请自行百度。 环境值操作系统Windows 10 专业版(22H2)Qt版本Qt 5.15.2Qt Creator版本5.0…...

UE4/UE5 日志插件(基于spdlog)

1 解决问题 对于高频日志序列化到本地的需求,spdlog肯定完美满足。 源码地址:https://github.com/gabime/spdlog 博主下载的版本为 spdlog-1.12.0,各位大佬可以根绝自己爱好选择。 2 过程介绍 大概目录: SpdlogLibC目录下是对…...

微信小程序ios中非cover组件点击重复触发地图tap事件

现象&#xff1a; map中使用view组件的click事件会重复触发地图的tap组件&#xff0c;只在ios上出现 <map id"maps" style"width: 100vw;height: 100vh;" :latitude"latitude" :longitude"longitude":markers"markers"…...

7.26 SpringBoot项目实战【还书】

文章目录 前言一、编写控制器二、编写服务层三、Git提交前言 本文是项目实战 业务接口 的最后一篇,上文 曾说过【还书】的 入口是【我的借阅记录】,因为【还书】是基于一次借阅记录而言,另外在4.2 数据库设计 曾分析过【还书】的业务场景,需要执行两步操作: 更新【借阅记…...

Golang中使用errors返回调用堆栈信息

Golang的errors包返回堆栈信息 标准库errors提供了处理错误的方法。比如常用的 func New(text string) error 用该方法处理错误信息&#xff0c;就只会输出自定义的 text 到控制台或者日志文件&#xff0c;没有其它辅助排查的信息输出&#xff0c;所以常规我们就只能根据 te…...

Web前端-HTML(常用标签)

文章目录 1. HTML常用标签1.1 排版标签1&#xff09;标题标签h (熟记)2&#xff09;段落标签p ( 熟记)3&#xff09;水平线标签hr(认识)4&#xff09;换行标签br (熟记)5&#xff09;div 和 span标签(重点)6&#xff09;排版标签总结 1.2 标签属性1.3 图像标签img (重点)1.4 链…...

一 OpenCV中的数据类型

1. cv::Mat 2. cv::Point 主要用来表示二维点&#xff0c;也有表示三维点的模板类型&#xff1b; cv::Point p(int, int) 最常用 ① cv::Point_<T> ② cv::Point2i cv::Point_<int> ③ cv::Point2f cv::Point_<float> ④ cv::Point2d …...

59. 螺旋矩阵 II(java实现,史上最详细教程,想学会的进!!!)

今天来分享一下螺旋矩阵的解题思路及代码的实现。 题目描述如下&#xff1a; 首先拿到这道题&#xff0c;首先不要慌张&#xff0c;我们来仔细分析一下会发现并没有那么难。 首先看下边界的元素是1、2、3递增的&#xff0c;那么我们也许可以根据这一点先把边界的元素一个一个给…...

vue 将后端返回的二进制流进行处理并实现下载

什么是二进制流文件&#xff1f; 二进制文件是一种计算机文件格式&#xff0c;它的数据以二进制形式存储&#xff0c;与文本文件不同。二进制文件可以包含任意类型的数据&#xff0c;例如图像、音频、视频、可执行文件、压缩文件等&#xff0c;而文本文件则仅仅包含 ASCII 码或…...

PyCharm连接远程服务器

要求&#xff1a;PyCharm专业版才支持远程服务 一、创建远程连接 先建立本地与远程服务器之间的SSH连接 1、配置连接 2、建立SSH连接&#xff0c;选择文件传输协议 SFTP 3、设置服务器名&#xff08;可以随意命名&#xff09; 4、配置 SSH连接 点击 172.18.1.202 配置…...

使用Qt制作网易云播放器的歌曲排行界面

&#xff01;&#xff01;&#xff01;直接上图&#xff01;&#xff01;&#xff01; &#xff01;&#xff01;&#xff01;直接上图&#xff01;&#xff01;&#xff01; &#xff01;&#xff01;&#xff01;直接上图&#xff01;&#xff01;&#xff01; 网易云排行榜…...

【.NET Core】特性(Attribute)详解

【.NET Core】特性&#xff08;Attribute&#xff09;详解 文章目录 【.NET Core】特性&#xff08;Attribute&#xff09;详解一、概述二、编写自定义属性2.1 自定义特性的主要步骤2.2 应用AttributeUsageAttributeAttributeTargets 成员Inherited属性AllowMultiple属性 三、声…...

【C++】POCO学习总结(十九):哈希、URL、UUID、配置文件、日志配置、动态库加载

【C】郭老二博文之&#xff1a;C目录 1、哈希 1.1 说明 std::map和std::set 的性能是&#xff1a;O(log n) POCO哈希的性能比STL容器更好&#xff0c;大约快两&#xff1b; POCO中对应std::map的是&#xff1a;Poco::HashMap&#xff1b; POCO中对应std::set的是 Poco::Hash…...

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…...

【机器视觉】单目测距——运动结构恢复

ps&#xff1a;图是随便找的&#xff0c;为了凑个封面 前言 在前面对光流法进行进一步改进&#xff0c;希望将2D光流推广至3D场景流时&#xff0c;发现2D转3D过程中存在尺度歧义问题&#xff0c;需要补全摄像头拍摄图像中缺失的深度信息&#xff0c;否则解空间不收敛&#xf…...

将对透视变换后的图像使用Otsu进行阈值化,来分离黑色和白色像素。这句话中的Otsu是什么意思?

Otsu 是一种自动阈值化方法&#xff0c;用于将图像分割为前景和背景。它通过最小化图像的类内方差或等价地最大化类间方差来选择最佳阈值。这种方法特别适用于图像的二值化处理&#xff0c;能够自动确定一个阈值&#xff0c;将图像中的像素分为黑色和白色两类。 Otsu 方法的原…...

C# SqlSugar:依赖注入与仓储模式实践

C# SqlSugar&#xff1a;依赖注入与仓储模式实践 在 C# 的应用开发中&#xff0c;数据库操作是必不可少的环节。为了让数据访问层更加简洁、高效且易于维护&#xff0c;许多开发者会选择成熟的 ORM&#xff08;对象关系映射&#xff09;框架&#xff0c;SqlSugar 就是其中备受…...

让AI看见世界:MCP协议与服务器的工作原理

让AI看见世界&#xff1a;MCP协议与服务器的工作原理 MCP&#xff08;Model Context Protocol&#xff09;是一种创新的通信协议&#xff0c;旨在让大型语言模型能够安全、高效地与外部资源进行交互。在AI技术快速发展的今天&#xff0c;MCP正成为连接AI与现实世界的重要桥梁。…...

【Go语言基础【12】】指针:声明、取地址、解引用

文章目录 零、概述&#xff1a;指针 vs. 引用&#xff08;类比其他语言&#xff09;一、指针基础概念二、指针声明与初始化三、指针操作符1. &&#xff1a;取地址&#xff08;拿到内存地址&#xff09;2. *&#xff1a;解引用&#xff08;拿到值&#xff09; 四、空指针&am…...

Go 并发编程基础:通道(Channel)的使用

在 Go 中&#xff0c;Channel 是 Goroutine 之间通信的核心机制。它提供了一个线程安全的通信方式&#xff0c;用于在多个 Goroutine 之间传递数据&#xff0c;从而实现高效的并发编程。 本章将介绍 Channel 的基本概念、用法、缓冲、关闭机制以及 select 的使用。 一、Channel…...

【Redis】笔记|第8节|大厂高并发缓存架构实战与优化

缓存架构 代码结构 代码详情 功能点&#xff1a; 多级缓存&#xff0c;先查本地缓存&#xff0c;再查Redis&#xff0c;最后才查数据库热点数据重建逻辑使用分布式锁&#xff0c;二次查询更新缓存采用读写锁提升性能采用Redis的发布订阅机制通知所有实例更新本地缓存适用读多…...

uniapp 集成腾讯云 IM 富媒体消息(地理位置/文件)

UniApp 集成腾讯云 IM 富媒体消息全攻略&#xff08;地理位置/文件&#xff09; 一、功能实现原理 腾讯云 IM 通过 消息扩展机制 支持富媒体类型&#xff0c;核心实现方式&#xff1a; 标准消息类型&#xff1a;直接使用 SDK 内置类型&#xff08;文件、图片等&#xff09;自…...

【安全篇】金刚不坏之身:整合 Spring Security + JWT 实现无状态认证与授权

摘要 本文是《Spring Boot 实战派》系列的第四篇。我们将直面所有 Web 应用都无法回避的核心问题&#xff1a;安全。文章将详细阐述认证&#xff08;Authentication) 与授权&#xff08;Authorization的核心概念&#xff0c;对比传统 Session-Cookie 与现代 JWT&#xff08;JS…...