{"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/arxiv-2601-17586","title":"Stylizing ViT: Anatomy-Preserving Instance Style Transfer for Domain Generalization","arxiv_id":"2601.17586","date":"2026-01-24","proceeding":null,"authors":["Sebastian Doerrich","Francesco Di Salvo","Jonas Alle","Christian Ledig"],"abstract":"Deep learning models in medical image analysis often struggle with generalizability across domains and demographic groups due to data heterogeneity and scarcity. Traditional augmentation improves robustness, but fails under substantial domain shifts. Recent advances in stylistic augmentation enhance domain generalization by varying image styles but fall short in terms of style diversity or by introducing artifacts into the generated images. To address these limitations, we propose Stylizing ViT, a novel Vision Transformer encoder that utilizes weight-shared attention blocks for both self- and cross-attention. This design allows the same attention block to maintain anatomical consistency through self-attention while performing style transfer via cross-attention. We assess the effectiveness of our method for domain generalization by employing it for data augmentation on three distinct image classification tasks in the context of histopathology and dermatology. Results demonstrate an improved robustness (up to +13% accuracy) over the state of the art while generating perceptually convincing images without artifacts. Additionally, we show that Stylizing ViT is effective beyond training, achieving a 17% performance improvement during inference when used for test-time augmentation. The source code is available at https://github.com/sdoerrich97/stylizing-vit .","url_abs":"https://arxiv.org/abs/2601.17586","url_pdf":"https://arxiv.org/pdf/2601.17586","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2601.17586","atlas_url":"https://app.syntology.ai/?focus=2601.17586","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2601.17586"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/sdoerrich97/stylizing-vit","reach":null}],"summary":{"unverified":9},"by_repo_kind":{"found_in_text":{"samples":9,"ran":0,"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":0,"samples":[{"code_sha256_prefix":"cb623432a457aad6","entry":"calc_mean_std","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/loss/util.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/loss/util.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb623432a457aad6"}},{"code_sha256_prefix":"cbc93ec87e94d609","entry":"compute_activation_statistics","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"experiments/metrics/stylizing.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/experiments/metrics/stylizing.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cbc93ec87e94d609"}},{"code_sha256_prefix":"601d0aa0e8eeca13","entry":"compute_consistency_loss","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/loss/consistency.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/loss/consistency.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"601d0aa0e8eeca13"}},{"code_sha256_prefix":"51720a665c6c2694","entry":"compute_frechet_distance","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"experiments/metrics/stylizing.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/experiments/metrics/stylizing.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"51720a665c6c2694"}},{"code_sha256_prefix":"ab240d4f3d074cbc","entry":"compute_identity_loss","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/loss/identity.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/loss/identity.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ab240d4f3d074cbc"}},{"code_sha256_prefix":"b4dea5c1be2f234c","entry":"denormalize_image","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/util.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/util.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b4dea5c1be2f234c"}},{"code_sha256_prefix":"b89fc1a534233cb0","entry":"get_image_paths","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"experiments/metrics/stylizing.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/experiments/metrics/stylizing.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b89fc1a534233cb0"}},{"code_sha256_prefix":"bb34211615c52585","entry":"normalize_image","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/util.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/util.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bb34211615c52585"}},{"code_sha256_prefix":"4b10e9d97b27d49a","entry":"resize_image","repo":"sdoerrich97/stylizing-vit","repo_kind":"found_in_text","path":"stylizing_vit/util.py","file_url":"https://github.com/sdoerrich97/stylizing-vit/blob/HEAD/stylizing_vit/util.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4b10e9d97b27d49a"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}