{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/daformer-improving-network-architectures-and","title":"DAFormer: Improving Network Architectures and Training Strategies for Domain-Adaptive Semantic Segmentation","arxiv_id":"2111.14887","date":"2021-11-29","proceeding":"CVPR 2022 1","authors":["Lukas Hoyer","Dengxin Dai","Luc van Gool"],"abstract":"As acquiring pixel-wise annotations of real-world images for semantic segmentation is a costly process, a model can instead be trained with more accessible synthetic data and adapted to real images without requiring their annotations. This process is studied in unsupervised domain adaptation (UDA). Even though a large number of methods propose new adaptation strategies, they are mostly based on outdated network architectures. As the influence of recent network architectures has not been systematically studied, we first benchmark different network architectures for UDA and newly reveal the potential of Transformers for UDA semantic segmentation. Based on the findings, we propose a novel UDA method, DAFormer. The network architecture of DAFormer consists of a Transformer encoder and a multi-level context-aware feature fusion decoder. It is enabled by three simple but crucial training strategies to stabilize the training and to avoid overfitting to the source domain: While (1) Rare Class Sampling on the source domain improves the quality of the pseudo-labels by mitigating the confirmation bias of self-training toward common classes, (2) a Thing-Class ImageNet Feature Distance and (3) a learning rate warmup promote feature transfer from ImageNet pretraining. DAFormer represents a major advance in UDA. It improves the state of the art by 10.8 mIoU for GTA-to-Cityscapes and 5.4 mIoU for Synthia-to-Cityscapes and enables learning even difficult classes such as train, bus, and truck well. The implementation is available at https://github.com/lhoyer/DAFormer.","url_abs":"https://arxiv.org/abs/2111.14887v2","url_pdf":"https://arxiv.org/pdf/2111.14887v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"daformer-improving-network-architectures-and","repo_url":"https://github.com/lhoyer/DAFormer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"daformer-improving-network-architectures-and","repo_url":"https://github.com/dbash/visda2022-org","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"daformer-improving-network-architectures-and","repo_url":"https://github.com/kw01sg/crda","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-adaptation","task_name":"Domain Adaptation"},{"task_slug":"image-to-image-translation","task_name":"Image-to-Image Translation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"},{"task_slug":"synthetic-to-real-translation","task_name":"Synthetic-to-Real Translation"},{"task_slug":"unsupervised-domain-adaptation","task_name":"Unsupervised Domain Adaptation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/domain-adaptation-on-cityscapes-to-acdc","task":"Domain Adaptation","dataset":"Cityscapes to ACDC","model":"DAFormer","rank_in_archive_order":11,"of":16,"metrics":{"mIoU":"55.4"},"uses_additional_data":false},{"leaderboard":"/sota/domain-adaptation-on-gta5-to-cityscapes","task":"Domain Adaptation","dataset":"GTA5 to Cityscapes","model":"DAFormer","rank_in_archive_order":10,"of":28,"metrics":{"mIoU":"68.3"},"uses_additional_data":false},{"leaderboard":"/sota/domain-adaptation-on-synthia-to-cityscapes","task":"Domain Adaptation","dataset":"SYNTHIA-to-Cityscapes","model":"DAFormer","rank_in_archive_order":11,"of":33,"metrics":{"mIoU":"60.9"},"uses_additional_data":false},{"leaderboard":"/sota/image-to-image-translation-on-gtav-to","task":"Image-to-Image Translation","dataset":"GTAV-to-Cityscapes Labels","model":"DAFormer","rank_in_archive_order":8,"of":22,"metrics":{"mIoU":"68.3"},"uses_additional_data":false},{"leaderboard":"/sota/image-to-image-translation-on-synthia-to","task":"Image-to-Image Translation","dataset":"SYNTHIA-to-Cityscapes","model":"DAFormer","rank_in_archive_order":7,"of":28,"metrics":{"mIoU (13 classes)":"67.4"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-dark-zurich","task":"Semantic Segmentation","dataset":"Dark Zurich","model":"DAFormer","rank_in_archive_order":7,"of":14,"metrics":{"mIoU":"53.8"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-densepass","task":"Semantic Segmentation","dataset":"DensePASS","model":"DAFormer","rank_in_archive_order":5,"of":36,"metrics":{"mIoU":"54.67%"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-gtav-to-cityscapes-1","task":"Semantic Segmentation","dataset":"GTAV-to-Cityscapes Labels","model":"DAFormer","rank_in_archive_order":6,"of":12,"metrics":{"mIoU":"68.3"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-synthia-to","task":"Semantic Segmentation","dataset":"SYNTHIA-to-Cityscapes","model":"DAFormer","rank_in_archive_order":6,"of":7,"metrics":{"Mean IoU":"60.9"},"uses_additional_data":false},{"leaderboard":"/sota/synthetic-to-real-translation-on-gtav-to","task":"Synthetic-to-Real Translation","dataset":"GTAV-to-Cityscapes Labels","model":"DAFormer","rank_in_archive_order":11,"of":73,"metrics":{"mIoU":"68.3"},"uses_additional_data":false},{"leaderboard":"/sota/synthetic-to-real-translation-on-synthia-to-1","task":"Synthetic-to-Real Translation","dataset":"SYNTHIA-to-Cityscapes","model":"DAFormer","rank_in_archive_order":9,"of":38,"metrics":{"MIoU (13 classes)":"67.4","MIoU (16 classes)":"60.9"},"uses_additional_data":false},{"leaderboard":"/sota/unsupervised-domain-adaptation-on-gtav-to","task":"Unsupervised Domain Adaptation","dataset":"GTAV-to-Cityscapes Labels","model":"DAFormer","rank_in_archive_order":10,"of":20,"metrics":{"mIoU":"68.3"},"uses_additional_data":false},{"leaderboard":"/sota/unsupervised-domain-adaptation-on-synthia-to","task":"Unsupervised Domain Adaptation","dataset":"SYNTHIA-to-Cityscapes","model":"DAFormer","rank_in_archive_order":10,"of":23,"metrics":{"mIoU":"60.9","mIoU (13 classes)":"67.4"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2111.14887","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.14887"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lhoyer/DAFormer","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dbash/visda2022-org","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kw01sg/crda","reach":null}],"summary":{"ran_honours":2,"ran_fixture":1,"ran_draft_wrong":3},"by_repo_kind":{"listed":{"samples":5,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":6,"samples":[{"code_sha256_prefix":"308b4bd2e8245ded","entry":"calc_consistency_loss","repo":"kw01sg/crda","repo_kind":"listed","path":"mmseg/models/uda/dacs.py","file_url":"https://github.com/kw01sg/crda/blob/HEAD/mmseg/models/uda/dacs.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"308b4bd2e8245ded"}},{"code_sha256_prefix":"be78c4e9ca31118d","entry":"calc_grad_magnitude","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"be78c4e9ca31118d"}},{"code_sha256_prefix":"9df38eda1ae4112c","entry":"cosine_pairwise","repo":"kw01sg/crda","repo_kind":"listed","path":"mmseg/models/uda/dacs.py","file_url":"https://github.com/kw01sg/crda/blob/HEAD/mmseg/models/uda/dacs.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9df38eda1ae4112c"}},{"code_sha256_prefix":"903b0922a749302e","entry":"get_backbone_cfg","repo":"kw01sg/crda","repo_kind":"listed","path":"experiments.py","file_url":"https://github.com/kw01sg/crda/blob/HEAD/experiments.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"903b0922a749302e"}},{"code_sha256_prefix":"3578196ac2abaecf","entry":"get_model_base","repo":"kw01sg/crda","repo_kind":"listed","path":"experiments.py","file_url":"https://github.com/kw01sg/crda/blob/HEAD/experiments.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3578196ac2abaecf"}},{"code_sha256_prefix":"7063030b369b4ce1","entry":"get_pretraining_file","repo":"kw01sg/crda","repo_kind":"listed","path":"experiments.py","file_url":"https://github.com/kw01sg/crda/blob/HEAD/experiments.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7063030b369b4ce1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}