{"id":13564795,"url":"https://github.com/davidtvs/PyTorch-ENet","last_synced_at":"2025-04-03T21:31:59.169Z","repository":{"id":40614303,"uuid":"122004209","full_name":"davidtvs/PyTorch-ENet","owner":"davidtvs","description":"PyTorch implementation of ENet","archived":false,"fork":false,"pushed_at":"2021-05-10T21:12:24.000Z","size":55535,"stargazers_count":388,"open_issues_count":5,"forks_count":129,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-04T18:45:05.172Z","etag":null,"topics":["camvid","cityscape","enet","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidtvs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-19T00:35:33.000Z","updated_at":"2024-10-22T07:17:00.000Z","dependencies_parsed_at":"2022-08-27T01:11:46.273Z","dependency_job_id":null,"html_url":"https://github.com/davidtvs/PyTorch-ENet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidtvs%2FPyTorch-ENet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidtvs%2FPyTorch-ENet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidtvs%2FPyTorch-ENet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidtvs%2FPyTorch-ENet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidtvs","download_url":"https://codeload.github.com/davidtvs/PyTorch-ENet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247083791,"owners_count":20880917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camvid","cityscape","enet","pytorch"],"created_at":"2024-08-01T13:01:36.114Z","updated_at":"2025-04-03T21:31:54.153Z","avatar_url":"https://github.com/davidtvs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# PyTorch-ENet\n\nPyTorch (v1.1.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.\n\nThis 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).\n\n|                               Dataset                                | Classes \u003csup\u003e1\u003c/sup\u003e | Input resolution | Batch size | Epochs |   Mean IoU (%)    | GPU memory (GiB) | Training time (hours)\u003csup\u003e2\u003c/sup\u003e |\n| :------------------------------------------------------------------: | :------------------: | :--------------: | :--------: | :----: | :---------------: | :--------------: | :-------------------------------: |\n| [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) |          11          |     480x360      |     10     |  300   | 52.1\u003csup\u003e3\u003c/sup\u003e |       4.2        |                 1                 |\n|          [Cityscapes](https://www.cityscapes-dataset.com/)           |          19          |     1024x512     |     4      |  300   | 59.5\u003csup\u003e4\u003c/sup\u003e |       5.4        |                20                 |\n\n\u003csup\u003e1\u003c/sup\u003e When referring to the number of classes, the void/unlabeled class is always excluded.\u003cbr/\u003e\n\u003csup\u003e2\u003c/sup\u003e These are just for reference. Implementation, datasets, and hardware changes can lead to very different results. Reference hardware: Nvidia GTX 1070 and an AMD Ryzen 5 3600 3.6GHz. You can also train for 100 epochs or so and get similar mean IoU (± 2%).\u003cbr/\u003e\n\u003csup\u003e3\u003c/sup\u003e Test set.\u003cbr/\u003e\n\u003csup\u003e4\u003c/sup\u003e Validation set.\n\n## Installation\n\n### Local pip\n\n1. Python 3 and pip\n2. Set up a virtual environment (optional, but recommended)\n3. Install dependencies using pip: `pip install -r requirements.txt`\n\n### Docker image\n\n1. Build the image: `docker build -t enet .`\n2. Run: `docker run -it --gpus all --ipc host enet`\n\n## Usage\n\nRun [``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:\n\n```\npython main.py [-h] [--mode {train,test,full}] [--resume]\n               [--batch-size BATCH_SIZE] [--epochs EPOCHS]\n               [--learning-rate LEARNING_RATE] [--lr-decay LR_DECAY]\n               [--lr-decay-epochs LR_DECAY_EPOCHS]\n               [--weight-decay WEIGHT_DECAY] [--dataset {camvid,cityscapes}]\n               [--dataset-dir DATASET_DIR] [--height HEIGHT] [--width WIDTH]\n               [--weighing {enet,mfb,none}] [--with-unlabeled]\n               [--workers WORKERS] [--print-step] [--imshow-batch]\n               [--device DEVICE] [--name NAME] [--save-dir SAVE_DIR]\n```\n\nFor help on the optional arguments run: ``python main.py -h``\n\n\n### Examples: Training\n\n```\npython main.py -m train --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/\n```\n\n\n### Examples: Resuming training\n\n```\npython main.py -m train --resume True --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/\n```\n\n\n### Examples: Testing\n\n```\npython main.py -m test --save-dir save/folder/ --name model_name --dataset name --dataset-dir path/root_directory/\n```\n\n\n## Project structure\n\n### Folders\n\n- [``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.\n- [``metric``](https://github.com/davidtvs/PyTorch-ENet/tree/master/metric): Evaluation-related metrics.\n- [``models``](https://github.com/davidtvs/PyTorch-ENet/tree/master/models): ENet model definition.\n- [``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.\n\n### Files\n\n- [``args.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/args.py): Contains all command-line options.\n- [``main.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/main.py): Main script file used for training and/or testing the model.\n- [``test.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/test.py): Defines the ``Test`` class which is responsible for testing the model.\n- [``train.py``](https://github.com/davidtvs/PyTorch-ENet/blob/master/train.py): Defines the ``Train`` class which is responsible for training the model.\n- [``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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidtvs%2FPyTorch-ENet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidtvs%2FPyTorch-ENet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidtvs%2FPyTorch-ENet/lists"}