unet

zhixuhaoMIT更新放缓

基于 Keras 实现的 U-Net 图像分割模型,提供训练与推理代码,适合医学影像等像素级分割任务的快速复现与二次开发。

unet for image segmentation

暂无版本4,940star2,000fork同步于 2026-11-10 23:37 UTC

怎么上手

由 README 提炼,执行前请确认
pip install tensorflow keras
python main.py
硬件要求按 README 说明

README 未说明显存要求;Keras 本身可在 CPU 和 GPU 上运行,但未列出具体 GPU 厂商或型号

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Keras 实现的 U-Net 图像分割示例,含 ISBI 细胞膜数据与训练脚本,适合快速上手分割任务

基于 Keras 实现的 U-Net 图像分割模型,提供训练与推理代码,适合医学影像等像素级分割任务的快速复现与二次开发。

核心能力

  • 用 Keras 函数式 API 搭建 U-Net 网络
  • 用 ImageDataGenerator 做数据增强扩充样本
  • 输出 512×512 掩码并用 Sigmoid 限制到 0~1
  • 提供 data/membrane 预处理好的 ISBI 数据集
  • 训练 5 个 epoch 后准确率约 0.97

容易踩的坑

依赖 Keras >= 1.0 且声明兼容 Python 2.7-3.5,新版 TensorFlow/Keras 与 Python 3.6+ 可能不兼容;训练数据仅 30 张 512×512 图像,需依赖数据增强;README 未给出模型权重下载,需自行训练或按 notebook 运行

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Implementation of deep learning framework -- Unet, using Keras

    The architecture was inspired by U-Net: Convolutional Networks for Biomedical Image Segmentation.


    Overview

    Data

    The original dataset is from isbi challenge, and I've downloaded it and done the pre-processing.

    You can find it in folder data/membrane.

    Data augmentation

    The data for training contains 30 512*512 images, which are far not enough to feed a deep learning neural network. I use a module called ImageDataGenerator in keras.preprocessing.image to do data augmentation.

    See dataPrepare.ipynb and data.py for detail.

    Model

    img/u-net-architecture.png

    This deep neural network is implemented with Keras functional API, which makes it extremely easy to experiment with different interesting architectures.

    Output from the network is a 512*512 which represents mask that should be learned. Sigmoid activation function makes sure that mask pixels are in [0, 1] range.

    Training

    The model is trained for 5 epochs.

    After 5 epochs, calculated accuracy is about 0.97.

    Loss function for the training is basically just a binary crossentropy.


    How to use

    Dependencies

    This tutorial depends on the following libraries:

    • Tensorflow
    • Keras >= 1.0

    Also, this code should be compatible with Python versions 2.7-3.5.

    Run main.py

    You will see the predicted results of test image in data/membrane/test

    Or follow notebook trainUnet

    Results

    Use the trained model to do segmentation on test images, the result is statisfactory.

    img/0test.png

    img/0label.png

    About Keras

    Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either TensorFlow or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.

    Use Keras if you need a deep learning library that:

    allows for easy and fast prototyping (through total modularity, minimalism, and extensibility). supports both convolutional networks and recurrent networks, as well as combinations of the two. supports arbitrary connectivity schemes (including multi-input and multi-output training). runs seamlessly on CPU and GPU. Read the documentation Keras.io

    Keras is compatible with: Python 2.7-3.5.