{"id":13419451,"url":"https://github.com/sadeepj/crfasrnn_keras","last_synced_at":"2025-03-15T05:31:17.295Z","repository":{"id":38454828,"uuid":"98681307","full_name":"sadeepj/crfasrnn_keras","owner":"sadeepj","description":"CRF-RNN Keras/Tensorflow version","archived":false,"fork":false,"pushed_at":"2021-10-17T19:08:01.000Z","size":1024,"stargazers_count":604,"open_issues_count":33,"forks_count":170,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-07-31T22:49:37.799Z","etag":null,"topics":["crf-as-rnn","crf-rnn-keras","crf-rnn-tensorflow","crfasrnn","crfasrnn-keras","crfasrnn-tensorflow","image-segmentation","keras","semantic-segmentation","tensorflow"],"latest_commit_sha":null,"homepage":"http://crfasrnn.torr.vision","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/sadeepj.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":"2017-07-28T19:30:24.000Z","updated_at":"2024-06-02T18:54:57.000Z","dependencies_parsed_at":"2022-08-20T02:21:54.628Z","dependency_job_id":null,"html_url":"https://github.com/sadeepj/crfasrnn_keras","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadeepj%2Fcrfasrnn_keras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadeepj%2Fcrfasrnn_keras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadeepj%2Fcrfasrnn_keras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadeepj%2Fcrfasrnn_keras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sadeepj","download_url":"https://codeload.github.com/sadeepj/crfasrnn_keras/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690114,"owners_count":20331726,"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":["crf-as-rnn","crf-rnn-keras","crf-rnn-tensorflow","crfasrnn","crfasrnn-keras","crfasrnn-tensorflow","image-segmentation","keras","semantic-segmentation","tensorflow"],"created_at":"2024-07-30T22:01:16.212Z","updated_at":"2025-03-15T05:31:16.905Z","avatar_url":"https://github.com/sadeepj.png","language":"Python","funding_links":[],"categories":["TODO scan for Android support in followings","Python"],"sub_categories":[],"readme":"# CRF-RNN for Semantic Image Segmentation - Keras/Tensorflow version\n![sample](sample.png)\n\n\u003cb\u003eLive demo:\u003c/b\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; [http://crfasrnn.torr.vision](http://crfasrnn.torr.vision) \u003cbr/\u003e\n\u003cb\u003ePyTorch version:\u003c/b\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;[http://github.com/sadeepj/crfasrnn_pytorch](http://github.com/sadeepj/crfasrnn_pytorch)\u003cbr/\u003e\n\u003cb\u003eCaffe version:\u003c/b\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; [http://github.com/torrvision/crfasrnn](http://github.com/torrvision/crfasrnn)\u003cbr/\u003e\n\nThis repository contains Keras/Tensorflow code for the \"CRF-RNN\" semantic image segmentation method, published in the ICCV 2015 paper [Conditional Random Fields as Recurrent Neural Networks](http://www.robots.ox.ac.uk/~szheng/papers/CRFasRNN.pdf). The [online demo](http://crfasrnn.torr.vision) of this project won the Best Demo Prize at ICCV 2015. Results of this Keras/Tensorflow code are identical to that of the Caffe and PyTorch based versions above.\n\nIf you use this code/model for your research, please cite the following paper:\n```\n@inproceedings{crfasrnn_ICCV2015,\n    author = {Shuai Zheng and Sadeep Jayasumana and Bernardino Romera-Paredes and Vibhav Vineet and\n    Zhizhong Su and Dalong Du and Chang Huang and Philip H. S. Torr},\n    title  = {Conditional Random Fields as Recurrent Neural Networks},\n    booktitle = {International Conference on Computer Vision (ICCV)},\n    year   = {2015}\n}\n```\n\n## Installation Guide\n\n### Step 1: Clone the repository\n```\n$ git clone https://github.com/sadeepj/crfasrnn_keras.git\n```\nThe root directory of the clone will be referred to as `crfasrnn_keras` hereafter.\n\n### Step 2: Install dependencies\n\n**Note**: If you are using a Python virtualenv, make sure it is activated before running each command in this guide.\n\nUse the `requirements.txt` file (or `requirements_gpu.txt`, if you have a GPU device) in this repository to install all the dependencies via `pip`:\n```\n$ cd crfasrnn_keras\n$ pip install -r requirements.txt  # If you have a GPU device, use requirements_gpu.txt instead\n```\nAs you can notice from the contents of `requirements.txt`, we only depend on `tensorflow`, `keras`, and `h5py`. Additionally, `Pillow` is required for running the demo.\nAfter installing the dependencies, run the following commands to make sure they are properly installed:\n```\n$ python\n\u003e\u003e\u003e import tensorflow\n\u003e\u003e\u003e import keras\n```\nYou should not see any errors while importing `tensorflow` and `keras` above.\n\n### Step 3: Build CRF-RNN custom op C++ code\n\nRun `make` inside the `crfasrnn_keras/src/cpp` directory:\n```\n$ cd crfasrnn_keras/src/cpp\n$ make\n``` \nNote that the `python` command in the console should refer to the Python interpreter associated with your Tensorflow installation before running the `make` command above.\n\nYou will get a new file named `high_dim_filter.so` from this build. If it fails, refer to the official Tensorflow guide for [building a custom op](https://www.tensorflow.org/extend/adding_an_op#build_the_op_library) for help.\n\n**Note**: This make script works on Linux and macOS, but not on Windows OS. If you are on Windows, please check [this issue](https://github.com/tensorflow/models/issues/1103) and the comments therein for build instructions. The official Tensorflow guide for building a custom op does not yet include build instructions for Windows.\n\n### Step 4: Download the pre-trained model weights\n\nDownload the model weights from [here](https://github.com/sadeepj/crfasrnn_keras/releases/download/v1.0/crfrnn_keras_model.h5) and place it in the `crfasrnn_keras` directory with the file name `crfrnn_keras_model.h5`.\n\n### Step 5: Run the demo\n```\n$ cd crfasrnn_keras\n$ python run_demo.py\n```\nIf all goes well, you will see the segmentation results in a file named \"labels.png\".\n\n\n## Notes\n1. Current implementation of the CrfRnnLayer only supports batch_size == 1\n2. An experimental GPU version of the CrfRnnLayer that has been tested on CUDA 9 and Tensorflow 1.7 only, is available under the `gpu_support` branch. This code was contributed by [thwjoy](https://github.com/thwjoy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadeepj%2Fcrfasrnn_keras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsadeepj%2Fcrfasrnn_keras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadeepj%2Fcrfasrnn_keras/lists"}