【PyTorch】Neural Network 神经网络

news2024/10/6 4:02:35

文章目录

  • 四、Neural Network 神经网络
    • 1、Containers - Module
    • 2、Convolution Layers - functional.conv2d
      • 2.1 stride
      • 2.2 padding
    • 3、Convolution Layers - Conv2d
      • 3.1 in_channels out_channels
    • 4、Pooling layers - MaxPool2d
      • 4.1 ceil_mode
      • 4.2 TensorBoard
    • 5、Non-linear Activations
      • 5.1 ReLU
      • 5.2 Sigmoid
    • 6、Linear Layers - Linear
      • 6.1 flatten
    • 7、CIFAR 10 Model and Sequential
    • 8、Loss Functions
      • 8.1 L1Loss
      • 8.2 MSELoss
      • 8.3 CrossEntropyLoss
      • 8.4 Sequential
      • 8.5 backward

四、Neural Network 神经网络

参考文档:https://pytorch.org/docs/stable/nn.html

1、Containers - Module

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module

import torch
from torch import nn

class Tudui(nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, input):
        output = input + 1
        return output


tudui = Tudui()
x = torch.tensor(1.0)
output = tudui(x)
print(output)
tensor(2.)

2、Convolution Layers - functional.conv2d

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.functional.conv2d.html#torch.nn.functional.conv2d

2.1 stride

import torch
import torch.nn.functional as F

input = torch.tensor([
    [1, 2, 0, 3, 1],
    [0, 1, 2, 3, 1],
    [1, 2, 1, 0, 0],
    [5, 2, 3, 1, 1],
    [2, 1, 0, 1, 1]
])

kernel = torch.tensor([
    [1, 2, 1],
    [0, 1, 0],
    [2, 1, 0]
])

input = torch.reshape(input, (1, 1, 5, 5))  # torch.Size([1, 1, 5, 5])
kernel = torch.reshape(kernel, (1, 1, 3, 3))  # torch.Size([1, 1, 3, 3])

output1 = F.conv2d(input, kernel, stride=1)
print(output1)

output2 = F.conv2d(input, kernel, stride=2)
print(output2)
tensor([[[[10, 12, 12],
          [18, 16, 16],
          [13,  9,  3]]]])
tensor([[[[10, 12],
          [13,  3]]]])

2.2 padding

import torch
import torch.nn.functional as F

input = torch.tensor([
    [1, 2, 0, 3, 1],
    [0, 1, 2, 3, 1],
    [1, 2, 1, 0, 0],
    [5, 2, 3, 1, 1],
    [2, 1, 0, 1, 1]
])

kernel = torch.tensor([
    [1, 2, 1],
    [0, 1, 0],
    [2, 1, 0]
])

input = torch.reshape(input, (1, 1, 5, 5))  # torch.Size([1, 1, 5, 5])
kernel = torch.reshape(kernel, (1, 1, 3, 3))  # torch.Size([1, 1, 3, 3])

output1 = F.conv2d(input, kernel, stride=1, padding=1)
print(output1)

output2 = F.conv2d(input, kernel, stride=2, padding=1)
print(output2)
tensor([[[[ 1,  3,  4, 10,  8],
          [ 5, 10, 12, 12,  6],
          [ 7, 18, 16, 16,  8],
          [11, 13,  9,  3,  4],
          [14, 13,  9,  7,  4]]]])
tensor([[[[ 1,  4,  8],
          [ 7, 16,  8],
          [14,  9,  4]]]])

3、Convolution Layers - Conv2d

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d

动画实现:https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md

3.1 in_channels out_channels

import torchvision
from torch import nn
from torch.nn import Conv2d
from torch.utils.data import DataLoader

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=64)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.conv1 = Conv2d(in_channels=3, out_channels=6, kernel_size=3, stride=1, padding=0)

    def forward(self, x):
        x = self.conv1(x)
        return x


tudui = Tudui()

for data in dataloader:
    imgs, targets = data
    output = tudui(imgs)
    print(imgs.shape)
    print(output.shape)
Files already downloaded and verified
torch.Size([64, 3, 32, 32]) # in_channels=3
torch.Size([64, 6, 30, 30]) # out_channels=6 卷积之后 32 -> 30
...

TensorBoard展示:

import torch
import torchvision
from torch import nn
from torch.nn import Conv2d
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=64)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.conv1 = Conv2d(in_channels=3, out_channels=6, kernel_size=3, stride=1, padding=0)

    def forward(self, x):
        x = self.conv1(x)
        return x


tudui = Tudui()

writer = SummaryWriter("logs")

step = 0
for data in dataloader:
    imgs, targets = data
    output = tudui(imgs)
    print(imgs.shape)  # torch.Size([64, 3, 32, 32])
    print(output.shape)  # torch.Size([64, 6, 30, 30])

    writer.add_images("input", imgs, step)

    output = torch.reshape(output, (-1, 3, 30, 30))  # -> [xxx, 3, 30, 30]
    writer.add_images("output", output, step)

    print(output.shape)  # torch.Size([128, 3, 30, 30])

    step += 1

writer.close()

4、Pooling layers - MaxPool2d

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html#torch.nn.MaxPool2d

4.1 ceil_mode

import torch
from torch import nn
from torch.nn import MaxPool2d

input = torch.Tensor([
    [1, 2, 0, 3, 1],
    [0, 1, 2, 3, 1],
    [1, 2, 1, 0, 0],
    [5, 2, 3, 1, 1],
    [2, 1, 0, 1, 1],
])

input = torch.reshape(input, (-1, 1, 5, 5))  # torch.Size([1, 1, 5, 5])


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.maxpool1 = MaxPool2d(kernel_size=3, ceil_mode=True)

    def forward(self, input):
        output = self.maxpool1(input)
        return output


tudui = Tudui()
output = tudui(input)
print(output)
tensor([[[[2., 3.],
          [5., 1.]]]])

4.2 TensorBoard

import torchvision
from torch import nn
from torch.nn import MaxPool2d
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=64)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.maxpool1 = MaxPool2d(kernel_size=3, ceil_mode=False)

    def forward(self, input):
        output = self.maxpool1(input)
        return output


tudui = Tudui()

writer = SummaryWriter("../logs")
step = 0
for data in dataloader:
    imgs, targets = data
    writer.add_images("input", imgs, step)
    output = tudui(imgs)
    writer.add_images("output", output, step)
    step += 1

writer.close()

5、Non-linear Activations

5.1 ReLU

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.ReLU.html#torch.nn.ReLU

inplace说明:

①input = -1 – ReLU(input, inplace = True) – input = 0

②input = -1 – output = ReLU(input, inplace = True) – input = -1 output = 0

import torch
from torch import nn
from torch.nn import ReLU

input = torch.Tensor([[1, -0.5], [-1, 3]])  # torch.Size([2, 2])

input = torch.reshape(input, (-1, 1, 2, 2))  # torch.Size([1, 1, 2, 2])


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.relu1 = ReLU()

    def forward(self, input):
        output = self.relu1(input)
        return output


tudui = Tudui()
output = tudui(input)
print(output)  # torch.Size([1, 1, 2, 2])
tensor([[[[1., 0.],
          [0., 3.]]]])

5.2 Sigmoid

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.Sigmoid.html#torch.nn.Sigmoid

import torchvision
from torch import nn
from torch.nn import ReLU, Sigmoid
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)
dataloader = DataLoader(dataset, batch_size=64)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.sigmoid1 = Sigmoid()

    def forward(self, input):
        output = self.sigmoid1(input)
        return output


tudui = Tudui()

writer = SummaryWriter("../logs")

step = 0
for data in dataloader:
    imgs, targets = data
    writer.add_images("input", imgs, global_step=step)
    output = tudui(imgs)
    writer.add_images("output", output, global_step=step)
    step += 1

writer.close()

6、Linear Layers - Linear

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.Linear.html#torch.nn.Linear

import torch
import torchvision
from torch import nn
from torch.nn import Linear
from torch.utils.data import DataLoader

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)
dataloader = DataLoader(dataset, batch_size=64)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.liner1 = Linear(in_features=196608, out_features=10)

    def forward(self, input):
        output = self.liner1(input)
        return output


tudui = Tudui()

for data in dataloader:
    imgs, targets = data
    print(imgs.shape)  # torch.Size([64, 3, 32, 32])

    output = torch.reshape(imgs, (1, 1, 1, -1))
    print(output.shape)  # torch.Size([1, 1, 1, 196608])
    
    output = tudui(output)
    print(output.shape)  # torch.Size([1, 1, 1, 10])
Files already downloaded and verified
torch.Size([64, 3, 32, 32])
torch.Size([1, 1, 1, 196608])
torch.Size([1, 1, 1, 10])
...

6.1 flatten

参考文档:https://pytorch.org/docs/stable/generated/torch.flatten.html?highlight=flatten#torch.flatten

output = torch.reshape(imgs, (1, 1, 1, -1))
print(output.shape)  # torch.Size([1, 1, 1, 196608])

改为

output = torch.flatten(imgs)
print(output.shape)  # torch.Size([196608]) output --> torch.Size([10])

7、CIFAR 10 Model and Sequential

CIFAR 10:https://www.cs.toronto.edu/~kriz/cifar.html

import torch
from torch import nn
from torch.nn import Conv2d, MaxPool2d, Flatten, Linear


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.conv1 = Conv2d(in_channels=3, out_channels=32, kernel_size=5, padding=2)
        self.maxpool1 = MaxPool2d(kernel_size=2)
        self.conv2 = Conv2d(in_channels=32, out_channels=32, kernel_size=5, padding=2)
        self.maxpool2 = MaxPool2d(kernel_size=2)
        self.conv3 = Conv2d(in_channels=32, out_channels=64, kernel_size=5, padding=2)
        self.maxpool3 = MaxPool2d(kernel_size=2)
        self.flatten = Flatten()
        self.linear1 = Linear(1024, 64)
        self.linear2 = Linear(64, 10)

    def forward(self, x):
        x = self.conv1(x)
        x = self.maxpool1(x)
        x = self.conv2(x)
        x = self.maxpool2(x)
        x = self.conv3(x)
        x = self.maxpool3(x)
        x = self.flatten(x)
        x = self.linear1(x)
        x = self.linear2(x)
        return x


tudui = Tudui()
print(tudui)
input = torch.ones((64, 3, 32, 32))
output = tudui(input)
print(output.shape)
Tudui(
  (conv1): Conv2d(3, 32, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
  (maxpool1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (conv2): Conv2d(32, 32, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
  (maxpool2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (conv3): Conv2d(32, 64, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
  (maxpool3): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (flatten): Flatten(start_dim=1, end_dim=-1)
  (linear1): Linear(in_features=1024, out_features=64, bias=True)
  (linear2): Linear(in_features=64, out_features=10, bias=True)
)
torch.Size([64, 10])

Sequential:https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html#torch.nn.Sequential

import torch
from torch import nn
from torch.nn import Conv2d, MaxPool2d, Flatten, Linear, Sequential
from torch.utils.tensorboard import SummaryWriter


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.model1 = Sequential(
            Conv2d(3, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 64, 5, padding=2),
            MaxPool2d(2),
            Flatten(),
            Linear(1024, 64),
            Linear(64, 10)
        )

    def forward(self, x):
        x = self.model1(x)
        return x


tudui = Tudui()
print(tudui)
input = torch.ones((64, 3, 32, 32))
output = tudui(input)
print(output.shape)

writer = SummaryWriter("../logs")
writer.add_graph(tudui, input)
writer.close()
Tudui(
  (model1): Sequential(
    (0): Conv2d(3, 32, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
    (1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (2): Conv2d(32, 32, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
    (3): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (4): Conv2d(32, 64, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
    (5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (6): Flatten(start_dim=1, end_dim=-1)
    (7): Linear(in_features=1024, out_features=64, bias=True)
    (8): Linear(in_features=64, out_features=10, bias=True)
  )
)
torch.Size([64, 10])

8、Loss Functions

8.1 L1Loss

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.L1Loss.html#torch.nn.L1Loss

import torch
from torch.nn import L1Loss

input = torch.tensor([1, 2, 3], dtype=torch.float32)  # torch.Size([3])
target = torch.tensor([1, 2, 5], dtype=torch.float32)  # torch.Size([3])

input = torch.reshape(input, (1, 1, 1, 3))  # torch.Size([1, 1, 1, 3])
target = torch.reshape(target, (1, 1, 1, 3))  # torch.Size([1, 1, 1, 3])

loss1 = L1Loss(reduction='mean')  # 默认为mean
result = loss1(input, target)
print(result)

loss2 = L1Loss(reduction='sum')  # sum
result = loss2(input, target)
print(result)
tensor(0.6667)
tensor(2.)

8.2 MSELoss

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html#torch.nn.MSELoss

import torch
from torch.nn import MSELoss

input = torch.tensor([1, 2, 3], dtype=torch.float32)
target = torch.tensor([1, 2, 5], dtype=torch.float32)

input = torch.reshape(input, (1, 1, 1, 3))
target = torch.reshape(target, (1, 1, 1, 3))

loss = MSELoss()
result = loss(input, target)
print(result)
tensor(1.3333)

8.3 CrossEntropyLoss

参考文档:https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss

计算公式:

import torch
from torch.nn import CrossEntropyLoss

input = torch.tensor([0.1, 0.2, 0.3])
target = torch.tensor([1])

input = torch.reshape(input, (1, 3))

cross = CrossEntropyLoss()
result = cross(input, target)
print(result)
tensor(1.1019)

8.4 Sequential

import torchvision
from torch import nn
from torch.nn import Sequential, Conv2d, MaxPool2d, Flatten, Linear
from torch.utils.data import DataLoader

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=1)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.model1 = Sequential(
            Conv2d(3, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 64, 5, padding=2),
            MaxPool2d(2),
            Flatten(),
            Linear(1024, 64),
            Linear(64, 10)
        )

    def forward(self, x):
        x = self.model1(x)
        return x


tudui = Tudui()

for data in dataloader:
    imgs, targets = data
    output = tudui(imgs)
    print(output)
    print(targets)
Files already downloaded and verified
tensor([[-0.0715,  0.0221, -0.0562, -0.0901,  0.0627, -0.0606,  0.0137,  0.0783,
         -0.0951, -0.1070]], grad_fn=<AddmmBackward0>)
tensor([3])
tensor([[-0.0715,  0.0304, -0.0729, -0.0767,  0.0554, -0.0834, -0.0089,  0.0624,
         -0.0777, -0.0848]], grad_fn=<AddmmBackward0>)
tensor([8])
...

加入Loss Functions:

import torchvision
from torch import nn
from torch.nn import Sequential, Conv2d, MaxPool2d, Flatten, Linear, CrossEntropyLoss
from torch.utils.data import DataLoader

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=1)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.model1 = Sequential(
            Conv2d(3, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 64, 5, padding=2),
            MaxPool2d(2),
            Flatten(),
            Linear(1024, 64),
            Linear(64, 10)
        )

    def forward(self, x):
        x = self.model1(x)
        return x


loss = CrossEntropyLoss()

tudui = Tudui()

for data in dataloader:
    imgs, targets = data
    output = tudui(imgs)
    result_loss = loss(output, targets)
    print(result_loss)
Files already downloaded and verified
tensor(2.3437, grad_fn=<NllLossBackward0>)
tensor(2.3600, grad_fn=<NllLossBackward0>)
tensor(2.3680, grad_fn=<NllLossBackward0>)
...

8.5 backward

import torchvision
from torch import nn
from torch.nn import Sequential, Conv2d, MaxPool2d, Flatten, Linear, CrossEntropyLoss
from torch.utils.data import DataLoader

dataset = torchvision.datasets.CIFAR10("../data", train=False, transform=torchvision.transforms.ToTensor(),
                                       download=True)

dataloader = DataLoader(dataset, batch_size=1)


class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.model1 = Sequential(
            Conv2d(3, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 32, 5, padding=2),
            MaxPool2d(2),
            Conv2d(32, 64, 5, padding=2),
            MaxPool2d(2),
            Flatten(),
            Linear(1024, 64),
            Linear(64, 10)
        )

    def forward(self, x):
        x = self.model1(x)
        return x


loss = CrossEntropyLoss()

tudui = Tudui()

for data in dataloader:
    imgs, targets = data
    output = tudui(imgs)
    result_loss = loss(output, targets)

    result_loss.backward()  # 反向传播
    print("OK")

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

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

相关文章

Eclipse启动SpringBoot无法读取application.properties或者application.yml文件内容

原因 eclipse配置源代码excludes过滤掉了application.properties或application.yml造成的 解决 2.1 右键项目&#xff0c;选Build Path --> Configure Build Path 2.2 找到 Source --> resources --> Excluded&#xff0c;点击Edit 2.3 点击Edit 2.4 将**改成Non…

【Java八股文总结】之多线程

文章目录Java多线程一、线程1、什么是线程&#xff1f;什么是进程&#xff1f;二者的区别1、给线程起别名的3种方式2、this关键字3、守护线程和用户线程4、并发和并行的区别&#xff1f;5、线程间通信的方式2、synchronized关键字补充&#xff1a;snchronized底层实现原理3、vo…

如何用FMEA方法排除架构隐患

FMEA介绍 定义 FMEA&#xff08;Failure mode and effects analysis&#xff0c;故障模式与影响分析&#xff09;又称为失效模式与后果分析、失效模式与效应分析、故障模式与后果分析等&#xff0c;本文采用“故障模式与影响分析” 历史 FMEA 最早是在美国军方开始应用的&a…

2022-11-20-使用BeatuifulSoup进行页面内容的获取

一、什么是DOM树 DOM树是一种结构&#xff0c;树是由DOM元素和属性节点组成的&#xff0c;DOM的本质是把html结构化成js可识别的树模型&#xff0c;有了树模型&#xff0c;就有了层级结构&#xff0c;层级结构是指的是元素和元素之间的关系父子、兄弟。 实例&#xff1a; 标题…

Java语法之多态

上次给大家分享了Java的继承&#xff0c;今天小编给大家分享面向对象三大特性的第三大特性&#xff0c;也就是多态&#xff0c;fighting~~ 目录 &#x1f388;一. 多态 &#x1f388;1.1多态的概念 &#x1f388;1.2多态的实现条件 &#x1f388;1.3向上转型和向下转型 &a…

HDFS 的 shell操作

文章目录前言一、基本语法二、创建目录三、上传moveFromLocal-copyFromLocal-put-appendToFile四、下载-copyToLocal-get五、HDFS直接操作-ls-cat-chgrp、-chmod、-chown-mkdir-cp-mv-tail-rmrm -r-du-setrep前言 HDFS的shell操作很多跟linux的shell语法是比较相近&#xff0c…

Python学习基础笔记八——字典

字典&#xff1a; 1&#xff09;字典中的元素是通过键来存储的&#xff0c;而不是通过偏移来存取的。字典是唯一内置的映射类型&#xff08;键映射到值的对象&#xff09; 2&#xff09;是无序集合&#xff1b; 3&#xff09;字典是作为散列表&#xff08;支持快速检索的数据…

html网页设计期末大作业_网页设计平时作业(诗词网页 4页)

⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材&#xff0c;DIVCSS 布局制作,HTMLCSS网页设计期末课程大作业 | 茶文化网站 | 中华传统文化题材 | 京剧文化水墨风书画 | 中国民间年画文化艺术网站 | 等网站的设计与制作 | HTML期末大学生网页设计作业&#xff0c;…

39-Docker-部署Jenkins

部署Jenkins前言部署Jenkins1. 下载镜像2. 创建挂载目录3. 创建并启动Jenkins容器使用Jenkins1. 访问Jenkins2. 输入密码3. 配置Jenkins前言 本篇来学习使用Jenkins镜像部署Jenkins 部署Jenkins 1. 下载镜像 docker pull jenkins/jenkins2. 创建挂载目录 # 创建挂载目录 m…

Oracle PrimaveraUnifier成本管理器(Cost Manager)简要介绍

目录 一&#xff1a;标准成本管理器(Standad Cost Manager) 二&#xff1a;通用成本管理器(General Cost Manager) 成本管理器(Cost Manager)是Unifier管理和聚焦汇总成本的主要组成部分&#xff0c;财务最关系的Cost Sheet 成本表将通过 成本管理器制定模板 在Oracle Pirma…

第三章:高精度算法(加、减、乘、除)

高精度算法高精度的整体思路&#xff1a;一、加法1、思路&#xff1a;2、模板&#xff1a;&#xff08;1&#xff09;C版&#xff1a;&#xff08;2&#xff09;C语言版&#xff1a;二、减法1、思路&#xff1a;2、模板&#xff1a;CC三、乘法1、思路&#xff1a;2、模板&#…

CMake中return的使用

CMake中的return命令用于从文件、目录或函数返回&#xff0c;其格式如下&#xff1a; return([PROPAGATE <var-name>...]) 当在包含文件中(in an included file)遇到此命令时(通过include或find_package命令)&#xff0c;它会导致当前文件的处理停止并将控制权返回给包含…

CTFHub | Cookie注入

0x00 前言 CTFHub 专注网络安全、信息安全、白帽子技术的在线学习&#xff0c;实训平台。提供优质的赛事及学习服务&#xff0c;拥有完善的题目环境及配套 writeup &#xff0c;降低 CTF 学习入门门槛&#xff0c;快速帮助选手成长&#xff0c;跟随主流比赛潮流。 0x01 题目描述…

Linux C/C++ 学习笔记(五):Mysql C/C++编程 创建 插入 读取 删除 存储过程

本文参考Linux C/C 开发&#xff08;学习笔记七&#xff09;&#xff1a;Mysql数据库C/C编程实现 插入/读取/删除_菊头蝙蝠的博客-CSDN博客 一、数据库建模与建库建表 在设计数据库时&#xff0c;对现实世界进行分析、抽象、并从中找出内在联系&#xff0c;进而确定数据库的结…

计算机视觉之迁移学习中的微调(fine tuning)

现在的数据集越来越大&#xff0c;都是大模型的训练&#xff0c;参数都早已超过亿级&#xff0c;面对如此大的训练集&#xff0c;绝大部分用户的硬件配置达不到&#xff0c;那有没有一种方法让这些训练好的大型数据集的参数&#xff0c;迁移到自己的一个目标训练数据集当中呢&a…

javaweb Ajax AXios异步框架 JSON 案例

AJAX概念&#xff1a;AJAX(Asynchronous JavaScript And XML)&#xff1a;异步的 JavaScript 和 XML AJAX作用&#xff1a; 与服务器进行数据交换&#xff1a;通过AJAX可以给服务器发送请求&#xff0c;并获取服务器响应的数据 使用了AJAX和服务器进行通信&#xff0c;就可以…

ArcGIS_将多个点数据整合成一个点数据

问题描述:如何将多个点合并成一个点,并保留原始点数据的字段信息 方法一:整合 打开arcgis整合工具 :“数据管理工具——要素类——整合” 容差半径可以通过arcgis测量工具获取,根据自己的目标任务,选择合适的容差半径 该方法优点在于整合后的点可以正好位于原始点数据…

牛客网之SQL非技术快速入门(7)-字符串截取、切割、删除、替换

知识点&#xff1a; &#xff08;1&#xff09;substring_indexsubstring_index(str,delim,count) str:要处理的字符串 delim:分隔符 count:计数 &#xff08;2&#xff09;切割、截取、删除、替换 1 2 3 4 5 6 7 8 9 10 11 12 13 14 select -- 替换法 replace(string, 被…

俺把所有粉丝显示在地图上啦~【详细教程+完整源码】

文章目录&#x1f332;小逼叨&#x1f332;爬取所有粉丝的IP所属地&#x1f334;爬者基本素养&#xff1a;网页分析&#x1f334;源代码&#x1f332;数据清洗和保存&#x1f334;源代码&#x1f332;绘制地图&#x1f334;源代码&#x1f332;结束语&#x1f332;小逼叨 其实昨…

windows中使用curl

curl这个工具在linux和macOS都经常使用&#xff0c;感觉挺实用的。在windows中默认也带了一个但是用起来不太一样&#xff0c;于是就想自己手动安装一个原汁原味的curl。 下载安装 https://curl.se/windows/ 下载适合自己平台的版本&#xff0c;解压就可以直接运行了。 比如…