【“星瑞” O6 评测】—NPU 部署 face parser 模型
前言
瑞莎星睿 O6 (Radxa Orion O6) 拥有高达 28.8TOPs NPU (Neural Processing Unit) 算力,支持 INT4 / INT8 / INT16 / FP16 / BF16 和 TF32 类型的加速。这里通过通过官方的工具链进行FaceParsingBiSeNet的部署
1. FaceParsingBiSeNet onnx 推理
-
首先从百度网盘 提取码 8gin,下载开源的模型:face_parsing_512x512.onnx
-
编写 onnx 的推理脚本,如下
import os
import cv2
import argparse
import numpy as np
from PIL import Image
import onnxruntime
import timedef letterbox(image, new_shape=(640, 640), color=(114, 114, 114), auto=False, scaleFill=False, scaleup=True):"""对图像进行letterbox操作,保持宽高比缩放并填充到指定尺寸:param image: 输入的图像,格式为numpy数组 (height, width, channels):param new_shape: 目标尺寸,格式为 (height, width):param color: 填充颜色,默认为 (114, 114, 114):param auto: 是否自动计算最小矩形,默认为True:param scaleFill: 是否不保持宽高比直接缩放,默认为False:param scaleup: 是否只放大不缩小,默认为True:return: 处理后的图像,缩放比例,填充大小"""shape = image.shape[:2] # 当前图像的高度和宽度r = min(new_shape[0] / shape[0], new_shape[1] / shape[1])if not scaleup: # 只缩小不放大(为了更好的效果)r = min(r, 1.0)new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1] # 计算填充尺寸if auto: # 最小矩形dw, dh = np.mod(dw, 64), np.mod(dh, 64) # 强制为 64 的倍数dw /= 2 # 从两侧填充dh /= 2if shape[::-1] != new_unpad: # 缩放图像image = cv2.resize(image, new_unpad, interpolation=cv2.INTER_LINEAR)top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1))left, right = int(round(dw - 0.1)), int(round(dw + 0.1))image = cv2.copyMakeBorder(image, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color) # 添加填充scale_ratio = rpad_size = (dw, dh)return image, scale_ratio, pad_sizedef preprocess_image(image, shape, bgr2rgb=True):"""图片预处理"""img, scale_ratio, pad_size = letterbox(image, new_shape=shape)if bgr2rgb:img = img[:, :, ::-1]img = img.transpose(2, 0, 1) # HWC2CHWimg = np.ascontiguousarray(img, dtype=np.float32)return img, scale_ratio, pad_sizedef generate_mask(img, seg, outpath, scale=0.4):'分割结果可视化'color = [[255, 0, 0],[255, 85, 0],[255, 170, 0],[255, 0, 85],[255, 0, 170],[0, 255, 0],[85, 255, 0],[170, 255, 0],[0, 255, 85],[0, 255, 170],[0, 0, 255],[85, 0, 255],[170, 0, 255],[0, 85, 255],[0, 170, 255],[255, 255, 0],[255, 255, 85],[255, 255, 170],[255, 0, 255],[255, 85, 255]]img = img.transpose(1, 2, 0) # HWC2CHWminidx = int(seg.min())maxidx = int(seg.max())color_img = np.zeros_like(img)for i in range(minidx, maxidx):if i <= 0:continuecolor_img[seg == i] = color[i]showimg = scale * img + (1 - scale) * color_imgImage.fromarray(showimg.astype(np.uint8)).save(outpath)if __name__ == '__main__':# define cmd argumentsparser = argparse.ArgumentParser()parser.add_argument('--image-path', type=str, help='path of the input image (a file)')parser.add_argument('--output-path', type=str, help='paht for saving the predicted alpha matte (a file)')parser.add_argument('--model-path', type=str, help='path of the ONNX model')args = parser.parse_args()# check input argumentsif not os.path.exists(args.image_path):print('Cannot find the input image: {0}'.format(args.image_path))exit()if not os.path.exists(args.model_path):print('Cannot find the ONXX model: {0}'.format(args.model_path))exit()ref_size = [512, 512]# read imageim = cv2.imread(args.image_path)img, scale_ratio, pad_size = preprocess_image(im, ref_size)showimg = img.copy()[::-1, ...]mean = np.asarray([0.485, 0.456, 0.406])scale = np.asarray([0.229, 0.224, 0.225])mean = mean.reshape((3, 1, 1))scale = scale.reshape((3, 1, 1))img = (img / 255 - mean) * scaleim = img[None].astype(np.float32)np.save("models/ComputeVision/Semantic_Segmentation/onnx_faceparse/datasets/calibration_data.npy", im)# Initialize session and get predictionsession = onnxruntime.InferenceSession(args.model_path, None)input_name = session.get_inputs()[0].nameoutput_name = session.get_outputs()[0].nameoutput = session.run([output_name], {input_name: im})start_time = time.perf_counter()for _ in range(5):output = session.run([output_name], {input_name: im})end_time = time.perf_counter()use_time = (end_time - start_time) * 1000fps = 1000 / use_timeprint(f"推理耗时:{use_time:.2f} ms, fps:{fps:.2f}")# refine matteseg = np.argmax(output[0], axis=1).squeeze()generate_mask(showimg, seg, args.output_path)
- 推理
python models/ComputeVision/Semantic_Segmentation/onnx_faceparse/inference_onnx.py --image-path models/ComputeVision/Semantic_Segmentation/onnx_faceparse/test_data/test_lite_face_parsing.png --output-path output/face_parsering.jpg --model-path asserts/models/bisenet/face_parsing_512x512.onnx
打印输出
推理耗时:1544.36 ms, fps:0.65
可视化效果
- 代码解释
- np.save(“models/ComputeVision/Semantic_Segmentation/onnx_faceparse/datasets/calibration_data.npy”, im)
这里是将输入保存供 NPU PTQ 量化使用.
2. FaceParsingBiSeNet NPU 推理
- 创建 cfg 配置文件,具体如下。
[Common]
mode = build[Parser]
model_type = onnx
model_name = face_parsing_512x512
detection_postprocess =
model_domain = image_segmentation
input_model = /home/5_radxa/ai_model_hub/asserts/models/bisenet/face_parsing_512x512.onnx
input = input
input_shape = [1, 3, 512, 512]
output = out
output_dir = ./[Optimizer]
output_dir = ./
calibration_data = ./datasets/calibration_data.npy
calibration_batch_size = 1
metric_batch_size = 1
dataset = NumpyDataset
quantize_method_for_weight = per_channel_symmetric_restricted_range
quantize_method_for_activation = per_tensor_asymmetric
save_statistic_info = True[GBuilder]
outputs = bisenet.cix
target = X2_1204MP3
profile = True
tiling = fps
注意: [Parser]中的 input,output 是输入,输出 tensor 的名字,可以通过 netron 打开 onnx 模型看。输入,输出名字不匹配时,会有报错:
[I] Build with version 6.1.3119
[I] Parsing model....
[I] [Parser]: Begin to parse onnx model face_parsing_512x512...
2025-04-18 11:13:53.104146: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /root/miniconda3/envs/radxa/lib/python3.8/site-packages/cv2/../../lib64:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib/:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib
2025-04-18 11:13:53.104217: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2025-04-18 11:13:54.266791: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /root/miniconda3/envs/radxa/lib/python3.8/site-packages/cv2/../../lib64:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib/:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib
2025-04-18 11:13:54.266893: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2025-04-18 11:13:54.266959: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (chenjun): /proc/driver/nvidia/version does not exist
[E] [Parser]: Graph does not contain such a node/tensor name:output
[E] [Parser]: Parser Failed!
- 编译模型
在 x86 主机上编译模型
cd models/ComputeVision/Semantic_Segmentation/onnx_faceparse
cixbuild ./cfg/onnx_bisenet.cfg
报错: ImportError: libaipu_simulator_x2.so: cannot open shared object file: No such file or directory
解决方案
- 通过
find / -name libaipu_simulator_x2.so
- 通过
export LD_LIBRARY_PATH=/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib/libaipu_simulator_x2.so:$LD_LIBRARY_PATH
添加环境变量
编译成功的打印信息
[I] Build with version 6.1.3119
[I] Parsing model....
[I] [Parser]: Begin to parse onnx model face_parsing_512x512...
2025-04-18 11:20:16.726111: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /root/miniconda3/envs/radxa/lib/python3.8/site-packages/cv2/../../lib64:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib/:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib
2025-04-18 11:20:16.726199: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2025-04-18 11:20:17.908202: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /root/miniconda3/envs/radxa/lib/python3.8/site-packages/cv2/../../lib64:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib/:/root/miniconda3/envs/radxa/lib/python3.8/site-packages/AIPUBuilder/simulator-lib
2025-04-18 11:20:17.908267: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2025-04-18 11:20:17.908283: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (chenjun): /proc/driver/nvidia/version does not exist
[W] [Parser]: The output name out is not a node but a tensor. However, we will use the node Resize_161 as output node.
2025-04-18 11:20:21.229063: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
[I] [Parser]: The input tensor(s) is/are: input_0
[I] [Parser]: Input input from cfg is shown as tensor input_0 in IR!
[I] [Parser]: Output out from cfg is shown as tensor Resize_161_post_transpose_0 in IR!
[I] [Parser]: 0 error(s), 1 warning(s) generated.
[I] [Parser]: Parser done!
[I] Parse model complete
[I] Simplifying float model.
[I] [IRChecker] Start to check IR: /home/5_radxa/ai_model_hub/models/ComputeVision/Semantic_Segmentation/onnx_faceparse/internal/face_parsing_512x512.txt
[I] [IRChecker] model_name: face_parsing_512x512
[I] [IRChecker] IRChecker: All IR pass (Checker Plugin disabled)
[I] [graph.cpp :1600] loading graph weight: /home/5_radxa/ai_model_hub/models/ComputeVision/Semantic_Segmentation/onnx_faceparse/./internal/face_parsing_512x512.bin size: 0x322454c
[I] Start to simplify the graph...
[I] Using fixed-point full optimization, it may take long long time ....
[I] GSim simplified result:
------------------------------------------------------------------------OpType.Eltwise: -3OpType.Mul: +3OpType.Tile: -3
------------------------------------------------------------------------
略
略
略
略
略
[I] [builder.cpp:1939] Read and Write:80.21MB
[I] [builder.cpp:1080] Reduce constants memory size: 3.477MB
[I] [builder.cpp:2411] memory statistics for this graph (face_parsing_512x512)
[I] [builder.cpp: 585] Total memory : 0x00d52b98 Bytes ( 13.323MB)
[I] [builder.cpp: 585] Text section: 0x00042200 Bytes ( 0.258MB)
[I] [builder.cpp: 585] RO section: 0x00006d00 Bytes ( 0.027MB)
[I] [builder.cpp: 585] Desc section: 0x0002ea00 Bytes ( 0.182MB)
[I] [builder.cpp: 585] Data section: 0x00c8b360 Bytes ( 12.544MB)
[I] [builder.cpp: 585] BSS section: 0x0000fb38 Bytes ( 0.061MB)
[I] [builder.cpp: 585] Stack : 0x00040400 Bytes ( 0.251MB)
[I] [builder.cpp: 585] Workspace(BSS) : 0x004c0000 Bytes ( 4.750MB)
[I] [builder.cpp:2427]
[I] [tools.cpp :1181] - compile time: 20.726 s
[I] [tools.cpp :1087] With GM optimization, DDR Footprint stastic(estimation):
[I] [tools.cpp :1094] Read and Write:92.67MB
[I] [tools.cpp :1137] - draw graph time: 0.03 s
[I] [tools.cpp :1954] remove global cwd: /tmp/af3c1da8ea81cc1cf85dba1587ff72126ee96222bb098b52633050918b4c7
build success.......
Total errors: 0, warnings: 15
- NPU 推理可视化
编写 npu 推理脚本, 可视化推理结果,统计推理耗时
import numpy as np
import cv2
import argparse
import os
import sys
import time# Define the absolute path to the utils package by going up four directory levels from the current file location
_abs_path = "/home/radxa/1_AI_models/ai_model_hub"
# Append the utils package path to the system path, making it accessible for imports
sys.path.append(_abs_path)
from utils.tools import get_file_list
from utils.NOE_Engine import EngineInferimport os
import cv2
import argparse
import numpy as np
from PIL import Imagedef letterbox(image, new_shape=(640, 640), color=(114, 114, 114), auto=False, scaleFill=False, scaleup=True):"""对图像进行letterbox操作,保持宽高比缩放并填充到指定尺寸:param image: 输入的图像,格式为numpy数组 (height, width, channels):param new_shape: 目标尺寸,格式为 (height, width):param color: 填充颜色,默认为 (114, 114, 114):param auto: 是否自动计算最小矩形,默认为True:param scaleFill: 是否不保持宽高比直接缩放,默认为False:param scaleup: 是否只放大不缩小,默认为True:return: 处理后的图像,缩放比例,填充大小"""shape = image.shape[:2] # 当前图像的高度和宽度r = min(new_shape[0] / shape[0], new_shape[1] / shape[1])if not scaleup: # 只缩小不放大(为了更好的效果)r = min(r, 1.0)new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1] # 计算填充尺寸if auto: # 最小矩形dw, dh = np.mod(dw, 64), np.mod(dh, 64) # 强制为 64 的倍数dw /= 2 # 从两侧填充dh /= 2if shape[::-1] != new_unpad: # 缩放图像image = cv2.resize(image, new_unpad, interpolation=cv2.INTER_LINEAR)top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1))left, right = int(round(dw - 0.1)), int(round(dw + 0.1))image = cv2.copyMakeBorder(image, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color) # 添加填充scale_ratio = rpad_size = (dw, dh)return image, scale_ratio, pad_sizedef preprocess_image(image, shape, bgr2rgb=True):"""图片预处理"""img, scale_ratio, pad_size = letterbox(image, new_shape=shape)if bgr2rgb:img = img[:, :, ::-1]img = img.transpose(2, 0, 1) # HWC2CHWimg = np.ascontiguousarray(img, dtype=np.float32)return img, scale_ratio, pad_sizedef generate_mask(img, seg, outpath, scale=0.4):'分割结果可视化'color = [[255, 0, 0],[255, 85, 0],[255, 170, 0],[255, 0, 85],[255, 0, 170],[0, 255, 0],[85, 255, 0],[170, 255, 0],[0, 255, 85],[0, 255, 170],[0, 0, 255],[85, 0, 255],[170, 0, 255],[0, 85, 255],[0, 170, 255],[255, 255, 0],[255, 255, 85],[255, 255, 170],[255, 0, 255],[255, 85, 255]]img = img.transpose(1, 2, 0) # HWC2CHWminidx = int(seg.min())maxidx = int(seg.max())color_img = np.zeros_like(img)for i in range(minidx, maxidx):if i <= 0:continuecolor_img[seg == i] = color[i]showimg = scale * img + (1 - scale) * color_imgImage.fromarray(showimg.astype(np.uint8)).save(outpath)if __name__ == '__main__':parser = argparse.ArgumentParser()parser.add_argument('--image-path', type=str, help='path of the input image (a file)')parser.add_argument('--output-path', type=str, help='paht for saving the predicted alpha matte (a file)')parser.add_argument('--model-path', type=str, help='path of the ONNX model')args = parser.parse_args()model = EngineInfer(args.model_path)ref_size = [512, 512]# read imageim = cv2.imread(args.image_path)img, scale_ratio, pad_size = preprocess_image(im, ref_size)showimg = img.copy()[::-1, ...]mean = np.asarray([0.485, 0.456, 0.406])scale = np.asarray([0.229, 0.224, 0.225])mean = mean.reshape((3, 1, 1))scale = scale.reshape((3, 1, 1))img = (img / 255 - mean) * scaleim = img[None].astype(np.float32)## inferinput_data = [im]# output = model.forward(input_data)[0]N = 5start_time = time.perf_counter()for _ in range(N):output = model.forward(input_data)[0]end_time = time.perf_counter()use_time = (end_time - start_time) * 1000 / Nfps = N / (end_time - start_time)print(f"包含输入量化,输出反量化,推理耗时:{use_time:.2f} ms, fps:{fps:.2f}")fps = model.get_ave_fps()use_time2 = 1000 / fpsprint(f"NPU 计算部分耗时:{use_time2:.2f} ms, fps: {fps:.2f}")# refine matteoutput = np.reshape(output, (1, 19, 512, 512))seg = np.argmax(output, axis=1).squeeze()generate_mask(showimg, seg, args.output_path)# release modelmodel.clean()
推理
source /home/radxa/1_AI_models/ai_model_hub/.venv/bin/activate
python models/ComputeVision/Semantic_Segmentation/onnx_faceparse/inference_npu.py --image-path models/ComputeVision/Semantic_Segmentation/onnx_faceparse/test_data/test_lite_face_parsing.png --output-path output/face_parsering.jpg --model-path models/ComputeVision/Semantic_Segmentation/onnx_faceparse/bisenet.cix
推理耗时
npu: noe_init_context success
npu: noe_load_graph success
Input tensor count is 1.
Output tensor count is 1.
npu: noe_create_job success
包含输入量化,输出反量化,推理耗时:379.63 ms, fps:2.63
NPU 计算部分耗时:10.70 ms, fps: 93.43
npu: noe_clean_job success
npu: noe_unload_graph success
npu: noe_deinit_context success
可以看到这里输入量化,输出反量化还是很耗时
可视化效果ok.
3. benchmark
序号 | 硬件 | 模型 | 输入分辨率 | 量化类型 | 执行 engine | 推理耗时/ms | fps |
---|---|---|---|---|---|---|---|
cpu | bisenet | 512x512 | fp32 | onnxruntime | 309.75 | 3.23 | |
npu | bisenet | 512x512 | A8W8 | 周易 NPU | 10.70 | 93.43 |
4. 参考
- https://github.com/xlite-dev/lite.ai.toolkit?tab=readme-ov-file
- https://github.com/zllrunning/face-parsing.PyTorch
- 【“星睿O6”评测】RVM人像分割torch➡️ncnn-CPU/GPU和o6-NPU部署全过程
相关文章:
【“星瑞” O6 评测】—NPU 部署 face parser 模型
前言 瑞莎星睿 O6 (Radxa Orion O6) 拥有高达 28.8TOPs NPU (Neural Processing Unit) 算力,支持 INT4 / INT8 / INT16 / FP16 / BF16 和 TF32 类型的加速。这里通过通过官方的工具链进行FaceParsingBiSeNet的部署 1. FaceParsingBiSeNet onnx 推理 首先从百度网盘…...
hadoop的三大结构及其各自的作用
Hadoop 主要有三大核心组件,分别是 HDFS(Hadoop Distributed File System)、MapReduce 和 YARN,以下是它们各自的作用: HDFS(Hadoop Distributed File System) 存储数据:HDFS 是一个…...
免费将静态网站部署到服务器方法(仅支持HTML,CSS,JS)
原视频链接:把HTML免费部署到网站上,实现别人也能访问的教程来啦QAQ_哔哩哔哩_bilibili 注意:仅支持HTML、CSS、JS。不支持Vue等框架。 1.打开网站www.wordpress.org 点击红框按钮 点击红框按钮下载wordpress模板文件并解压。 将自己编写的…...
2、SpringAI接入ChatGPT与微服务整合
2、SpringAI接入ChatGPT与微服务整合 小薛博客AI 大模型资料 1、SpringAI简介 https://spring.io/projects/spring-ai Spring AI是一个人工智能工程的应用框架。其目标是将Spring生态系统的设计原则(如可移植性和模块化设计)应用于人工智能领域&#…...
6.7.图的深度优先遍历(英文缩写DFS)
树是特殊的图,没有回路的图就是树 BFS与DFS的区别在于,BFS使用了队列,DFS使用了栈 一.深度优先遍历: 1.树的深度优先遍历: 树的深度优先遍历分为先根遍历和后根遍历。 以树的先根遍历为例: 上述图片里…...
若依同步企业微信架构及ACTIVITI
企业微信配置 1.进入企业微信后台管理应用管理,新建应用 2.配置网页授权及JS-SDK 将验证文件下载到项目的pubilc下 启动项目 npm run dev 然后验证域名归属 3.配置企业可信IP 公网IP地址即可,仅此IP的服务可调用企业微信接口信息 4.构造域名回调域&a…...
PyTorch分布式训练调试方法(跟踪调用过程)
PyTorch分布式训练调试方法(跟踪调用过程) 背景 在分布式深度学习训练场景中,通信操作(如AllReduce、Send/Recv)和CUDA操作的时序问题往往难以调试。本工具通过以下方式提供调试支持: 拦截所有PyTorch张量操作并记录调用栈监控分布式通信操作的完整生命周期自动生成带时间…...
跟我学C++中级篇——内存异常的分析
一、内存问题引发的现象 在实际使用电脑过程中,经常会遇到电脑卡住了,鼠标和键盘也没反应。这时候儿会怎么办?其实此时打开任务管理器,就可以发现,有几种情况:一是CPU占用过高;二是IO占用过高&…...
HTML新标签与核心 API 实战
HTML5 新标签与核心 API 实战 引言 今天咱们来看看HTML5 新标签以及一些核心 API。 HTML5 的引入彻底改变了 Web 前端开发格局,尤其是其新增的多媒体和交互能力标签。对于前端开发者而言,理解并掌握 <video>、<audio>、<canvas> 和…...
vscode 红色波浪线问题
VSCode 红色波浪线问题终极解决方案 问题描述 在编写 C 项目时,CMake 编译通过但代码出现红色波浪线,常见问题: #include 提示找不到头文件枚举或类型名未定义成员函数或变量无法识别 这些是 VSCode 的 IntelliSense 配置问题,…...
类型补充,scan 和数据库管理命令
Redis 数据类型 stream stream 就是一个队列(阻塞队列) Redis 作为一个消息队列的重要支撑,属于是 list 中 blpop 和 brpop 的升级版本 geospatial 主要用于存储地理位置信息,并对存储的信息进行操作 存储一些点后,…...
AI Agent系列(十) -Data Agent(数据分析智能体)开源资源汇总
AI Agent系列【十】 前言一、 Open Interpreter1.1 Open Interpreter的特点1.2 Open Interpreter的优势1.3 Open Interpreter的应用场景 二、DB-GPT2.1 核心能力2.2关键特性:2.3 系统架构 三、DeepBI3.1 特点 前言 DataAgent的能力本质上比较依赖大模型的自然语言转API/SQL/代…...
Vue3 + TypeScript中provide和inject的用法示例
基础写法(类型安全) typescript // parent.component.vue import { provide, ref } from vue import type { InjectionKey } from vue// 1. 定义类型化的 InjectionKey const COUNTER_KEY Symbol() as InjectionKey<number> const USER_KEY Sy…...
【国家能源集团生态协作平台-注册/登录安全分析报告】
前言 由于网站注册入口容易被黑客攻击,存在如下安全问题: 暴力破解密码,造成用户信息泄露短信盗刷的安全问题,影响业务及导致用户投诉带来经济损失,尤其是后付费客户,风险巨大,造成亏损无底洞…...
不确定与非单调推理的基本概念
前文我们讨论了建立在经典逻辑基础上的确定性推理,这是一种运用确定性知识进行的精确推理。同时,它又是一种单调性推理,即随着新知识的加人,推出的结论或证明了的命题将单调地增加。但是,人们通常是在信息不完善、不精确的情况下运用不确定性知识进行思维、求解问题的,推…...
系统架构设计师:计算机组成与体系结构(如CPU、存储系统、I/O系统)高效记忆要点、知识体系、考点详解、、练习题并提供答案与解析
计算机组成与体系结构高效记忆要点 从CPU、存储系统、I/O系统三大模块展开,结合高频考点与记忆技巧,有助于系统化掌握核心知识点。 一、CPU结构与工作原理 1. CPU的组成 核心组件: 运算器(ALU) :负责算术…...
FreeSWITCH中SIP网关(Gateway)操作
freeswitch是一款简单好用的VOIP开源软交换平台。 以下是一篇关于FreeSWITCH中SIP网关(Gateway)操作的技术指南,基于提供的官方文档内容整理: 一、网关生命周期管理 1. 创建新SIP Profile并启动 FreeSWITCH支持多SIP Profile&…...
构建自动翻译工作流:技术与实践
一、引言 制药行业客户迫切需要一种翻译解决方案,以解决公司内部多样化的翻译难题。他们需要的不仅是提升翻译效率和准确性的工具,更希望能够保持文档的原始格式。我们观察到客户的需求广泛,包括多语言办公文件、研究文档和药品报批文件等&a…...
在pycharm中搭建yolo11分类检测系统--PyQt5学习(二)
第二部分 测试本地pycharm通过程序连接远程服务器autodl 模型的推理需要借助远程服务器autodl,但是界面的运行是在pycharm中,我的设想是按钮调用一个py文件就好了。 1. 本地运行PyQt5界面。 2. 当需要载入权重时,通过SSH连接到AutodL服务…...
汽车行驶工况特征参数:从“速度曲线”到“驾驶DNA”的硬核解码
作为新能源汽车行业的从业者,你是否曾困惑于这些问题: 为什么同一款电动车,不同用户的实际续航差异高达30%?如何精准量化驾驶行为对电池寿命的影响?车企标定的“NEDC续航”与真实路况差距的根源是什么? 这…...
dify本地部署,docker-plugin_daemon-1启动不了,一直报错
解决办法,修改这两个配置,然后重启 进入源代码目录,docker文件夹下 docker compose down docker compose up -d https://github.com/langgenius/dify/issues/17677...
2025 年第十五届 MathorCup 数学应用挑战赛 A 题:汽车风阻预测
A 题:汽车风阻预测 在空气动力学领域,空气阻力对汽车以及航空航天工业中载具的 性能和效率有着至关重要的影响。以往的研究表明,预测这种阻力需 要借助先进的工业仿真软件进行大规模流体力学模拟仿真,而该模拟 过程不仅算法复杂…...
AI Agents系列之AI代理架构体系
1. 引言 智能体架构是定义智能体组件如何组织和交互的蓝图,使智能体能够感知其环境、推理并采取行动。本质上,它就像是智能体的数字大脑——集成了“眼睛”(传感器)、“大脑”(决策逻辑)和“手”(执行器),用于处理信息并采取行动。 选择正确的架构对于构建有效的智能…...
使用Java动态数据生成PDF报告:简化您的报告导出流程
在当今的数据驱动世界中,能够快速且有效地将数据转化为可视化的报告是一项宝贵的技能。无论是商业分析、项目管理还是学术研究,PDF报告都是分享和存档信息的理想格式。在这篇博客中,我们将探讨如何使用Java编程语言结合iText库来动态生成包含…...
Sqlite3交叉编译全过程
Sqlite3交叉编译全过程 一、概述二、下载三、解压四、配置五、编译六、安装七、验证文件类型八、移植8.1、头文件sqlite3.h8.2、动态链接库移植8.3、静态态链接库移植 九、验证使用9.1. 关键函数说明 十、触发器使用十一、sqlite表清空且恢复id值十二、全文总结 一、概述 SQLi…...
Qt QThread 两种线程管理方法
在 Qt 中,QThread 有两种常见的用法,分别对应不同的线程管理模型。这两种方法各有优缺点,适用于不同的场景: 1. 子类化 QThread(继承 QThread,重写 run() 方法) 这是传统的线程用法,类似于 Java 或 C++ 标准库中的线程模型。通过继承 QThread 并重写 run() 方法,将需…...
React 中如何获取 DOM:用 useRef 操作非受控组件
📌 场景说明 在写 React 的时候,通常我们是通过“受控组件”来管理表单元素,比如用 useState 控制 <input> 的值。 但有些时候,控制的需求只是临时性的,或者完全不需要重新渲染组件,这时候直接访问…...
GoogleCodeUtil.java
Google动态验证码实现 GoogleCodeUtil.java package zwf;import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.security.SecureRandom;/** https://mvnrepository.com/artifact/commons-codec/…...
Hutool之DateUtil:让Java日期处理变得更加简单
前言 在Java开发中,日期和时间的处理是一个常见问题。为了简化这个过程,许多开发者会使用第三方工具包,如Hutool。Hutool是一个Java工具包,提供了许多实用的功能,其中之一就是日期处理。日期时间工具类是Hutool的核心包…...
解锁古籍中的气候密码,探索GPT/BERT在历史灾害研究中的前沿应用;气候史 文本挖掘 防灾减灾;台风案例、干旱案例、暴雨案例
历史灾害文献分析方法论的研究,是连接过去与未来的关键桥梁。通过对古籍、方志、档案等非结构化文本的系统性挖掘与量化分析,不仅能够重建千年尺度的灾害事件序列(如台风、洪旱等),弥补仪器观测数据的时空局限性&#…...
DeepSeek-R3、GPT-4o 与 Claude-3.5-Sonnet 全面对比:性能、应用场景与技术解析
随着大模型技术的迅猛发展,国产模型正逐渐崭露头角,尤其是DeepSeek-R3的发布,更是在AI技术社区中引起广泛关注。而与此同时,国际领先的GPT-4o和Claude-3.5-Sonnet也在不断迭代升级,持续刷新业界对AI能力的认知。下文将…...
智能翻译播放器,让无字幕视频不再难懂
打工人们你们好!这里是摸鱼 特供版~ 今天给大家带来一款超牛的黑科技——Splayer,完全免费的智能翻译播放器,让你轻松看懂无字幕视频! 推荐指数:★★★★★ 软件简介 Splayer 是一款完全免费的智能翻译播放器&#…...
快手本地生活2024年GMV同增200%,“新线城市+AI”将成增长引擎
4月17日,“新线大市场,AI新机遇”快手本地生活2025聚力大会在沈阳召开。 会上,快手高级副总裁、本地生活事业部负责人笑古在聚力大会上表示,“新线城市AI”将成为快手本地生活的增长引擎。 据「TMT星球」了解,2024年…...
第七篇:系统分析师第三遍——1、2章
目录 一、目标二、计划三、完成情况四、意外之喜(最少2点)1.计划内的明确认知和思想的提升标志2.计划外的具体事情提升内容和标志 五、总结 一、目标 通过参加考试,训练学习能力,而非单纯以拿证为目的。 1.在复习过程中,训练快速阅读能力、掌…...
2025妈妈杯数学建模D题完整分析论文(共42页)(含模型建立、代码)
2025 年第十五届 MathorCup 数学建模D题完整分析论文 目录 摘要 一、问题分析 二、问题重述 三、模型假设 四、 模型建立与求解 4.1问题1 4.1.1问题1思路分析 4.1.2问题1模型建立 4.1.3问题1样例代码(MATLAB和Python) 4.1.4问题1结果…...
软考高级-系统架构设计师 论文范文参考(一)
文章目录 论SOA技术的应用论SOA在企业信息化中的应用论UP(统一过程方法)的应用论分布式数据库的设计与实现论改进Web服务器性能的有关技术论基于UML的需求分析论基于构件的软件开发论基于构件的软件开发(二) 论SOA技术的应用 摘要: 本人于…...
江湖路远,唯PUT可稳:Express 路由更新招式全解
前言 江湖传闻,后端开发如同修炼绝世武功:有人精通 POST 掌,横扫千军;有人修习 GET 指法,探查万象。而真正踏入高阶境界的高手,常常默默修炼一门冷门却威力极强的秘技,PUT 神功。 今日时机正好,你我相逢于码海江湖,不如来一场技术切磋,也许能悟出更新之道,功力再上…...
【k8s系列1】一主两从结构的环境准备
环境准备 虚拟机软件准备及安装,这里就不详细展开了,可以看文章:【一、虚拟机vmware安装】 linux环境准备及下载,下载镜像centOS7.9,以前也有写过这个步骤的文章,可以看:【二、安装centOS】 开始进入正题…...
通过特定协议拉起 electron 应用
在 Android 通过 sheme 协议可以拉起其他应用。 electron 应用也可以通过类似特定协议被拉起。 在同时有 web、客户端的应用里,可以通过这种方式在 web 拉起客户端。 支持拉起客户端 const PROTOCOL xxxif (process.defaultApp) {// 这里是开发环境,有…...
IDEA MyBatisCodeHelper Pro插件高版本解密
声明,该方法仅仅作为个人研究学习使用,请勿传播 版本说明 系统:macOS(Windows同理)IDE:IntelliJ IDEA 2024.4MyBatisCodeHelper Pro 3.4 环境准备 从插件市场下载MyBatisCodeHelper Pro 找到MyBatisCo…...
网站制作公司哪家好?如何选择靠谱的网站设计公司
在当今数字化时代,企业想要在互联网上立足,一个专业、美观且功能强大的网站是必不可少的。然而,面对众多的网站建设公司,如何选择一家真正适合自己需求的合作伙伴,成为了许多企业主和创业者面临的难题。毕竟࿰…...
Linux之基础命令
Linux作为开源操作系统的代表,以其高效、灵活和强大的命令行工具闻名。无论是系统管理、开发调试还是日常使用,掌握基础命令都是与Linux系统交互的必备技能。本文整理了20个最常用的Linux基础命令,帮助新手快速入门。 目录 目录与文件导航文…...
使用手机归属地查询API,使效率事半功倍
手机归属地查询API通过查询手机号码的归属地信息,为企业提供了一个高效、便捷的解决方案,帮助企业在竞争激烈的市场中脱颖而出。 代码示例 请求参数说明: 名称必填类型说明key是string个人中心查看phone是int手机号 返回参数说明: 名称类型说明phon…...
基于FPGA的AES加解密系统verilog实现,包含testbench和开发板硬件测试
目录 1.课题概述 2.系统测试效果 3.核心程序与模型 4.系统原理简介 4.1 字节替换(SubBytes) 4.2 行移位(ShiftRows) 4.3 列混合(MixColumns) 4.4 轮密钥加(AddRoundKey) 4.…...
【AI部署】腾讯云GPU -—SadTalker的AI数字人访问web服务—未来之窗超算中心
访问部署在Cloud Studio上的web服务 当你把该项目部署在本地时,访问该服务的请求地址为http://localhost:8080/hello;当你把该项目部署在Cloud Studio工作台启动时,要想访问到该服务,需要先在工作台右侧打开访问链接面板ÿ…...
Linux:命令行参数、环境变量
命令行参数 执行程序时,可以从命令行传值给 C 程序。这些值被称为命令行参数,它们对程序很重要,特别是当我们想从外部控制程序,而不是在代码内对这些值进行硬编码时,就显得尤为重要了。 在 C 语言中,命令…...
Linux CentOS 更改MySQL数据库目录位置
在 CentOS 系统上更改 MySQL(或 MariaDB)数据库目录位置(datadir)需要谨慎操作,以避免数据丢失或服务启动失败。以下是详细步骤: 1. 停止 MySQL/MariaDB 服务 bash 复制 sudo systemctl stop mysqld …...
Unity-微信截图功能简单复刻-03绘制空心矩形
思路-绘制空心矩形 拓展UGUI的Graphic类,实现拖拽接口。 开始拖拽时记录鼠标位置, 使用拖拽中的鼠标位置和记录的位置,计算矩形顶点,绘制矩形。 两个三角形合并为一个矩形,作为空心矩形的一条边,四个边合并为空心矩形…...
Flutter与FastAPI的OSS系统实现
作者:孙嘉成 目录 一、对象存储 二、FastAPI与对象存储 2.1 缤纷云S4服务API对接与鉴权实现 2.2 RESTful接口设计与异步路由优化 三、Flutter界面与数据交互开发 3.1 应用的创建 3.2页面的搭建 3.3 文件的上传 关键词:对象存储、FastAPI、Flutte…...
环境搭建与入门:Flutter SDK安装与配置
环境搭建与入门:Flutter SDK安装与配置 一、Flutter开发环境概述 1.1 Flutter开发环境组成 Flutter开发环境主要包含以下几个关键组件: Flutter SDK:Flutter的核心开发工具包Dart SDK:Flutter使用的编程语言环境IDE/编辑器&am…...