7-11

参考一篇keras实现unet的文章,将其复现,但效果很差!

  1. 读取.mat文件,并将矩阵保存为图片(0-255)
root = "./cls/"
contours_dir = "./contours/"
for rt, dirs, files in os.walk(root):
    print len(files)
    for f in files:
        matfile = f
        filename =  matfile.split('.')[0]
        dataFile = root + matfile          #  inst
        data = scio.loadmat(dataFile)
        arr = np.array(data['GTcls'][0][0][1], dtype=np.uint8)*255
        cv2.imwrite(contours_dir + filename+".jpg",arr)
  1. 生成目录描述文件
$find pos -name *.jpg > _pos.txt
  1. 文件操作,遍历、读取每行 ;img/2008_007928.jpg ,注意有换行符
train_files = []
with open("dataset/img_txt.txt",'r') as f_train:
    files = f_train.readlines()
    for name in files:
        if len(name) < 20:          #跳过不完整的描述文件
            continue

        name = name.split("/")[1].split("\n")[0]
        train_files.append(name)
  1. skimage、opencv
    skimage
    RGB [0,1] (float)
    Opencv 
    BGR [0,255]
$sudo pip install scikit-image

安装顺序:nvida驱动 、cuda(注意驱动版本)、cudnn(注意cuda版本)
Tensorflow不同版本要求与CUDA及CUDNN版本对应关系

https://blog.csdn.net/omodao1/article/details/83241074

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值