• 大小: 899KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: 其他
  • 标签: unet  

资源简介

该工程使用resnet50/101+hypercolumn+scse+unet算法实现对皮肤病变的分割

资源截图

代码片段和文件信息


import os
from sklearn.model_selection import train_test_split
from keras.callbacks import ReduceLROnPlateauModelCheckpointTensorBoard
import keras.backend as K
import tensorflow as tf
from model.deeplab import deeplabv3_plus
from imagegenerator import data_gen
base_DIR=‘D:/YeJQ/skinmask/‘
IMG_DIR=base_DIR+‘ISBI2016_ISIC_Part1_Training_Data/‘
MASK_DIR=base_DIR+‘ISBI2016_ISIC_Part1_Training_GroundTruth/‘
train_imgpathlistvalid_imgpathlisttrain_maskpathlistvalid_maskpathlist=train_test_split(os.listdir(IMG_DIR)
                                                                                           os.listdir(MASK_DIR)
                                                                                           test_size=0.1)
print(train_maskpathlist)
IMG_ROW=IMG_COL=256
def dice_coef(y_truey_pred):
    y_true_f=K.flatten(y_true)
    y_pred_f=K.flatten(y_pred)
    intersection=K.sum(y_true_f*y_pred_f)
    return (2.0*intersection+1.0)/(K.sum(y_true_f)+K.sum(y_pred_f)+1.0)

def dice_coef_loss(y_truey_pred):
    return -dice_coef(y_truey_pred)
model=deeplabv3_plus(IMG_ROWIMG_COLCOLORNUM=1)
model.compile(optimizer=‘adam‘loss=‘binary_crossentropy‘
              metrics=[dice_coef])

modelpath=‘deeplab_model.h5‘

callbacks=[
    ReduceLROnPlateau(monitor=‘val_loss‘patience=15verbose=1
                      min_lr=1e-6)
    ModelCheckpoint(modelpathmonitor=‘val_loss‘save_best_only=Trueverbose=1)
    TensorBoard(log_dir=‘logs/‘)
]
model.fit_generator(data_gen(IMG_ROWIMG_COLIMG_DIRMASK_DIRtrain_imgpathlisttrain_maskpathlistbatch_size=10)
                    steps_per_epoch=100
                    epochs=200
                    validation_data=data_gen(IMG_ROWIMG_COLIMG_DIRMASK_DIRvalid_imgpathlistvalid_maskpathlistbatch_size=5)
                    validation_steps=10
                    callbacks=callbacks)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-02-25 15:35  skinsegmentation\
     目录           0  2019-02-25 15:55  skinsegmentation\.idea\
     文件          16  2019-02-23 23:44  skinsegmentation\.idea\.name
     文件         686  2019-02-23 23:44  skinsegmentation\.idea\compiler.xml
     目录           0  2019-02-23 23:44  skinsegmentation\.idea\copyright\
     文件          76  2019-02-23 23:44  skinsegmentation\.idea\copyright\profiles_settings.xml
     文件         159  2019-02-23 23:44  skinsegmentation\.idea\encodings.xml
     目录           0  2019-02-23 23:44  skinsegmentation\.idea\inspectionProfiles\
     文件        8918  2019-02-23 23:44  skinsegmentation\.idea\inspectionProfiles\Project_Default.xml
     文件         241  2019-02-23 23:44  skinsegmentation\.idea\inspectionProfiles\profiles_settings.xml
     文件        1468  2019-02-23 23:44  skinsegmentation\.idea\misc.xml
     文件         272  2019-02-23 23:44  skinsegmentation\.idea\modules.xml
     文件        8792  2019-02-25 15:23  skinsegmentation\.idea\uiDesigner.xml
     文件       64469  2019-02-25 15:55  skinsegmentation\.idea\workspace.xml
     文件        1911  2019-02-24 11:41  skinsegmentation\deeplabtrain.py
     文件          20  2019-02-25 15:33  skinsegmentation\dice
     文件         793  2019-02-24 19:58  skinsegmentation\generatortest.py
     文件        2820  2019-02-25 12:43  skinsegmentation\imagegenerator.py
     文件         315  2019-02-24 11:59  skinsegmentation\imgtest.py
     目录           0  2019-02-25 15:47  skinsegmentation\model\
     文件        8686  2019-02-23 23:50  skinsegmentation\model\deeplab.py
     文件        4616  2019-02-24 14:51  skinsegmentation\model\loss.py
     文件       11280  2019-02-25 15:47  skinsegmentation\model\resunet.py
     文件        9940  2019-02-25 12:00  skinsegmentation\model\resunet1.py
     目录           0  2019-02-25 15:29  skinsegmentation\result\
     目录           0  2019-02-25 16:46  skinsegmentation\result\101h\
     目录           0  2019-02-25 15:25  skinsegmentation\result\50h\
     文件       21810  2019-02-25 15:24  skinsegmentation\result\50h\0.jpg
     文件       27210  2019-02-25 15:24  skinsegmentation\result\50h\1.jpg
     文件       23596  2019-02-25 15:24  skinsegmentation\result\50h\10.jpg
     文件       22470  2019-02-25 15:24  skinsegmentation\result\50h\11.jpg
............此处省略50个文件信息

评论

共有 条评论