{"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/local-prediction-aggregation-a-frustratingly","title":"Attracting and Dispersing: A Simple Approach for Source-free Domain Adaptation","arxiv_id":"2205.04183","date":"2022-05-09","proceeding":null,"authors":["Shiqi Yang","Yaxing Wang","Kai Wang","Shangling Jui","Joost Van de Weijer"],"abstract":"We propose a simple but effective source-free domain adaptation (SFDA) method. Treating SFDA as an unsupervised clustering problem and following the intuition that local neighbors in feature space should have more similar predictions than other features, we propose to optimize an objective of prediction consistency. This objective encourages local neighborhood features in feature space to have similar predictions while features farther away in feature space have dissimilar predictions, leading to efficient feature clustering and cluster assignment simultaneously. For efficient training, we seek to optimize an upper-bound of the objective resulting in two simple terms. Furthermore, we relate popular existing methods in domain adaptation, source-free domain adaptation and contrastive learning via the perspective of discriminability and diversity. The experimental results prove the superiority of our method, and our method can be adopted as a simple but strong baseline for future research in SFDA. Our method can be also adapted to source-free open-set and partial-set DA which further shows the generalization ability of our method. Code is available in https://github.com/Albert0147/AaD_SFDA.","url_abs":"https://arxiv.org/abs/2205.04183v3","url_pdf":"https://arxiv.org/pdf/2205.04183v3.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":"local-prediction-aggregation-a-frustratingly","repo_url":"https://github.com/Albert0147/AaD_SFDA","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"clustering","task_name":"Clustering"},{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"domain-adaptation","task_name":"Domain Adaptation"},{"task_slug":"source-free-domain-adaptation","task_name":"Source-Free Domain Adaptation"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2205.04183","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2205.04183"}},"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":"deterministic:regex_extraction","url":"https://github.com/Albert0147/AaD_SFDA","reach":null}],"summary":{"ran_draft_wrong":6,"ran":5,"ran_fixture":1,"ran_honours":2,"unverified":6},"by_repo_kind":{"official":{"samples":19,"ran":13,"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":20,"samples":[{"code_sha256_prefix":"94b5622f0aa7add1","entry":"Entropy","repo":"albert0147/aad_sfda","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"94b5622f0aa7add1"}},{"code_sha256_prefix":"29a200f471d3e584","entry":"ImageList","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"29a200f471d3e584"}},{"code_sha256_prefix":"2656e8041cf0976a","entry":"ImageList_idx","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2656e8041cf0976a"}},{"code_sha256_prefix":"c21ea96c206930a5","entry":"data_load","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c21ea96c206930a5"}},{"code_sha256_prefix":"1b0bf9bd060bf1a1","entry":"entropy","repo":"albert0147/aad_sfda","repo_kind":"official","path":"snd.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/snd.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":"1b0bf9bd060bf1a1"}},{"code_sha256_prefix":"bc18e428d402b43f","entry":"feat_bootleneck","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bc18e428d402b43f"}},{"code_sha256_prefix":"b399adf09d082dd0","entry":"feat_classifier","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b399adf09d082dd0"}},{"code_sha256_prefix":"6e4265b7f707b718","entry":"image_test","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.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":"6e4265b7f707b718"}},{"code_sha256_prefix":"35c2d572ebd185f5","entry":"image_train","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.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":"35c2d572ebd185f5"}},{"code_sha256_prefix":"edd7184ac144c4fa","entry":"l_loader","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"edd7184ac144c4fa"}},{"code_sha256_prefix":"0b7ffc9f8b77529c","entry":"lr_scheduler","repo":"albert0147/aad_sfda","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/tar_adaptation.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":"0b7ffc9f8b77529c"}},{"code_sha256_prefix":"d65e3432f6044080","entry":"neighbor_density","repo":"albert0147/aad_sfda","repo_kind":"official","path":"snd.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/snd.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d65e3432f6044080"}},{"code_sha256_prefix":"93a11f62e4a129f0","entry":"op_copy","repo":"albert0147/aad_sfda","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/tar_adaptation.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":"93a11f62e4a129f0"}},{"code_sha256_prefix":"2c5ce24ea2b5d2a4","entry":"rgb_loader","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":"2c5ce24ea2b5d2a4"}},{"code_sha256_prefix":"021396acc21d576b","entry":"ResBase","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"021396acc21d576b"}},{"code_sha256_prefix":"d1a7084d06a46573","entry":"cal_acc","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d1a7084d06a46573"}},{"code_sha256_prefix":"be479145bbff6328","entry":"init_weights","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"be479145bbff6328"}},{"code_sha256_prefix":"2301055cb33836bc","entry":"make_dataset","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2301055cb33836bc"}},{"code_sha256_prefix":"2915c52d644c501d","entry":"test_and_nd","repo":"albert0147/aad_sfda","repo_kind":"official","path":"snd.py","file_url":"https://github.com/albert0147/aad_sfda/blob/HEAD/snd.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2915c52d644c501d"}},{"code_sha256_prefix":"95d25d047e1cb25e","entry":"train_target","repo":"Albert0147/AaD_SFDA","repo_kind":"official","path":"tar_adaptation.py","file_url":"https://github.com/Albert0147/AaD_SFDA/blob/HEAD/tar_adaptation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"95d25d047e1cb25e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}