unet的tensorflow代码_[深度学习] TensorFlow上实现Unet网络

代码取自于 https://github.com/jakeret/tf_unet

TensorFlow Unet文档 https://tf-unet.readthedocs.io/en/latest/installation.html

TensorFlow Unet安装

确保Tensorflow已安装,如果没有,请参考Tensorflow安装说明 link

克隆github工程 git clone https://github.com/jakeret/tf_unet.git

安装package

$ cd tf_unet

$ pip install -r requirements.txt

$ python setup.py install --user

Package使用

在其他工程中使用Tensorflow Unet的一个例子

from tf_unet import unet, util, image_util

#preparing data loading

data_provider = image_util.ImageDataProvider("fishes/train/*.tif")

#setup & training

net = unet.Unet(layers=3, features_root=64, channels=1, n_class=2)

trainer = unet.Trainer(net)

path = trainer.train(data_provider, output_path, training_iters=32, epochs=100)

#verification

...

prediction = net.predict(path, data)

unet.error_rate(prediction, util.crop_to_shape(label, prediction.shape))

img = util.combine_img_prediction(data, label, prediction)

util.save_image(img, "prediction.jpg")

可以利用Tensorboard跟踪学习的进度。tf_unet输出相关指标信息。

tf_unet Package的几个模块(链接有api和source,不再赘述)

unet模块࿱

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值