# PyTorch-ENet
PyTorch (v1.0.0) implementation of [*ENet: A Deep Neural Network Architecture for Real-Time Semantic Segmentation*](https://arxiv.org/abs/1606.02147), ported from the lua-torch implementation [ENet-training](https://github.com/e-lab/ENet-training) created by the authors.
This implementation has been tested on the CamVid and Cityscapes datasets. Currently, a pre-trained version of the model trained in CamVid and Cityscapes is available [here](https://github.com/davidtvs/PyTorch-ENet/tree/master/save).
| Dataset | Classes <sup>1</sup> | Input resolution | Batch size | Epochs | Mean IoU (%) | GPU memory (GiB) | Training time (hours)<sup>2</sup> |
| :------------------------------------------------------------------: | :------------------: | :--------------: | :--------: | :----: | :---------------: | :--------------: | :-------------------------------: |
| [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) | 11 | 480x360 | 10 | 300 | 52.85<sup>3</sup> | 4.2 | 1 |
| [Cityscapes](https://www.cityscapes-dataset.com/) | 19 | 1024x512 | 4 | 300 | 60.94<sup>4</sup> | 5.4 | 24 |
<sup>1</sup> When referring to the number of classes, the void/unlabeled class is always excluded.<br/>
<sup>2</sup> Just for reference since changes in implementation, datasets, and hardware can lead to very different results. Reference hardware: Nvidia GTX 1070 and an Intel Core i5-4570 3.2GHz. You can also train for 100 epochs or so and get similar mean IoU (± 2%).<br/>
<sup>3</sup> Test set.<br/>
<sup>4</sup> Validation set.
## Installation
1. Python 3 and pip.
2. Set up a virtual environment (optional, but recommended).
3. Install dependencies using pip: ``pip install -r requirements.txt``.
## Usage
Run [``main.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/main.py), the main script file used for training and/or testing the model. The following options are supported:
```
python main.py [-h] [--mode {train,test,full}] [--resume]
[--batch-size BATCH_SIZE] [--epochs EPOCHS]
[--learning-rate LEARNING_RATE] [--lr-decay LR_DECAY]
[--lr-decay-epochs LR_DECAY_EPOCHS]
[--weight-decay WEIGHT_DECAY] [--dataset {camvid,cityscapes}]
[--dataset-dir DATASET_DIR] [--height HEIGHT] [--width WIDTH]
[--weighing {enet,mfb,none}] [--with-unlabeled]
[--workers WORKERS] [--print-step] [--imshow-batch]
[--device DEVICE] [--name NAME] [--save-dir SAVE_DIR]
```
For help on the optional arguments run: ``python main.py -h``
### Examples: Training
```
python main.py -m train --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/
```
### Examples: Resuming training
```
python main.py -m train --resume True --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/
```
### Examples: Testing
```
python main.py -m test --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/
```
## Project structure
### Folders
- [``data``](https://github.com/davidtvs/PyTorch-ENet/tree/master/data): Contains instructions on how to download the datasets and the code that handles data loading.
- [``metric``](https://github.com/davidtvs/PyTorch-ENet/tree/master/metric): Evaluation-related metrics.
- [``models``](https://github.com/davidtvs/PyTorch-ENet/tree/master/models): ENet model definition.
- [``save``](https://github.com/davidtvs/PyTorch-ENet/tree/master/save): By default, ``main.py`` will save models in this folder. The pre-trained models can also be found here.
### Files
- [``args.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/args.py): Contains all command-line options.
- [``main.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/main.py): Main script file used for training and/or testing the model.
- [``test.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/test.py): Defines the ``Test`` class which is responsible for testing the model.
- [``train.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/train.py): Defines the ``Train`` class which is responsible for training the model.
- [``transforms.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/transforms.py): Defines image transformations to convert an RGB image encoding classes to a ``torch.LongTensor`` and vice versa.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
ENet架构是专为语义分割而设计的。与成熟的深度学习工作站相比,主要目标是有效利用嵌入式平台上可用的稀缺资源。Enet工作在完成此任务方面取得了很大的收获,与此同时,匹配并有时超过了现有的baseline,这些baseline对计算和内存的要求更高。ENet在NVIDIA TX1硬件上的应用体现了实时便携式嵌入式解决方案。即使主要目标是在移动设备上运行网络,它在NVIDIA Titan X等高端GPU上也非常有效。在需要处理大量高分辨率图像的数据中心应用中,这可能被证明是有用的。ENet允许以更快,更高效的方式执行大规模计算,这可能会节省大量资金。 资源是对论文的复现,可用于时实语义分割,转了模型之后可以部署在边缘设备上,关于算法的应用与理解可以参考个人的博客。里面有详细的介绍与训练方向。
资源推荐
资源详情
资源评论
























收起资源包目录













































共 35 条
- 1
资源评论

- 奈克罗巴雷2024-07-30非常有用的资源,有一定的参考价值,受益匪浅,值得下载。
- 悠然若梦2024-08-29终于找到了超赞的宝藏资源,果断冲冲冲,支持!


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


最新资源
- 综合布线系统的设计 施工 测试 验收与维护.pptx
- 游戏开发项目计划书------.pdf
- 项目计划书-《项目管理》结课作业-研发三D虚拟游戏.doc
- 互联网产品运营解析.ppt
- 一个完整的软件开发流程(20211112143424).pdf
- 专业网络管理员个人简历范文.doc
- 综合布线习题及答案.doc
- 网络心理咨询.pptx
- 2022年自考电子商务概论试卷.doc
- 探讨大数据背景下企业深化业财融合的策略.doc
- 专升本1计算机基础知识.ppt
- rescue_robots-大创资源
- 两位数乘以11的速算法.doc
- 学习财务管理实验excel运用心得.docx
- 软件实习报告模板锦集5篇.docx
- 课程管理系统数据库课程设计[1].doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



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