【计算机视觉】DINOv2(视觉大模型)代码使用和测试(完整的源代码)

文章目录

  • 一、环境部署
  • 二、导入原图
    • 2.1 使用vit_s14的模型
  • 三、使用其他模型
    • 3.1 使用vit_b14的模型
    • 3.2 使用vit_l14的模型
    • 3.3 使用vit_g14的模型

一、环境部署

!git clone https://ghproxy.com/https://github.com/facebookresearch/dinov2.git

输出为:

Cloning into 'dinov2'...
remote: Enumerating objects: 141, done.
remote: Counting objects: 100% (96/96), done.
remote: Compressing objects: 100% (74/74), done.  71% (53/74)
remote: Total 141 (delta 40), reused 31 (delta 22), pack-reused 45
Receiving objects: 100% (141/141), 101.01 KiB | 348.00 KiB/s, done.
Resolving deltas: 100% (42/42), done.

命令是一个Git命令,用于克隆(Clone)名为"dinov2"的存储库。它使用了一个名为"ghproxy.com"的代理,用于加速GitHub的克隆操作。

!pip install -r /kaggle/working/dinov2/requirements.txt

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

!pip install scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple

在这里插入图片描述

二、导入原图

%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimgimage = mpimg.imread('/kaggle/input/demo-image/1 (4).png')plt.imshow(image)
plt.axis('off')
plt.show()# 输出图像尺寸
print("图像尺寸:{} x {} x {}".format(image.shape[0], image.shape[1], image.shape[2]))

在这里插入图片描述

图像尺寸:1376 x 920 x 3

我们需要切换为output的路径:

import osinput_path = "/kaggle/working/dinov2"
os.chdir(input_path)

2.1 使用vit_s14的模型

import torch
import torchvision.transforms as T
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.image as mpimg 
from PIL import Image
from sklearn.decomposition import PCA
import matplotlibpatch_h = 75
patch_w = 50
feat_dim = 384transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),T.Resize((patch_h * 14, patch_w * 14)),T.CenterCrop((patch_h * 14, patch_w * 14)),T.ToTensor(),T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
])dinov2_vits14 = torch.hub.load('', 'dinov2_vits14',source='local').cuda()features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()img_path = f'/kaggle/input/demo-image/1 (4).png'
img = Image.open(img_path).convert('RGB')
imgs_tensor[0] = transform(img)[:3]
with torch.no_grad():features_dict = dinov2_vits14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()
pca = PCA(n_components=3)
pca.fit(features)
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fgb = np.where(pca_features_bg)pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])
for i in range(3):pca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].min()) / (pca_features_rem[:, i].max() - pca_features_rem[:, i].min())# transform using mean and std, I personally found this transformation gives a better visualization# pca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5pca_features_rgb = pca_features.copy()
pca_features_rgb[pca_features_fg] = pca_features_rem
pca_features_rgb[b] = 0pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

以下是代码的逐行中文解读:

import torch
import torchvision.transforms as T
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.image as mpimg 
from PIL import Image
from sklearn.decomposition import PCA
import matplotlib# 设置补丁(patch)的高度和宽度
patch_h = 75
patch_w = 50
# 特征维度
feat_dim = 384# 定义图像转换操作
transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),  # 高斯模糊T.Resize((patch_h * 14, patch_w * 14)),  # 调整图像大小T.CenterCrop((patch_h * 14, patch_w * 14)),  # 中心裁剪T.ToTensor(),  # 转换为张量T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),  # 标准化
])# 使用torch.hub加载dinov2_vits14模型并移至CUDA设备
dinov2_vits14 = torch.hub.load('', 'dinov2_vits14', source='local').cuda()# 创建用于存储特征和图像张量的零张量
features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()# 图像路径
img_path = f'/kaggle/input/demo-image/1 (4).png'
# 打开图像并转换为RGB模式
img = Image.open(img_path).convert('RGB')
# 对图像进行转换操作,并将其存储在imgs_tensor的第一个位置
imgs_tensor[0] = transform(img)[:3]# 禁用梯度计算
with torch.no_grad():# 将图像张量传递给dinov2_vits14模型获取特征features_dict = dinov2_vits14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']# 重塑特征形状为(4 * patch_h * patch_w, feat_dim)
features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()# 创建PCA对象并拟合特征
pca = PCA(n_components=3)
pca.fit(features)# 对PCA转换后的特征进行归一化处理
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())# 根据阈值进行前景和背景的区分
pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fg# 查找背景特征的索引
b = np.where(pca_features_bg)# 对前景特征再次进行PCA转换
pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])# 对前景特征进行归一化处理
for i in range(3):pca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].min()) / (pca_features_rem[:, i].max() - pca_features_rem[:, i].min())# 使用均值和标准差进行转换,个人发现这种转换方式可以得到更好的可视化效果# pca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5# 创建RGB特征数组
pca_features_rgb = pca_features.copy()# 替换前景特征为转换后的特征
pca_features_rgb[pca_features_fg] = pca_features_rem# 将背景特征设置为0
pca_features_rgb[b] = 0# 重塑特征形状为(4, patch_h, patch_w, 3)
pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)# 显示第一个图像的RGB特征
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

这段代码的功能是对给定的图像进行一系列处理和特征提取,并使用PCA对特征进行降维。然后,根据特定阈值对前景和背景进行区分,最后将特征可视化为RGB图像。请注意,其中的具体数值和路径可能需要根据您的实际数据和环境进行调整。

在这里插入图片描述

print(features)
print(features.shape)

我们的输出结果为:

tensor([[-1.3500, -4.8793, -1.4393,  ...,  2.3347,  1.6834, -2.9632],[-0.4650, -6.4163, -1.5503,  ...,  2.2055,  2.5527, -3.2553],[-0.6371, -6.2615, -0.7516,  ...,  3.1827,  2.3861, -2.6838],...,[ 1.9385,  0.0726, -0.5395,  ...,  0.3876, -1.4914, -4.5422],[ 1.6399, -0.0860,  0.4701,  ...,  1.0180, -0.8897, -5.2614],[ 1.6084, -0.0669,  0.7341,  ...,  1.0633, -0.9713, -5.3548]])
torch.Size([15000, 384])

降维后的特征为:

print(pca_features)
print(pca_features.shape)

输出的结果为:

[[  0.81004055   2.458559    12.11051576][  0.79562888   5.65071716  10.84007045][  0.82050109   5.55007889   9.05274001]...[  0.27618588 -18.96898667  19.48198916][  0.31861323 -12.21414371  14.19802898][  0.34356016 -10.82144825  13.74648131]]
(15000, 3)
features_dict

我们看一下字典的构成:

{'x_norm_clstoken': tensor([[ 2.2549, -1.5661,  4.4978,  ...,  1.4984, -5.8642, -0.8560],[ 1.8816,  2.4343,  1.4931,  ..., -1.3401, -2.5460,  1.3967],[ 1.8816,  2.4343,  1.4931,  ..., -1.3401, -2.5460,  1.3967],[ 1.8816,  2.4343,  1.4931,  ..., -1.3401, -2.5460,  1.3967]],device='cuda:0'),'x_norm_patchtokens': tensor([[[-1.3500, -4.8793, -1.4393,  ...,  2.3347,  1.6834, -2.9632],[-0.4650, -6.4163, -1.5503,  ...,  2.2055,  2.5527, -3.2553],[-0.6371, -6.2615, -0.7516,  ...,  3.1827,  2.3861, -2.6838],...,[-0.8778, -0.0251, -0.2867,  ...,  4.7801, -2.0887, -4.5910],[-1.2309,  0.2852,  0.7693,  ...,  5.0635, -1.1529, -6.0175],[-1.7551,  1.1333, -0.0898,  ...,  4.1885, -3.3197, -5.7227]],[[ 0.9131, -4.9736, -0.6238,  ...,  0.2835, -0.3494, -0.4916],[ 1.0967, -6.0392, -0.7900,  ...,  0.2323,  0.0510,  0.0176],[ 1.3852, -5.8056, -1.2573,  ...,  0.0549, -0.3270, -0.4510],...,[ 1.9385,  0.0726, -0.5395,  ...,  0.3877, -1.4914, -4.5422],[ 1.6399, -0.0860,  0.4701,  ...,  1.0180, -0.8897, -5.2614],[ 1.6084, -0.0669,  0.7341,  ...,  1.0633, -0.9713, -5.3548]],[[ 0.9131, -4.9736, -0.6238,  ...,  0.2835, -0.3494, -0.4916],[ 1.0967, -6.0392, -0.7900,  ...,  0.2323,  0.0510,  0.0176],[ 1.3852, -5.8056, -1.2573,  ...,  0.0549, -0.3270, -0.4510],...,[ 1.9385,  0.0726, -0.5395,  ...,  0.3877, -1.4914, -4.5422],[ 1.6399, -0.0860,  0.4701,  ...,  1.0180, -0.8897, -5.2614],[ 1.6085, -0.0669,  0.7341,  ...,  1.0633, -0.9713, -5.3548]],[[ 0.9131, -4.9736, -0.6238,  ...,  0.2835, -0.3494, -0.4916],[ 1.0967, -6.0392, -0.7900,  ...,  0.2323,  0.0510,  0.0176],[ 1.3852, -5.8056, -1.2573,  ...,  0.0549, -0.3270, -0.4511],...,[ 1.9385,  0.0726, -0.5395,  ...,  0.3876, -1.4914, -4.5422],[ 1.6399, -0.0860,  0.4701,  ...,  1.0180, -0.8897, -5.2614],[ 1.6084, -0.0669,  0.7341,  ...,  1.0633, -0.9713, -5.3548]]],device='cuda:0'),'x_prenorm': tensor([[[ 4.7546e-01, -3.4794e-02,  1.1905e+00,  ...,  3.3896e-01,-1.2591e+00, -8.1724e-03],[-5.2994e-01, -3.0311e-01, -2.0162e-01,  ...,  9.4372e-01,8.7399e-01, -3.2527e-01],[-1.5728e-01, -3.9359e-01, -2.1482e-01,  ...,  9.0485e-01,1.2325e+00, -3.3923e-01],...,[-4.9091e-01,  1.1081e-02,  1.9814e-01,  ...,  2.0630e+00,-8.5562e-01, -7.6588e-01],[-6.0861e-01,  5.2204e-02,  6.6299e-01,  ...,  2.1127e+00,-3.8590e-01, -9.7335e-01],[-9.3785e-01,  1.2485e-01,  3.0359e-01,  ...,  1.9137e+00,-1.5223e+00, -1.0352e+00]],[[ 4.4059e-01,  1.4807e-01,  5.9425e-01,  ..., -3.4851e-01,-6.1687e-01,  2.0463e-01],[ 3.1511e-01, -3.3073e-01,  9.0955e-02,  ...,  1.3627e-01,1.8562e-02,  4.2850e-02],[ 3.8695e-01, -4.1345e-01,  2.8734e-02,  ...,  1.1916e-01,1.8061e-01,  1.2469e-01],...,[ 6.3855e-01,  1.9967e-03,  5.6187e-02,  ...,  1.0780e-01,-5.0606e-01, -6.6095e-01],[ 5.6617e-01,  4.9071e-03,  4.8375e-01,  ...,  3.7527e-01,-2.6194e-01, -7.9524e-01],[ 5.6790e-01,  1.4408e-02,  6.0538e-01,  ...,  4.0537e-01,-2.9182e-01, -8.1226e-01]],[[ 4.4059e-01,  1.4807e-01,  5.9424e-01,  ..., -3.4851e-01,-6.1687e-01,  2.0463e-01],[ 3.1511e-01, -3.3073e-01,  9.0957e-02,  ...,  1.3627e-01,1.8564e-02,  4.2850e-02],[ 3.8695e-01, -4.1345e-01,  2.8733e-02,  ...,  1.1916e-01,1.8061e-01,  1.2469e-01],...,[ 6.3855e-01,  1.9971e-03,  5.6186e-02,  ...,  1.0780e-01,-5.0606e-01, -6.6095e-01],[ 5.6617e-01,  4.9067e-03,  4.8375e-01,  ...,  3.7527e-01,-2.6194e-01, -7.9524e-01],[ 5.6790e-01,  1.4408e-02,  6.0538e-01,  ...,  4.0536e-01,-2.9182e-01, -8.1226e-01]],[[ 4.4059e-01,  1.4807e-01,  5.9424e-01,  ..., -3.4851e-01,-6.1687e-01,  2.0463e-01],[ 3.1511e-01, -3.3073e-01,  9.0956e-02,  ...,  1.3627e-01,1.8562e-02,  4.2849e-02],[ 3.8695e-01, -4.1344e-01,  2.8735e-02,  ...,  1.1916e-01,1.8061e-01,  1.2469e-01],...,[ 6.3855e-01,  1.9964e-03,  5.6189e-02,  ...,  1.0780e-01,-5.0607e-01, -6.6095e-01],[ 5.6617e-01,  4.9066e-03,  4.8375e-01,  ...,  3.7527e-01,-2.6194e-01, -7.9524e-01],[ 5.6790e-01,  1.4408e-02,  6.0538e-01,  ...,  4.0537e-01,-2.9182e-01, -8.1226e-01]]], device='cuda:0'),'masks': None}

我们换一种可视化的方法:

patch_h = 75
patch_w = 50
feat_dim = 384transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),T.Resize((patch_h * 14, patch_w * 14)),T.CenterCrop((patch_h * 14, patch_w * 14)),T.ToTensor(),T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
])dinov2_vits14 = torch.hub.load('', 'dinov2_vits14',source='local').cuda()features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()img_path = f'/kaggle/input/demo-image/1 (4).png'
img = Image.open(img_path).convert('RGB')
imgs_tensor[0] = transform(img)[:3]
with torch.no_grad():features_dict = dinov2_vits14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()
pca = PCA(n_components=3)
pca.fit(features)
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fgb = np.where(pca_features_bg)pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])
for i in range(3):# transform using mean and std, I personally found this transformation gives a better visualizationpca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5pca_features_rgb = pca_features.copy()
pca_features_rgb[pca_features_fg] = pca_features_rem
pca_features_rgb[b] = 0pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

在这里插入图片描述

三、使用其他模型

3.1 使用vit_b14的模型

patch_h = 75
patch_w = 50
feat_dim = 768transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),T.Resize((patch_h * 14, patch_w * 14)),T.CenterCrop((patch_h * 14, patch_w * 14)),T.ToTensor(),T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
])dinov2_vitb14 = torch.hub.load('', 'dinov2_vitb14',source='local').cuda()features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()img_path = f'/kaggle/input/demo-image/1 (4).png'
img = Image.open(img_path).convert('RGB')
imgs_tensor[0] = transform(img)[:3]
with torch.no_grad():features_dict = dinov2_vitb14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()
pca = PCA(n_components=3)
pca.fit(features)
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fgb = np.where(pca_features_bg)pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])
for i in range(3):# transform using mean and std, I personally found this transformation gives a better visualizationpca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5pca_features_rgb = pca_features.copy()
pca_features_rgb[pca_features_fg] = pca_features_rem
pca_features_rgb[b] = 0pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

在这里插入图片描述

3.2 使用vit_l14的模型

patch_h = 75
patch_w = 50
feat_dim = 1024transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),T.Resize((patch_h * 14, patch_w * 14)),T.CenterCrop((patch_h * 14, patch_w * 14)),T.ToTensor(),T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
])dinov2_vitl14 = torch.hub.load('', 'dinov2_vitl14',source='local').cuda()features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()img_path = f'/kaggle/input/demo-image/1 (4).png'
img = Image.open(img_path).convert('RGB')
imgs_tensor[0] = transform(img)[:3]
with torch.no_grad():features_dict = dinov2_vitl14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()
pca = PCA(n_components=3)
pca.fit(features)
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fgb = np.where(pca_features_bg)pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])
for i in range(3):# transform using mean and std, I personally found this transformation gives a better visualizationpca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5pca_features_rgb = pca_features.copy()
pca_features_rgb[pca_features_fg] = pca_features_rem
pca_features_rgb[b] = 0pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

在这里插入图片描述

3.3 使用vit_g14的模型

patch_h = 75
patch_w = 50
feat_dim = 1536transform = T.Compose([T.GaussianBlur(9, sigma=(0.1, 2.0)),T.Resize((patch_h * 14, patch_w * 14)),T.CenterCrop((patch_h * 14, patch_w * 14)),T.ToTensor(),T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
])dinov2_vitg14 = torch.hub.load('', 'dinov2_vitg14',source='local').cuda()features = torch.zeros(4, patch_h * patch_w, feat_dim)
imgs_tensor = torch.zeros(4, 3, patch_h * 14, patch_w * 14).cuda()img_path = f'/kaggle/input/demo-image/1 (4).png'
img = Image.open(img_path).convert('RGB')
imgs_tensor[0] = transform(img)[:3]
with torch.no_grad():features_dict = dinov2_vitg14.forward_features(imgs_tensor)features = features_dict['x_norm_patchtokens']features = features.reshape(4 * patch_h * patch_w, feat_dim).cpu()
pca = PCA(n_components=3)
pca.fit(features)
pca_features = pca.transform(features)
pca_features[:, 0] = (pca_features[:, 0] - pca_features[:, 0].min()) / (pca_features[:, 0].max() - pca_features[:, 0].min())pca_features_fg = pca_features[:, 0] > 0.3
pca_features_bg = ~pca_features_fgb = np.where(pca_features_bg)pca.fit(features[pca_features_fg])
pca_features_rem = pca.transform(features[pca_features_fg])
for i in range(3):# transform using mean and std, I personally found this transformation gives a better visualizationpca_features_rem[:, i] = (pca_features_rem[:, i] - pca_features_rem[:, i].mean()) / (pca_features_rem[:, i].std() ** 2) + 0.5pca_features_rgb = pca_features.copy()
pca_features_rgb[pca_features_fg] = pca_features_rem
pca_features_rgb[b] = 0pca_features_rgb = pca_features_rgb.reshape(4, patch_h, patch_w, 3)
plt.imshow(pca_features_rgb[0][...,::-1])
plt.savefig('features.png')
plt.show()
plt.close()

在这里插入图片描述

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

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

相关文章

DT灯光基础(辉光 雾 阴影 渲染选项)

点光源 不能宣染,换个版本。不能正常预览 聚光灯 t 手柄 挡光版 平行光阴影 光线追踪阴影 没有看见阴影 灯光使用贴图 环境光 不进行渲染物体 不渲染阴影 接收阴影 不反射 可以看到反射 没有反射了 灯光链接 取消灯照 灯光雾 辉光 变化不明显

C++初阶 - 3.类和对象(中)

目录 1.类的6个默认成员函数 2.构造函数 2.2特性 3.析构函数 3.1 概念 3.2 特性 4. 拷贝构造函数 4.1 概念 4.2 特征 5.赋值运算符重载 5.1运算符重载 5.2 赋值运算符重载 5.3 前置和后置重载 6.日期类的实现 7.const成员 8.取地址及const取地址操作符重载 1.类…

FCOS 论文学习

1. 解决了什么问题? 之前的目标检测器如 RetinaNet、SSD、YOLOv3 都依赖于 anchors。基于 anchors 的检测器有如下三个缺点: 检测表现对于 anchors 的大小、宽高比和数量等超参数很敏感;即使精心设计了 anchors,但由于大小和宽高…

EasyCVR告警类型设置后首页需要刷新才能更新的问题优化

EasyCVR视频融合平台基于云边端一体化架构,可支持多协议、多类型设备接入,包括:NVR、IPC、视频编码器、无人机、车载设备、智能手持终端、移动执法仪等。平台具有强大的数据接入、处理及分发能力,可在复杂的网络环境中&#xff0c…

Zabbix 自动发现及注册

1、依次选择 Configuratio、Discovery、Create discovery rule(配置、自动发现、创建发现规则) 创建客户端发现规则 2、zabbix客户端安装 agent zabbix客户端一键安装脚本 脚本参考链接 #!/bin/bash #Zabbix-Agent 5.0Zabbix_Service192.168.63.20#安…

【PHP面试题44】PHP5的版本和PHP7之间有哪些区别

文章目录 一、前言二、底层调整2.1性能提升2.2 新的引擎2.3 数据类型改进2.4 错误处理改进2.5 语言特性增加 三、应用层差异3.1 兼容性3.2 类和方法改进3.3 错误处理机制3.4 性能优化3.5 新的扩展支持 四、一些语法糖示例4.1 标量类型声明示例4.2 新增了Spaceship操作符&#x…

win11中的pagefile.sys

在C盘系统下,有一个命名为pagefile.sys的文件占用C盘太大的空间,不少用户怕删除pagefile.sys文件之后会对系统造成影响,而不少用户想要将pagefile.sys文件移动到D盘中。那么pagefile.sys是什么文件?Win10系统下pagefile.sys文件太…

【C++】list的模拟实现

🌇个人主页:平凡的小苏 📚学习格言:命运给你一个低的起点,是想看你精彩的翻盘,而不是让你自甘堕落,脚下的路虽然难走,但我还能走,比起向阳而生,我更想尝试逆风…

5. MySQL - JDBC SQL 注入 博客系统(万字详解)

目录 1. 介绍 2. 使用 JDBC 连接数据库 2.1 如何使用 JDBC 连接数据库 2.2 导入的各个类 2.3 DataSource 对象的创建 2.4 从 DataSource 对象中得到 Connection 对象 2.5 创建 Statement 对象 2.6 从 ResultSet 中遍历每行结果,从每行中获取每列的值 2.7 代…

EIK+Filebeat+Kafka

目录 Kafka 概述 为什么需要消息队列(MQ) 使用消息队列的好处 消息队列的两种模式 Kafka 定义 Kafka 简介 Kafka 的特性 Kafka 系统架构 Partation 数据路由规则: 分区的原因 部署 kafka 集群 1.下载安装包 2.安装 Kafka 修改配…

B072-项目实战-用户模块--前台登录 三方登录

目录 前台登录-账号登录前端完成左上角显示用户信息配置前置拦截器、后置拦截器和不受限资源拦截器 三方登录-微信登录概述流程图用法代码实现步骤分析:实现准备代码前端login.htmlcallback.html 后端LoginController-微信登录LoginServiceImpl-微信登录解决回调域名不能跨域绑…

安达发|某大厂使用APS计划排程真实成功案例

在很多群里、朋友圈、公众号上可以看到,很多精益咨询老师认为,不仅ERP不啥用,APS更是无聊之举,而且肯定是用不好的。但,事实上可能还真不是这样的。 一个深圳的客户,用了APS以后,不仅装配的齐套…

桥梁监测需要哪些设备?

随着我国经济的发展,我国桥梁建设也迈上了新的台阶。截至2022年底,我国的公路桥梁总数达到了103.32万座。然而,随着在役桥梁使用时间的增长,承载能力受到荷载、环境以及结构退化等因素的影响,桥梁安全问题日益凸显。桥…

vue3和gin框架实现简单的断点续传

vue3和gin框架实现简单的断点续传 前端代码 Test.vue <template><div><inputtype"file"ref"uploadRef"change"upload"multiple/><templatev-for"item in fileList":key"item.key"><br><…

spring复习:(39)注解方式的ProxyFactoryBean

一、定义接口 package cn.edu.tju.study.service;public interface MyService {void myMethod(); }二、定义实现类&#xff1a; package cn.edu.tju.study.service;public class MyServiceImpl implements MyService{Overridepublic void myMethod() {System.out.println(&qu…

Redis 读写分离 使用redisTemplate执行lua脚本时,报错处理

项目框架说明 项目配置 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.5.4</version></parent>....<dependency><groupId>org.springfra…

(学习笔记-TCP基础知识)TCP与UDP区别

UDP UDP不提供复杂的控制机制&#xff0c;利用IP提供面向[无连接]的通信服务。 UDP协议非常简单&#xff0c;头部只有8个字节(位)&#xff0c;UDP的头部格式如下&#xff1a; 目标和源端口&#xff1a;主要是告诉UDP协议应该把报文发给哪个进程包长度&#xff1a;该字段保存了…

TinyKv流程梳理三

split流程 处理协程启动 func (bs *Raftstore) startWorkers(peers []*peer) {ctx : bs.ctxworkers : bs.workersrouter : bs.routerbs.wg.Add(2) // raftWorker, storeWorkerrw : newRaftWorker(ctx, router)go rw.run(bs.closeCh, bs.wg)sw : newStoreWorker(ctx, bs.store…

基于Web API drap事件的简单拖拽功能

基于Web API drap事件的简单拖拽功能 效果示例图代码示例 效果示例图 代码示例 <!DOCTYPE html> <html><head><meta charset"utf-8"><title></title><style type"text/css">* {padding: 0px;margin: 0px;box-s…

uniapp动态获取列表中每个下标的高度赋值给另一个数组(完整代码附效果图)

uniapp实现动态获取列表中每个下标的高度&#xff0c;赋值给另一个数组。 先看效果图&#xff1a; 完整代码&#xff1a; <template><div class""><div class"">我是A列表&#xff0c;我的高度不是固定的</div><div class&qu…