# Pytorch-UNet

Customized implementation of the [U-Net](https://arxiv.org/pdf/1505.04597.pdf) in Pytorch for Kaggle's [Carvana Image Masking Challenge](https://www.kaggle.com/c/carvana-image-masking-challenge) from a high definition image. This was used with only one output class but it can be scaled easily.
This model was trained from scratch with 5000 images (no data augmentation) and scored a [dice coefficient](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient) of 0.988423 (511 out of 735) on over 100k test images. This score is not quite good but could be improved with more training, data augmentation, fine tuning, playing with CRF post-processing, and applying more weights on the edges of the masks.
The model used for the last submission is stored in the `MODEL.pth` file, if you wish to play with it. The data is available on the [Kaggle website](https://www.kaggle.com/c/carvana-image-masking-challenge/data).
## Usage
### Prediction
You can easily test the output masks on your images via the CLI.
To see all options:
`python predict.py -h`
To predict a single image and save it:
`python predict.py -i image.jpg -o output.jpg`
To predict a multiple images and show them without saving them:
`python predict.py -i image1.jpg image2.jpg --viz --no-save`
You can use the cpu-only version with `--cpu`.
You can specify which model file to use with `--model MODEL.pth`.
### Training
`python train.py -h` should get you started. A proper CLI is yet to be added.
## Warning
In order to process the image, it is split into two squares (a left on and a right one), and each square is passed into the net. The two square masks are then merged again to produce the final image. As a consequence, the height of the image must be strictly superior than half the width. Make sure the width is even too.
## Dependencies
This package depends on [pydensecrf](https://github.com/lucasb-eyer/pydensecrf), available via `pip install`.
## Notes on memory
The model has be trained from scratch on a GTX970M 3GB.
Predicting images of 1918*1280 takes 1.5GB of memory.
Training takes approximately 3GB, so if you are a few MB shy of memory, consider turning off all graphical displays.
This assumes you use bilinear up-sampling, and not transposed convolution in the model.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论






















收起资源包目录






















共 18 条
- 1
资源评论

- zjkkg12018-12-23github上来的源码也好意思收5积分?垃圾!原网址https://github.com/milesial/Pytorch-UNet

xiaoxifei
- 粉丝: 213
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 基于单片机的交流电机转动控制系统方案设计书.doc
- 《项目管理决策分析与评价》摸底评测.doc
- 综合布线设计方案.docx
- 区块链技术在金融领域应用的风险管理策略研究.docx
- 数据库应用技术知识点.doc
- ATS单片机停车场车位设计.doc
- 2018年度四川省大数据时代的互联网信息安全试题及答案1.doc
- 数据库设计报告1111111111111.doc
- 项目管理在农用飞机维修工程中的应用.docx
- 基于物联网的智能家居系统的设计与应用.docx
- kubernetes系列03—kubeadm安装部署K8S集群.docx
- 基于服务器虚拟化的政务云平台设计.docx
- C语言程序设计工业和信息化普通高等教育“十二五”规划教材立项项目-赵山林-高媛.doc
- matlab电炉温度控制算法比较及仿真研究分析.doc
- 电力调度自动化系统的网络安全问题与对策分析.docx
- 大数据时代人力资源管理创新策略初探.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
