91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 60.97MB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2022-12-09
  • 語言: 其他
  • 標簽: 圖像去噪??

資源簡介

一共有3個圖像去噪卷積神經網絡模型,包括訓練集,測試集,以及幾個訓練好的參數,可以直接對圖像進行去噪

資源截圖

代碼片段和文件信息


import?glob
import?cv2
import?numpy?as?np

patch_size?stride?=?40?10?#分塊圖像的大小以及步長,將圖像分成小塊擴充數據集,共238336張,不影響去噪的訓練,其他任務不一定
aug_times?=?1
scales?=?[1?0.9?0.8?0.7]
batch_size?=?128

def?data_aug(img?mode=0):

????if?mode?==?0:
????????return?img
????elif?mode?==?1:
????????return?np.flipud(img)
????elif?mode?==?2:
????????return?np.rot90(img)
????elif?mode?==?3:
????????return?np.flipud(np.rot90(img))
????elif?mode?==?4:
????????return?np.rot90(img?k=2)
????elif?mode?==?5:
????????return?np.flipud(np.rot90(img?k=2))
????elif?mode?==?6:
????????return?np.rot90(img?k=3)
????elif?mode?==?7:
????????return?np.flipud(np.rot90(img?k=3))

def?gen_patches(file_name):

????#?read?image
????img?=?cv2.imread(file_name?0)??#?gray?scale
????h?w?=?img.shape
????patches?=?[]
????for?s?in?scales:
????????h_scaled?w_scaled?=?int(h*s)int(w*s)
????????img_scaled?=?cv2.resize(img?(h_scaledw_scaled)?interpolation=cv2.INTER_CUBIC)
????????#?extract?patches
????????for?i?in?range(0?h_scaled-patch_size+1?stride):
????????????for?j?in?range(0?w_scaled-patch_size+1?stride):
????????????????x?=?img_scaled[i:i+patch_size?j:j+patch_size]
????????????????#patches.append(x)????????
????????????????#?data?aug
????????????????for?k?in?range(0?aug_times):
????????????????????x_aug?=?data_aug(x?mode=np.random.randint(08))
????????????????????patches.append(x_aug)
????????????????
????return?patches

def?datagenerator(data_dir=‘data/Train400‘verbose=False):
????
????file_list?=?glob.glob(data_dir+‘/*.png‘)??#?get?name?list?of?all?.png?files
????#?initrialize
????data?=?[]
????#?generate?patches
????for?i?in?range(len(file_list)):
????????patch?=?gen_patches(file_list[i])
????????data.append(patch)
????????if?verbose:
????????????print(str(i+1)+‘/‘+?str(len(file_list))?+?‘?is?done?^_^‘)
????data?=?np.array(data?dtype=‘uint8‘)
????data?=?data.reshape((data.shape[0]*data.shape[1]data.shape[2]data.shape[3]1))
????discard_n?=?len(data)-len(data)//batch_size*batch_size;
????data?=?np.delete(datarange(discard_n)axis?=?0)
????print(‘^_^-training?data?finished-^_^‘)
????print(data.shape)
????return?data

if?__name__?==?‘__main__‘:???

????data?=?datagenerator(data_dir=‘data/Train400‘)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????????50??2020-11-23?18:20??ImageDenoiseCnn\.idea\.gitignore

?????文件????????499??2020-11-24?09:57??ImageDenoiseCnn\.idea\ImageDenoiseCnn.iml

?????文件????????174??2020-11-23?18:20??ImageDenoiseCnn\.idea\inspectionProfiles\profiles_settings.xml

?????文件????????202??2020-11-24?09:57??ImageDenoiseCnn\.idea\misc.xml

?????文件????????289??2020-11-23?18:20??ImageDenoiseCnn\.idea\modules.xml

?????文件???????7974??2020-11-25?21:51??ImageDenoiseCnn\.idea\workspace.xml

?????文件??????38267??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\01.png

?????文件??????34985??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\02.png

?????文件??????40181??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\03.png

?????文件??????42947??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\04.png

?????文件??????40728??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\05.png

?????文件??????40985??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\06.png

?????文件??????39804??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\07.png

?????文件?????151065??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\08.png

?????文件?????185727??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\09.png

?????文件?????177762??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\10.png

?????文件?????209817??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\11.png

?????文件?????193637??2019-12-19?01:09??ImageDenoiseCnn\data\Test\Set12\12.png

?????文件??????23063??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\0.png

?????文件??????17967??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\1.png

?????文件??????22269??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\10.png

?????文件??????28659??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\100.png

?????文件??????18633??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\101.png

?????文件??????23156??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\102.png

?????文件??????19793??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\103.png

?????文件??????21588??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\104.png

?????文件??????23464??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\105.png

?????文件??????20880??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\106.png

?????文件??????27655??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\107.png

?????文件??????29954??2020-04-20?15:24??ImageDenoiseCnn\data\Train400\108.png

............此處省略409個文件信息

評論

共有 條評論