{"id":29219686,"url":"https://github.com/dvlab-research/context-aware-consistency","last_synced_at":"2025-10-26T23:39:56.362Z","repository":{"id":43480417,"uuid":"353912186","full_name":"dvlab-research/Context-Aware-Consistency","owner":"dvlab-research","description":"Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CVPR 2021)","archived":false,"fork":false,"pushed_at":"2023-08-24T05:52:07.000Z","size":1077,"stargazers_count":156,"open_issues_count":5,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T19:35:31.544Z","etag":null,"topics":["cvpr2021","semantic-segmentation","semi-supervised-learning","semi-supervised-segmentation"],"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/dvlab-research.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-04-02T05:11:50.000Z","updated_at":"2025-03-12T03:10:15.000Z","dependencies_parsed_at":"2024-01-14T08:56:25.156Z","dependency_job_id":"694f78a3-0789-4267-9f15-29ea65de8158","html_url":"https://github.com/dvlab-research/Context-Aware-Consistency","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dvlab-research/Context-Aware-Consistency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvlab-research%2FContext-Aware-Consistency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvlab-research%2FContext-Aware-Consistency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvlab-research%2FContext-Aware-Consistency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvlab-research%2FContext-Aware-Consistency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvlab-research","download_url":"https://codeload.github.com/dvlab-research/Context-Aware-Consistency/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvlab-research%2FContext-Aware-Consistency/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245318,"owners_count":23436514,"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":["cvpr2021","semantic-segmentation","semi-supervised-learning","semi-supervised-segmentation"],"created_at":"2025-07-03T02:06:37.963Z","updated_at":"2025-10-26T23:39:56.274Z","avatar_url":"https://github.com/dvlab-research.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CAC)\n*Xin Lai\u003csup\u003e\\*\u003c/sup\u003e, Zhuotao Tian\u003csup\u003e\\*\u003c/sup\u003e, Li Jiang, Shu Liu, Hengshuang Zhao, Liwei Wang, Jiaya Jia*\n\nThis is the official PyTorch implementation of our paper [**Semi-supervised Semantic Segmentation with Directional Context-aware Consistency**](https://jiaya.me/papers/semiseg_cvpr21.pdf) that has been accepted to 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2021). [[Paper]](https://jiaya.me/papers/semiseg_cvpr21.pdf)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"figures/fig.png\"/\u003e\n\u003c/div\u003e\n\n# Highlight \n1. Our method achives the state-of-the-art performance on semi-supervised semantic segmentation. \n2. Based on [**CCT**](https://github.com/yassouali/CCT), this Repository also supports efficient distributed training with multiple GPUs.\n\n# Get Started\n## Environment\nThe repository is tested on Ubuntu 18.04.3 LTS, Python 3.6.9, PyTorch 1.6.0 and CUDA 10.2\n```\npip install -r requirements.txt\n```\n\n## Datasets Preparation\n1. Firstly, download the [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar) Dataset, and the extra annotations from [SegmentationClassAug](https://www.dropbox.com/s/oeu149j8qtbs1x0/SegmentationClassAug.zip?dl=0).\n2. Extract the above compression files into your desired path, and make it follow the directory tree as below.\n\n```\n-VOCtrainval_11-May-2012\n    -VOCdevkit\n        -VOC2012\n            -Annotations\n            -ImageSets\n            -JPEGImages\n            -SegmentationClass\n            -SegmentationClassAug\n            -SegmentationObject\n```\n\n3. Set 'data_dir' in the config file into '[YOUR_PATH]/VOCtrainval_11-May-2012'.\n\n## Training\n\nFirsly, you should download the PyTorch ResNet101 or ResNet50 ImageNet-pretrained weight, and put it into the 'pretrained/' directory using the following commands.\n\n```\ncd Context-Aware-Consistency\nmkdir pretrained\ncd pretrained\nwget https://download.pytorch.org/models/resnet50-19c8e357.pth # ResNet50\nwget https://download.pytorch.org/models/resnet101-5d3b4d8f.pth # ResNet101\n```\n\nRun the following commands for training.\n\n- train the model on the 1/8 labeled data (the 0-th data list) of PASCAL VOC with the segmentation network and the backbone set to DeepLabv3+ and ResNet50 respectively.\n```\npython3 train.py --config configs/voc_cac_deeplabv3+_resnet50_1over8_datalist0.json\n```\n\n- train the model on the 1/8 labeled data (the 0-th data list) of PASCAL VOC with the segmentation network and the backbone set to DeepLabv3+ and ResNet101 respectively.\n```\npython3 train.py --config configs/voc_cac_deeplabv3+_resnet101_1over8_datalist0.json\n```\n\n## Testing\nFor testing, run the following command.\n\n```\npython3 train.py --config [CONFIG_PATH] --resume [CHECKPOINT_PATH] --test True\n```\n\n## Pre-trained Models\n\nFor your convenience, you can download some of the pre-trained models from [Here](https://mycuhk-my.sharepoint.com/:f:/g/personal/1155154502_link_cuhk_edu_hk/EpHdT2JFT11FpsUc4jHE3CoB2wUZ5tQo_W0QzzqHdNtF-A?e=yx2Xha).\n\n# Related Repositories\n\nThis repository highly depends on the **CCT** repository at https://github.com/yassouali/CCT. We thank the authors of CCT for their great work and clean code.\n\nBesides, we also borrow some codes from the following repositories.\n\n- **MoCo** at https://github.com/facebookresearch/moco. \n- **Deeplabv3+** at https://github.com/jfzhang95/pytorch-deeplab-xception.\n- **Semseg** at https://github.com/hszhao/semseg\n\nThanks a lot for their great work.\n\n# Citation\nIf you find this project useful, please consider citing:\n\n```\n@inproceedings{lai2021cac,\n  title     = {Semi-supervised Semantic Segmentation with Directional Context-aware Consistency},\n  author    = {Xin Lai, Zhuotao Tian, Li Jiang, Shu Liu, Hengshuang Zhao, Liwei Wang and Jiaya Jia},\n  booktitle = {CVPR},\n  year      = {2021}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvlab-research%2Fcontext-aware-consistency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvlab-research%2Fcontext-aware-consistency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvlab-research%2Fcontext-aware-consistency/lists"}