本文是pytorch常用代码段合集,涵盖基本配置、张量处理、模型定义与操作、数据处理、模型训练与测试等5个方面,还给出了多个值得注意的tips,内容非常全面。
pytorch最好的资料是官方文档。本文是pytorch常用代码段,在参考资料[1](张皓:pytorch cookbook)的基础上做了一些修补,方便使用时查阅。
基本配置
导入包和版本查询
import torchimport torch.nn as nnimport torchvisionprint(torch.__version__)print(torch.version.cuda)print(torch.backends.cudnn.version())print(torch.cuda.get_device_name(0)) 可复现性
在硬件设备(cpu、gpu)不同时,完全的可复现性无法保证,即使随机种子相同。但是,在同一个设备上,应该保证可复现性。具体做法是,在程序开始的时候固定torch的随机种子,同时也把numpy的随机种子固定。
np.random.seed(0)torch.manual_seed(0)torch.cuda.manual_seed_all(0)torch.backends.cudnn.deterministic = truetorch.backends.cudnn.benchmark = false 显卡设置
如果只需要一张显卡
# device configurationdevice = torch.device('cuda' if torch.cuda.is_available() else 'cpu') 如果需要指定多张显卡,比如0,1号显卡。
import osos.environ['cuda_visible_devices'] = '0,1'
也可以在命令行运行代码时设置显卡:
cuda_visible_devices=0,1 python train.py
清除显存
torch.cuda.empty_cache()
也可以使用在命令行重置gpu的指令
nvidia-smi --gpu-reset -i [gpu_id]
张量(tensor)处理
张量的数据类型
pytorch有9种cpu张量类型和9种gpu张量类型。
张量基本信息
tensor = torch.randn(3,4,5)print(tensor.type()) # 数据类型print(tensor.size()) # 张量的shape,是个元组print(tensor.dim()) # 维度的数量
命名张量
张量命名是一个非常有用的方法,这样可以方便地使用维度的名字来做索引或其他操作,大大提高了可读性、易用性,防止出错。
# 在pytorch 1.3之前,需要使用注释# tensor[n, c, h, w]images = torch.randn(32, 3, 56, 56)images.sum(dim=1)images.select(dim=1, index=0)# pytorch 1.3之后nchw = [‘n’, ‘c’, ‘h’, ‘w’]images = torch.randn(32, 3, 56, 56, names=nchw)images.sum('c')images.select('c', index=0)# 也可以这么设置tensor = torch.rand(3,4,1,2,names=('c', 'n', 'h', 'w'))# 使用align_to可以对维度方便地排序tensor = tensor.align_to('n', 'c', 'h', 'w') 数据类型转换
# 设置默认类型,pytorch中的floattensor远远快于doubletensortorch.set_default_tensor_type(torch.floattensor)# 类型转换tensor = tensor.cuda()tensor = tensor.cpu()tensor = tensor.float()tensor = tensor.long() torch.tensor与np.ndarray转换
除了chartensor,其他所有cpu上的张量都支持转换为numpy格式然后再转换回来。
ndarray = tensor.cpu().numpy()tensor = torch.from_numpy(ndarray).float()tensor = torch.from_numpy(ndarray.copy()).float() # if ndarray has negative stride. torch.tensor与pil.image转换
# pytorch中的张量默认采用[n, c, h, w]的顺序,并且数据范围在[0,1],需要进行转置和规范化# torch.tensor -> pil.imageimage = pil.image.fromarray(torch.clamp(tensor*255, min=0, max=255).byte().permute(1,2,0).cpu().numpy())image = torchvision.transforms.functional.to_pil_image(tensor) # equivalently way# pil.image -> torch.tensorpath = r'./figure.jpg'tensor = torch.from_numpy(np.asarray(pil.image.open(path))).permute(2,0,1).float() / 255tensor = torchvision.transforms.functional.to_tensor(pil.image.open(path)) # equivalently way np.ndarray与pil.image的转换
image = pil.image.fromarray(ndarray.astype(np.uint8))ndarray = np.asarray(pil.image.open(path)) 从只包含一个元素的张量中提取值
value = torch.rand(1).item()
张量形变
# 在将卷积层输入全连接层的情况下通常需要对张量做形变处理,# 相比torch.view,torch.reshape可以自动处理输入张量不连续的情况tensor = torch.rand(2,3,4)shape = (6, 4)tensor = torch.reshape(tensor, shape) 打乱顺序
tensor = tensor[torch.randperm(tensor.size(0))] # 打乱第一个维度
水平翻转
# pytorch不支持tensor[::-1]这样的负步长操作,水平翻转可以通过张量索引实现# 假设张量的维度为[n, d, h, w].tensor = tensor[:,:,:,torch.arange(tensor.size(3) - 1, -1, -1).long()] 复制张量
# operation | new/shared memory | still in computation graph |tensor.clone() # | new | yes |tensor.detach() # | shared | no |tensor.detach.clone()() # | new | no | 张量拼接
'''注意torch.cat和torch.stack的区别在于torch.cat沿着给定的维度拼接,而torch.stack会新增一维。例如当参数是3个10x5的张量,torch.cat的结果是30x5的张量,而torch.stack的结果是3x10x5的张量。'''tensor = torch.cat(list_of_tensors, dim=0)tensor = torch.stack(list_of_tensors, dim=0) 将整数标签转为one-hot编码
# pytorch的标记默认从0开始tensor = torch.tensor([0, 2, 1, 3])n = tensor.size(0)num_classes = 4one_hot = torch.zeros(n, num_classes).long()one_hot.scatter_(dim=1, index=torch.unsqueeze(tensor, dim=1), src=torch.ones(n, num_classes).long()) 得到非零元素
torch.nonzero(tensor) # index of non-zero elementstorch.nonzero(tensor==0) # index of zero elementstorch.nonzero(tensor).size(0) # number of non-zero elementstorch.nonzero(tensor == 0).size(0) # number of zero elements 判断两个张量相等
torch.allclose(tensor1, tensor2) # float tensortorch.equal(tensor1, tensor2) # int tensor 张量扩展
# expand tensor of shape 64*512 to shape 64*512*7*7.tensor = torch.rand(64,512)torch.reshape(tensor, (64, 512, 1, 1)).expand(64, 512, 7, 7) 矩阵乘法
# matrix multiplcation: (m*n) * (n*p) * -> (m*p).result = torch.mm(tensor1, tensor2)# batch matrix multiplication: (b*m*n) * (b*n*p) -> (b*m*p)result = torch.bmm(tensor1, tensor2)# element-wise multiplication.result = tensor1 * tensor2 计算两组数据之间的两两欧式距离
利用广播机制
dist = torch.sqrt(torch.sum((x1[:,none,:] - x2) ** 2, dim=2))
模型定义和操作
一个简单两层卷积网络的示例
# convolutional neural network (2 convolutional layers)
class convnet(nn.module): def __init__(self, num_classes=10): super(convnet, self).__init__() self.layer1 = nn.sequential( nn.conv2d(1, 16, kernel_size=5, stride=1, padding=2), nn.batchnorm2d(16), nn.relu(), nn.maxpool2d(kernel_size=2, stride=2)) self.layer2 = nn.sequential( nn.conv2d(16, 32, kernel_size=5, stride=1, padding=2), nn.batchnorm2d(32), nn.relu(), nn.maxpool2d(kernel_size=2, stride=2)) self.fc = nn.linear(7*7*32, num_classes) def forward(self, x): out = self.layer1(x) out = self.layer2(out) out = out.reshape(out.size(0), -1) out = self.fc(out) return outmodel = convnet(num_classes).to(device) 卷积层的计算和展示可以用这个网站辅助。
双线性汇合(bilinear pooling)
x = torch.reshape(n, d, h * w) # assume x has shape n*d*h*wx = torch.bmm(x, torch.transpose(x, 1, 2)) / (h * w) # bilinear poolingassert x.size() == (n, d, d)x = torch.reshape(x, (n, d * d))x = torch.sign(x) * torch.sqrt(torch.abs(x) + 1e-5) # signed-sqrt normalizationx = torch.nn.functional.normalize(x) # l2 normalization 多卡同步 bn(batch normalization)
当使用 torch.nn.dataparallel 将代码运行在多张 gpu 卡上时,pytorch 的 bn 层默认操作是各卡上数据独立地计算均值和标准差,同步 bn 使用所有卡上的数据一起计算 bn 层的均值和标准差,缓解了当批量大小(batch size)比较小时对均值和标准差估计不准的情况,是在目标检测等任务中一个有效的提升性能的技巧。
sync_bn = torch.nn.syncbatchnorm(num_features,
eps=1e-05, momentum=0.1, affine=true, track_running_stats=true) 将已有网络的所有bn层改为同步bn层
def convertbntosyncbn(module, process_group=none):
'''recursively replace all bn layers to syncbn layer. args: module[torch.nn.module]. network ''' if isinstance(module, torch.nn.modules.batchnorm._batchnorm): sync_bn = torch.nn.syncbatchnorm(module.num_features, module.eps, module.momentum, module.affine, module.track_running_stats, process_group) sync_bn.running_mean = module.running_mean sync_bn.running_var = module.running_var if module.affine: sync_bn.weight = module.weight.clone().detach() sync_bn.bias = module.bias.clone().detach() return sync_bn else: for name, child_module in module.named_children(): setattr(module, name) = convert_syncbn_model(child_module, process_group=process_group)) return module 类似 bn 滑动平均
如果要实现类似 bn 滑动平均的操作,在 forward 函数中要使用原地(inplace)操作给滑动平均赋值。
class bn(torch.nn.module)
def __init__(self): ... self.register_buffer('running_mean', torch.zeros(num_features)) def forward(self, x): ... self.running_mean += momentum * (current - self.running_mean)
计算模型整体参数量
num_parameters = sum(torch.numel(parameter) for parameter in model.parameters())
查看网络中的参数
可以通过model.state_dict()或者model.named_parameters()函数查看现在的全部可训练参数(包括通过继承得到的父类中的参数)
params = list(model.named_parameters())(name, param) = params[28]print(name)print(param.grad)print('-------------------------------------------------')(name2, param2) = params[29]print(name2)print(param2.grad)print('----------------------------------------------------')(name1, param1) = params[30]print(name1)print(param1.grad)
模型可视化(使用pytorchviz)
szagoruyko/pytorchvizgithub.com
类似 keras 的 model.summary() 输出模型信息,使用pytorch-summary
sksq96/pytorch-summarygithub.com
模型权重初始化
注意 model.modules() 和 model.children() 的区别:model.modules() 会迭代地遍历模型的所有子层,而 model.children() 只会遍历模型下的一层。
# common practise for initialization.for layer in model.modules(): if isinstance(layer, torch.nn.conv2d): torch.nn.init.kaiming_normal_(layer.weight, mode='fan_out', nonlinearity='relu') if layer.bias is not none: torch.nn.init.constant_(layer.bias, val=0.0) elif isinstance(layer, torch.nn.batchnorm2d): torch.nn.init.constant_(layer.weight, val=1.0) torch.nn.init.constant_(layer.bias, val=0.0) elif isinstance(layer, torch.nn.linear): torch.nn.init.xavier_normal_(layer.weight) if layer.bias is not none: torch.nn.init.constant_(layer.bias, val=0.0)# initialization with given tensor.layer.weight = torch.nn.parameter(tensor)
提取模型中的某一层
modules()会返回模型中所有模块的迭代器,它能够访问到最内层,比如self.layer1.conv1这个模块,还有一个与它们相对应的是name_children()属性以及named_modules(),这两个不仅会返回模块的迭代器,还会返回网络层的名字。
# 取模型中的前两层new_model = nn.sequential(*list(model.children())[:2] # 如果希望提取出模型中的所有卷积层,可以像下面这样操作:for layer in model.named_modules(): if isinstance(layer[1],nn.conv2d): conv_model.add_module(layer[0],layer[1])
部分层使用预训练模型
注意如果保存的模型是 torch.nn.dataparallel,则当前的模型也需要是
model.load_state_dict(torch.load('model.pth'), strict=false)
将在 gpu 保存的模型加载到 cpu
model.load_state_dict(torch.load('model.pth', map_location='cpu'))
导入另一个模型的相同部分到新的模型
模型导入参数时,如果两个模型结构不一致,则直接导入参数会报错。用下面方法可以把另一个模型的相同的部分导入到新的模型中。
# model_new代表新的模型# model_saved代表其他模型,比如用torch.load导入的已保存的模型model_new_dict = model_new.state_dict()model_common_dict = {k:v for k, v in model_saved.items() if k in model_new_dict.keys()}model_new_dict.update(model_common_dict)model_new.load_state_dict(model_new_dict)
数据处理
计算数据集的均值和标准差
import osimport cv2import numpy as npfrom torch.utils.data import datasetfrom pil import imagedef compute_mean_and_std(dataset): # 输入pytorch的dataset,输出均值和标准差 mean_r = 0 mean_g = 0 mean_b = 0 for img, _ in dataset: img = np.asarray(img) # change pil image to numpy array mean_b += np.mean(img[:, :, 0]) mean_g += np.mean(img[:, :, 1]) mean_r += np.mean(img[:, :, 2]) mean_b /= len(dataset) mean_g /= len(dataset) mean_r /= len(dataset) diff_r = 0 diff_g = 0 diff_b = 0 n = 0 for img, _ in dataset: img = np.asarray(img) diff_b += np.sum(np.power(img[:, :, 0] - mean_b, 2)) diff_g += np.sum(np.power(img[:, :, 1] - mean_g, 2)) diff_r += np.sum(np.power(img[:, :, 2] - mean_r, 2)) n += np.prod(img[:, :, 0].shape) std_b = np.sqrt(diff_b / n) std_g = np.sqrt(diff_g / n) std_r = np.sqrt(diff_r / n) mean = (mean_b.item() / 255.0, mean_g.item() / 255.0, mean_r.item() / 255.0) std = (std_b.item() / 255.0, std_g.item() / 255.0, std_r.item() / 255.0) return mean, std
得到视频数据基本信息
import cv2video = cv2.videocapture(mp4_path)height = int(video.get(cv2.cap_prop_frame_height))width = int(video.get(cv2.cap_prop_frame_width))num_frames = int(video.get(cv2.cap_prop_frame_count))fps = int(video.get(cv2.cap_prop_fps))video.release()
tsn 每段(segment)采样一帧视频
k = self._num_segmentsif is_train: if num_frames > k: # random index for each segment. frame_indices = torch.randint( high=num_frames // k, size=(k,), dtype=torch.long) frame_indices += num_frames // k * torch.arange(k) else: frame_indices = torch.randint( high=num_frames, size=(k - num_frames,), dtype=torch.long) frame_indices = torch.sort(torch.cat(( torch.arange(num_frames), frame_indices)))[0]else: if num_frames > k: # middle index for each segment. frame_indices = num_frames / k // 2 frame_indices += num_frames // k * torch.arange(k) else: frame_indices = torch.sort(torch.cat(( torch.arange(num_frames), torch.arange(k - num_frames))))[0]assert frame_indices.size() == (k,)return [frame_indices[i] for i in range(k)]
常用训练和验证数据预处理
其中 totensor 操作会将 pil.image 或形状为 h×w×d,数值范围为 [0, 255] 的 np.ndarray 转换为形状为 d×h×w,数值范围为 [0.0, 1.0] 的 torch.tensor。
train_transform = torchvision.transforms.compose([ torchvision.transforms.randomresizedcrop(size=224, scale=(0.08, 1.0)), torchvision.transforms.randomhorizontalflip(), torchvision.transforms.totensor(), torchvision.transforms.normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)), ]) val_transform = torchvision.transforms.compose([ torchvision.transforms.resize(256), torchvision.transforms.centercrop(224), torchvision.transforms.totensor(), torchvision.transforms.normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),])
模型训练和测试
分类模型训练代码
# loss and optimizercriterion = nn.crossentropyloss()optimizer = torch.optim.adam(model.parameters(), lr=learning_rate)# train the modeltotal_step = len(train_loader)for epoch in range(num_epochs): for i ,(images, labels) in enumerate(train_loader): images = images.to(device) labels = labels.to(device) # forward pass outputs = model(images) loss = criterion(outputs, labels) # backward and optimizer optimizer.zero_grad() loss.backward() optimizer.step() if (i+1) % 100 == 0: print('epoch: [{}/{}], step: [{}/{}], loss: {}' .format(epoch+1, num_epochs, i+1, total_step, loss.item()))
分类模型测试代码
# test the modelmodel.eval() # eval mode(batch norm uses moving mean/variance #instead of mini-batch mean/variance)with torch.no_grad(): correct = 0 total = 0 for images, labels in test_loader: images = images.to(device) labels = labels.to(device) outputs = model(images) _, predicted = torch.max(outputs.data, 1) total += labels.size(0) correct += (predicted == labels).sum().item() print('test accuracy of the model on the 10000 test images: {} %' .format(100 * correct / total))
自定义loss
继承torch.nn.module类写自己的loss。
class myloss(torch.nn.moudle): def __init__(self): super(myloss, self).__init__() def forward(self, x, y): loss = torch.mean((x - y) ** 2) return loss
标签平滑(label smoothing)
写一个label_smoothing.py的文件,然后在训练代码里引用,用lsr代替交叉熵损失即可。label_smoothing.py内容如下:
import torchimport torch.nn as nnclass lsr(nn.module): def __init__(self, e=0.1, reduction='mean'): super().__init__() self.log_softmax = nn.logsoftmax(dim=1) self.e = e self.reduction = reduction def _one_hot(self, labels, classes, value=1): convert labels to one hot vectors args: labels: torch tensor in format [label1, label2, label3, ...] classes: int, number of classes value: label value in one hot vector, default to 1 returns: return one hot format labels in shape [batchsize, classes] one_hot = torch.zeros(labels.size(0), classes) #labels and value_added size must match labels = labels.view(labels.size(0), -1) value_added = torch.tensor(labels.size(0), 1).fill_(value) value_added = value_added.to(labels.device) one_hot = one_hot.to(labels.device) one_hot.scatter_add_(1, labels, value_added) return one_hot def _smooth_label(self, target, length, smooth_factor): convert targets to one-hot format, and smooth them. args: target: target in form with [label1, label2, label_batchsize] length: length of one-hot format(number of classes) smooth_factor: smooth factor for label smooth returns: smoothed labels in one hot format one_hot = self._one_hot(target, length, value=1 - smooth_factor) one_hot += smooth_factor / (length - 1) return one_hot.to(target.device) def forward(self, x, target): if x.size(0) != target.size(0): raise valueerror('expected input batchsize ({}) to match target batch_size({})' .format(x.size(0), target.size(0))) if x.dim() best_acc best_acc = max(current_acc, best_acc) checkpoint = { 'best_acc': best_acc, 'epoch': epoch + 1, 'model': model.state_dict(), 'optimizer': optimizer.state_dict(), } model_path = os.path.join('model', 'checkpoint.pth.tar') best_model_path = os.path.join('model', 'best_checkpoint.pth.tar') torch.save(checkpoint, model_path) if is_best: shutil.copy(model_path, best_model_path)
提取 imagenet 预训练模型某层的卷积特征
# vgg-16 relu5-3 feature.model = torchvision.models.vgg16(pretrained=true).features[:-1]# vgg-16 pool5 feature.model = torchvision.models.vgg16(pretrained=true).features# vgg-16 fc7 feature.model = torchvision.models.vgg16(pretrained=true)model.classifier = torch.nn.sequential(*list(model.classifier.children())[:-3])# resnet gap feature.model = torchvision.models.resnet18(pretrained=true)model = torch.nn.sequential(collections.ordereddict( list(model.named_children())[:-1]))with torch.no_grad(): model.eval() conv_representation = model(image)
提取 imagenet 预训练模型多层的卷积特征
class featureextractor(torch.nn.module): helper class to extract several convolution features from the given pre-trained model. attributes: _model, torch.nn.module. _layers_to_extract, list or set example: >>> model = torchvision.models.resnet152(pretrained=true) >>> model = torch.nn.sequential(collections.ordereddict( list(model.named_children())[:-1])) >>> conv_representation = featureextractor( pretrained_model=model, layers_to_extract={'layer1', 'layer2', 'layer3', 'layer4'})(image) def __init__(self, pretrained_model, layers_to_extract): torch.nn.module.__init__(self) self._model = pretrained_model self._model.eval() self._layers_to_extract = set(layers_to_extract) def forward(self, x): with torch.no_grad(): conv_representation = [] for name, layer in self._model.named_children(): x = layer(x) if name in self._layers_to_extract: conv_representation.append(x) return conv_representation 微调全连接层
model = torchvision.models.resnet18(pretrained=true)for param in model.parameters(): param.requires_grad = falsemodel.fc = nn.linear(512, 100) # replace the last fc layeroptimizer = torch.optim.sgd(model.fc.parameters(), lr=1e-2, momentum=0.9, weight_decay=1e-4)
以较大学习率微调全连接层,较小学习率微调卷积层
model = torchvision.models.resnet18(pretrained=true)finetuned_parameters = list(map(id, model.fc.parameters()))conv_parameters = (p for p in model.parameters() if id(p) not in finetuned_parameters)parameters = [{'params': conv_parameters, 'lr': 1e-3}, {'params': model.fc.parameters()}]optimizer = torch.optim.sgd(parameters, lr=1e-2, momentum=0.9, weight_decay=1e-4)
其他注意事项
不要使用太大的线性层。因为nn.linear(m,n)使用的是的内存,线性层太大很容易超出现有显存。
不要在太长的序列上使用rnn。因为rnn反向传播使用的是bptt算法,其需要的内存和输入序列的长度呈线性关系。
model(x) 前用 model.train() 和 model.eval() 切换网络状态。
不需要计算梯度的代码块用 with torch.no_grad() 包含起来。
model.eval() 和 torch.no_grad() 的区别在于,model.eval() 是将网络切换为测试状态,例如 bn 和dropout在训练和测试阶段使用不同的计算方法。torch.no_grad() 是关闭 pytorch 张量的自动求导机制,以减少存储使用和加速计算,得到的结果无法进行 loss.backward()。
model.zero_grad()会把整个模型的参数的梯度都归零, 而optimizer.zero_grad()只会把传入其中的参数的梯度归零.
torch.nn.crossentropyloss 的输入不需要经过 softmax。torch.nn.crossentropyloss 等价于 torch.nn.functional.log_softmax + torch.nn.nllloss。
loss.backward() 前用 optimizer.zero_grad() 清除累积梯度。
torch.utils.data.dataloader 中尽量设置 pin_memory=true,对特别小的数据集如 mnist 设置 pin_memory=false 反而更快一些。num_workers 的设置需要在实验中找到最快的取值。
用 del 及时删除不用的中间变量,节约 gpu 存储。使用 inplace 操作可节约 gpu 存储,如:
x = torch.nn.functional.relu(x, inplace=true)
减少 cpu 和 gpu 之间的数据传输。例如如果你想知道一个 epoch 中每个 mini-batch 的 loss 和准确率,先将它们累积在 gpu 中等一个 epoch 结束之后一起传输回 cpu 会比每个 mini-batch 都进行一次 gpu 到 cpu 的传输更快。
使用半精度浮点数 half() 会有一定的速度提升,具体效率依赖于 gpu 型号。需要小心数值精度过低带来的稳定性问题。
时常使用 assert tensor.size() == (n, d, h, w) 作为调试手段,确保张量维度和你设想中一致。
除了标记 y 外,尽量少使用一维张量,使用 n*1 的二维张量代替,可以避免一些意想不到的一维张量计算结果。
统计代码各部分耗时:
with torch.autograd.profiler.profile(enabled=true, use_cuda=false) as profile:
...print(profile)# 或者在命令行运行python -m torch.utils.bottleneck main.py 使用torchsnooper来调试pytorch代码,程序在执行的时候,就会自动 print 出来每一行的执行结果的 tensor 的形状、数据类型、设备、是否需要梯度的信息。
# pip install torchsnooperimport torchsnooper# 对于函数,使用修饰器@torchsnooper.snoop()# 如果不是函数,使用 with 语句来激活 torchsnooper,把训练的那个循环装进 with 语句中去。with torchsnooper.snoop(): 原本的代码 https://github.com/zasdfgbnm/torchsnoopergithub.com
模型可解释性,使用captum库:https://captum.ai/captum.ai
高通正扩展 LTE 至未授权频谱(LTE-U)并宣布完成空中(OTA)测试
苹果的iPadOS是桌面计算的最终版本吗
燃气轮机的原理及结构技术
这种电池会出汗
浅谈双摄变焦:vivoXplay6拍照对比和华为Mate9、iPhone7Plus
PyTorch常用代码段合集资料分享
设计师迈克尔·穆莱巴展示了iPhone 9c的概念设计
2021跑步耳机推荐——跑步运动耳机哪个好一些
智能化、网络化、数字化成工控机显著特征
智能工业的“焦虑”与智能工业的“落地”
随着技术不断进步 电动汽车的续航能力也在不断提升
汽车车身的结构和原理详细介绍
阿里巴巴将通过飞猪 为酒店客房的自助入住提供人脸识别技术
AI辅助编程工具给开发者带来好处了吗?
华为将在研发领域持续强力投资,推动创新升级
与非门电路讲解(电路图+工作原理)
NASA时隔30年后启动DAVINCI+任务和VERITAS任务
10年后,微软市值再次超越苹果
cpu的缓存作用和工作原理是什么?cpu温度多少正常,温度过高怎么办
你为什么会抗拒物联网?