深度學習(08)-- Residual Network (ResNet)

文章目錄

  • 目錄
    • 1.殘差網絡基礎
      • 1.1基本概念
      • 1.2VGG19、ResNet34結構圖
      • 1.3 梯度彌散和網絡退化
      • 1.4 殘差塊變體
      • 1.5 ResNet模型變體
      • 1.6 Residual Network補充
      • 1.7 1*1卷積核(補充)
    • 2.殘差網絡介紹(何凱明)
    • 3.ResNet-50(Ng)
      • 3.1 非常深的神經網絡問題
      • 3.2 建立一個殘差網絡
      • 3.3first ResNet model(50layers)
      • 3.4 代碼實現
    • 4.ResNet 100-1000層
      • 4.1 152層

目錄

1.殘差網絡基礎

1.1基本概念

非常非常深的神經網絡是很難訓練的,因為存在梯度消失和梯度爆炸問題。ResNets是由殘差塊(Residual block)構建的,首先解釋一下什么是殘差塊。
殘差塊結構:
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

1.2VGG19、ResNet34結構圖

在這里插入圖片描述

1.3 梯度彌散和網絡退化

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

1.4 殘差塊變體

自AlexNet以來,state-of-the-art的CNN結構都在不斷地變深。VGG和GoogLeNet分別有19個和22個卷積層,而AlexNet只有5個。

ResNet基本思想:引入跳過一層或多層的shortcut connection。
在這里插入圖片描述

1.5 ResNet模型變體

(1)ResNeXt
在這里插入圖片描述
在這里插入圖片描述
(2)DenseNet
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

1.6 Residual Network補充

在這里插入圖片描述
在這里插入圖片描述

1.7 1*1卷積核(補充)

*1的卷積核相當于對一個切片上的nc個單元,都應用了一個全連接的神經網絡
在這里插入圖片描述

2.殘差網絡介紹(何凱明)

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

3.ResNet-50(Ng)

3.1 非常深的神經網絡問題

在這里插入圖片描述

3.2 建立一個殘差網絡

使用 short connect的殘差塊,能很容易的學習標識功能。在其他ResNet塊上進行堆棧,不會損害訓練集的性能。
(1)identity block (標準塊)

在這里插入圖片描述
(2)convolutional block
當輸入和輸出的尺寸不匹配時,使用
在這里插入圖片描述

3.3first ResNet model(50layers)

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

3.4 代碼實現

def identity_block(X, f, filters, stage, block):"""X       -- 輸入tensor, shape=(m, n_H_prev, n_W_prev, n_C_prev)f       -- identity block主路徑,中間卷積層的濾波器大小filters -- [f1,f2,f3]對應主路徑中三個卷積層的濾波器個數stage   -- 用于命名層,階段(數字表示:1/2/3/4/5...)block   -- 用于命名層,每個階段中的殘差塊(字符表示:a/b/c/d/e/f...)Return   X  -- identity block 輸出tensor  shape=(m, n_H, n_W, n_C)    """"define name basis"conv_name_base = 'res' + str(stage) + block + '_branch'bn_name_base   = 'bn'  + str(stage) + block + '_branch'"get filter number"F1, F2, F3 = filters"save the input value"X_shortcut = X"主路徑的第一層:conv-bn-relu"X = Conv2D(filters=F1, kernel_size=(1,1), strides=(1,1), padding='valid',name=conv_name_base+'2a', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2a')(X)X = Activation('relu')(X)"主路徑的第二層:conv-bn-relu"X = Conv2D(filters=F2, kernel_size=(f,f), strides=(1,1), padding='same',name=conv_name_base+'2b', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2b')(X)X = Activation('relu')(X)"主路徑的第三層:conv-bn"X = Conv2D(filters=F3, kernel_size=(1,1), strides=(1,1), padding='valid',name=conv_name_base+'2c', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2c')(X)"add shortcut and relu"X = Add()([X, X_shortcut])X = Activation('relu')(X)return X"""s -- convolutional block中,主路徑第一個卷積層和shortcut卷積層,濾波器滑動步長,s=2,用來降低圖片大小"""
def convolutional_block(X, f, filters, stage, block, s=2):conv_name_base = 'res' + str(stage) + block + '_branch'bn_name_base   = 'bn'  + str(stage) + block + '_branch'F1, F2, F3 = filtersX_shortcut = X"1st layer"X = Conv2D(filters=F1, kernel_size=(1,1), strides=(s,s), padding='valid',name=conv_name_base+'2a', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2a')(X)X = Activation('relu')(X)"2nd layer"X = Conv2D(filters=F2, kernel_size=(f,f), strides=(1,1), padding='same',name=conv_name_base+'2b', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2b')(X)X = Activation('relu')(X)"3rd layer"X = Conv2D(filters=F3, kernel_size=(1,1), strides=(1,1), padding='valid',name=conv_name_base+'2c', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name=bn_name_base+'2c')(X)"shortcut path"X_shortcut = Conv2D(filters=F3, kernel_size=(1,1), strides=(s,s), padding='valid',name=conv_name_base+'1', kernel_initializer=glorot_uniform(seed=0))(X_shortcut)X_shortcut = BatchNormalization(axis=3, name=bn_name_base+'1')(X_shortcut)X = Add()([X, X_shortcut])X = Activation('relu')(X)return X
def ResNet50(input_shape=(64,64,3), classes=6):"""input - zero padding stage1:conv - BatchNorm - relu - maxpoolstage2: conv block - identity block *2stage3: conv block - identity block *3stage4: conv block - identity block *5stage5: conv block - identity block *2avgpool - flatten - fully connectinput_shape  -- 輸入圖像的shapeclasses      -- 類別數Return: a model() instance in Keras""""用input_shape定義一個輸入tensor"X_input = Input(input_shape)"zero padding"X = ZeroPadding2D((3,3))(X_input)"stage 1"X = Conv2D(filters=64, kernel_size=(7,7), strides=(2,2), padding='valid',name='conv1', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name='bn_conv1')(X)X = MaxPooling2D((3,3), strides=(2,2))(X)"stage 2"X = convolutional_block(X, f=3, filters=[64,64,256], stage=2, block='a', s=1)X = identity_block(X,f=3, filters=[64,64,256], stage=2, block='b')X = identity_block(X,f=3, filters=[64,64,256], stage=2, block='c')"stage 3"X = convolutional_block(X, f=3, filters=[128,128,512], stage=3, block='a', s=2)X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='b')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='c')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='d')"stage 4"X = convolutional_block(X, f=3, filters=[256,256,1024], stage=4, block='a', s=2)X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='b')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='c')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='d')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='e')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='f')"stage 5"X = convolutional_block(X, f=3, filters=[512,512,2048], stage=5, block='a', s=2)X = identity_block(X, f=3, filters=[512,512,2048], stage=5, block='b')X = identity_block(X, f=3, filters=[512,512,2048], stage=5, block='c')"fully connect"X = AveragePooling2D((2,2), name='avg_pool')(X)X = Flatten()(X)X = Dense(classes, activation='softmax', name='fc'+str(classes),kernel_initializer=glorot_uniform(seed=0))(X)"a model() instance in Keras"model = Model(inputs=X_input, outputs=X, name='ResNet50')return model

4.ResNet 100-1000層

在這里插入圖片描述

4.1 152層

在這里插入圖片描述
在這里插入圖片描述

代碼

def ResNet101(input_shape=(64,64,3), classes=6):"""input - zero padding stage1:conv - BatchNorm - relu - maxpoolstage2: conv block - identity block *2stage3: conv block - identity block *3stage4: conv block - identity block *22stage5: conv block - identity block *2avgpool - flatten - fully connectinput_shape  -- 輸入圖像的shapeclasses      -- 類別數Return: a model() instance in Keras""""用input_shape定義一個輸入tensor"X_input = Input(input_shape)"zero padding"X = ZeroPadding2D((3,3))(X_input)"stage 1"X = Conv2D(filters=64, kernel_size=(7,7), strides=(2,2), padding='valid',name='conv1', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name='bn_conv1')(X)X = MaxPooling2D((3,3), strides=(2,2))(X)"stage 2"X = convolutional_block(X, f=3, filters=[4,4,16], stage=2, block='a', s=1)X = identity_block(X,f=3, filters=[4,4,16], stage=2, block='b')X = identity_block(X,f=3, filters=[4,4,16], stage=2, block='c')"stage 3"X = convolutional_block(X, f=3, filters=[8,8,32], stage=3, block='a', s=2)X = identity_block(X, f=3, filters=[8,8,32], stage=3, block='b')X = identity_block(X, f=3, filters=[8,8,32], stage=3, block='c')X = identity_block(X, f=3, filters=[8,8,32], stage=3, block='d')"stage 4""identity block from 5(50 layers) to 22(101 layers)"X = convolutional_block(X, f=3, filters=[16,16,64], stage=4, block='a', s=2)X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='b')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='c')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='d')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='e')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='f')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='g')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='h')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='i')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='j')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='k')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='l')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='m')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='n')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='o')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='p')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='q')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='r')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='s')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='t')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='u')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='v')X = identity_block(X, f=3, filters=[16,16,64], stage=4, block='w')"stage 5"X = convolutional_block(X, f=3, filters=[32,32,128], stage=5, block='a', s=2)X = identity_block(X, f=3, filters=[32,32,128], stage=5, block='b')X = identity_block(X, f=3, filters=[32,32,128], stage=5, block='c')"fully connect"X = AveragePooling2D((2,2), name='avg_pool')(X)X = Flatten()(X)X = Dense(classes, activation='softmax', name='fc'+str(classes),kernel_initializer=glorot_uniform(seed=0))(X)"a model() instance in Keras"model = Model(inputs=X_input, outputs=X, name='ResNet101')return model
def ResNet152(input_shape=(64,64,3), classes=6):"""input - zero padding stage1:conv - BatchNorm - relu - maxpoolstage2: conv block - identity block *2stage3: conv block - identity block *7stage4: conv block - identity block *35stage5: conv block - identity block *2avgpool - flatten - fully connectinput_shape  -- 輸入圖像的shapeclasses      -- 類別數Return: a model() instance in Keras""""用input_shape定義一個輸入tensor"X_input = Input(input_shape)"zero padding"X = ZeroPadding2D((3,3))(X_input)"stage 1"X = Conv2D(filters=64, kernel_size=(7,7), strides=(2,2), padding='valid',name='conv1', kernel_initializer=glorot_uniform(seed=0))(X)X = BatchNormalization(axis=3, name='bn_conv1')(X)X = MaxPooling2D((3,3), strides=(2,2))(X)"stage 2"X = convolutional_block(X, f=3, filters=[64,64,256], stage=2, block='a', s=1)X = identity_block(X,f=3, filters=[64,64,256], stage=2, block='b')X = identity_block(X,f=3, filters=[64,64,256], stage=2, block='c')"stage 3""identity block from 3(101 layers) to 7(152 layers)"X = convolutional_block(X, f=3, filters=[128,128,512], stage=3, block='a', s=2)X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='b')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='c')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='d')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='e')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='f')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='g')X = identity_block(X, f=3, filters=[128,128,512], stage=3, block='h')"stage 4""identity block from 22(101 layers) to 35(152 layers)"X = convolutional_block(X, f=3, filters=[256,256,1024], stage=4, block='a', s=2)X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='b')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='c')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='d')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='e')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='f')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='g')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='h')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='i')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='j')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='k')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='l')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='m')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='n')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='o')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='p')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='q')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='r')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='s')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='t')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='u')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='v')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='w')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='x')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='y')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z1')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z2')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z3')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z4')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z5')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z6')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z7')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z8')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z9')X = identity_block(X, f=3, filters=[256,256,1024], stage=4, block='z10')"stage 5"X = convolutional_block(X, f=3, filters=[512,512,2048], stage=5, block='a', s=2)X = identity_block(X, f=3, filters=[512,512,2048], stage=5, block='b')X = identity_block(X, f=3, filters=[512,512,2048], stage=5, block='c')"fully connect"X = AveragePooling2D((2,2), name='avg_pool')(X)X = Flatten()(X)X = Dense(classes, activation='softmax', name='fc'+str(classes),kernel_initializer=glorot_uniform(seed=0))(X)"a model() instance in Keras"model = Model(inputs=X_input, outputs=X, name='ResNet152')return model

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/445298.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/445298.shtml
英文地址,請注明出處:http://en.pswp.cn/news/445298.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Python(14)-模塊

模塊Python標準庫,第三方庫都是一個個模塊,我們還可以編寫自己的模塊。模塊python程序架構的核心模塊,模塊是一個工具包。 每一個以.py為擴展名的源代碼文件都是一個模塊。 想要使用工具包中的工具,可以使用Import的方式導入。 …

redis——命令請求的執行過程

發送命令請求 當用戶在客戶端中鍵入一個命令請求時, 客戶端會將這個命令請求轉換成協議格式, 然后通過連接到服務器的套接字, 將協議格式的命令請求發送給服務器。 讀取命令請求 當客戶端與服務器之間的連接套接字因為客戶端的寫入而變得可…

深度學習(09)-- DenseNet

文章目錄目錄1.DenseNet網絡結構2.稠密連接及其優點3.代碼實現4.補充說明目錄 1.DenseNet網絡結構 2.稠密連接及其優點 每層以之前層的輸出為輸入,對于有L層的傳統網絡,一共有L個連接,對于DenseNet,則有L*(L1)/2。 這篇論文主要…

redis——緩存擊穿/穿透/雪崩

緩存穿透 一般的緩存系統,都是按照key去緩存查詢,如果不存在對應的value,就去后端系統查找(比如DB)。 一些惡意的請求會故意查詢不存在的key,請求量很大,就會對后端系統造成很大的壓力。這就叫做緩存穿透…

python(15)-window7配置iPython

前提:安裝了Pythonanaconda anaconda安裝參考:https://www.zhihu.com/question/58033789 在window系統下可以使用兩種方法來實現類似與于Linux終端命令運行程序的方法(推薦方式2): 1.cmd:自己沒有操作過,可以參考下面…

深度學習(10)-- Capsules Networks(CapsNet)

版權聲明&#xff1a;本文為博主原創文章&#xff0c;未經博主允許不得轉載。 https://blog.csdn.net/malele4th/article/details/79430464 </div><div id"content_views" class"markdown_views"><!-- flowchart 箭頭圖標 勿刪 --&g…

手把手maven的功能/安裝/使用/idea集成

看這篇文章不用著急安裝&#xff0c;跟著步驟一定會成功&#xff0c;要理解maven是什么&#xff0c;如何使用。 介紹 maven官網 對于一個小白來說&#xff0c;官網有用的信息就是這些 不管如何介紹maven&#xff0c;作為使用者來說&#xff0c;主要感覺兩個方面有幫助&#x…

python(16)-列表list,for循環

高級數據類型--列表1列表定義2列表中取值3列表的增&#xff0c;刪&#xff0c;查&#xff0c;改3.1修改指定位置的數據3.2確定指定元素的索引3.3增加操作3.4刪除操作3.5 元素是否存在與列表中 in3.6在指定索引位置插入元素4列表的數據統計5列表排序6列表的循環遍歷-for7多維度l…

深度學習(11)-- GAN

TensorFlow &#xff08;GAN&#xff09; 目錄 TensorFlow &#xff08;GAN&#xff09;目錄1、GAN1.1 常見神經網絡形式1.2 生成網絡1.3 新手畫家 & 新手鑒賞家1.4 GAN網絡1.5 例子 1、GAN 今天我們會來說說現在最流行的一種生成網絡, 叫做 GAN, 又稱生成對抗網絡, 也…

Python外(1)--try-expect

語法&#xff1a; try:正常情況下執行的代碼塊 expect 錯誤類型1:&#xff08;可選&#xff09;錯誤類型1對應的處理方案 expect 錯誤類型2:&#xff08;可選&#xff09;錯誤類型2對應的處理方案 expect:剩下的錯誤類型對應的處理方案 else:&#xff08;可選&#xff09;沒有…

redis——數據結構和對象的使用介紹

redis官網 微軟寫的windows下的redis 我們下載第一個 額案后基本一路默認就行了 安裝后&#xff0c;服務自動啟動&#xff0c;以后也不用自動啟動。 出現這個表示我們連接上了。 redis命令參考鏈接 String 字符串結構 struct sdshdr{//記錄buf數組中已使用字節的數量int …

Python模塊(1)-Argparse 簡易使用教程

argparse 簡易使用教程1.概況2. action3. argparse 使用demo3.1 argparse 實現加法器3.2 D-Model parser1.概況 argparse是Python中用于解析命令行參數的一個模塊&#xff0c;可以自動生成help和usage信息&#xff1b;當從終端輸入的參數無效時&#xff0c;模塊會輸出提示信息…

深度學習--Keras總結

Keras主要包括14個模塊&#xff0c;本文主要對Models、layers、Initializations、Activations、Objectives、Optimizers、Preprocessing、metrics共計8個模塊分別展開介紹&#xff0c;并通過一個簡單的Bp神經網絡說明各個模塊的作用。 1. Model 包&#xff1a;keras.models …

redis——NOSQL及redis概述

NoSql入門概述 單機Mysql的美好時代 瓶頸&#xff1a; 數據庫總大小一臺機器硬盤內存放不下數據的索引&#xff08;B tree&#xff09;一個機器的運行內存放不下訪問量&#xff08;讀寫混合&#xff09;一個實例不能承受Memcached&#xff08;緩存&#xff09; MySql 垂直拆…

Python(17)-元組tuple

高級數據類型--元組1.元組的定義2.元組基本操作3.元組的循環遍歷4.元組的應用場景5.元組與格式化字符串6.元組與列表之間的轉換元組的最大特征就是可訪問不可改&#xff0c;可作為字典的鍵值&#xff0c;因為鍵值必須是唯一的。字符串也是不可邊類型&#xff0c;因此也適合做字…

深度學習(莫煩 神經網絡 lecture 3) Keras

神經網絡 & Keras 目錄 神經網絡 & Keras目錄1、Keras簡介1.1 科普: 人工神經網絡 VS 生物神經網絡1.2 什么是神經網絡 (Neural Network)1.3 神經網絡 梯度下降1.4 科普: 神經網絡的黑盒不黑1.5 Why Keras?1.6 兼容 backend 2、如何搭建各種神經網絡2.1 Regressor回歸…

阿里Java編程規約(集合)

【強制】關于 hashCode 和 equals 的處理&#xff0c;遵循如下規則&#xff1a; 1&#xff09; 只要覆寫 equals&#xff0c;就必須覆寫 hashCode。 2&#xff09; 因為 Set 存儲的是不重復的對象&#xff0c;依據 hashCode 和 equals 進行判斷&#xff0c;所以 Set 存儲的對…

Pytorch(3)-數據載入接口:Dataloader、datasets

pytorch數據載入1.數據載入概況Dataloader 是啥2.支持的三類數據集2.1 torchvision.datasets.xxx2.2 torchvision.datasets.ImageFolder2.3 寫自己的數據類&#xff0c;讀入定制化數據2.3.1 數據類的編寫map-style范式iterable-style 范式2.3.2 DataLoader 導入數據類1.數據載入…

阿里Java編程規約(控制語句)

【強制】在一個 switch 塊內&#xff0c;每個 case 要么通過 continue/break/return 等來終止&#xff0c;要么 注釋說明程序將繼續執行到哪一個 case 為止&#xff1b;在一個 switch 塊內&#xff0c;都必須包含一個 default 語句并且放在最后&#xff0c;即使它什么代碼也沒…

大數據學習(5)-- NoSQL數據庫

文章目錄目錄1.NoSQL的介紹2.NoSQL產生的原因2.1 web2.02.2 NoSQL興起原因3.NoSQL和關系數據庫的區別4.NoSQL的四大類型4.1 鍵值數據庫4.2 列族數據庫4.3 文檔數據庫4.4 圖形數據庫4.5 不同類型的NoSQL數據庫進行比較5.NoSQL的三大基石5.1 CAP5.2 base5.3 最終一致性6.從NoSQL到…