{"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/universal-novelty-detection-through-adaptive-1","title":"Universal Novelty Detection Through Adaptive Contrastive Learning","arxiv_id":"2408.10798","date":"2024-08-20","proceeding":"CVPR 2024 1","authors":["Hossein Mirzaei","Mojtaba Nafez","Mohammad Jafari","Mohammad Bagher Soltani","Mohammad Azizmalayeri","Jafar Habibi","Mohammad Sabokrou","Mohammad Hossein Rohban"],"abstract":"Novelty detection is a critical task for deploying machine learning models in the open world. A crucial property of novelty detection methods is universality, which can be interpreted as generalization across various distributions of training or test data. More precisely, for novelty detection, distribution shifts may occur in the training set or the test set. Shifts in the training set refer to cases where we train a novelty detector on a new dataset and expect strong transferability. Conversely, distribution shifts in the test set indicate the methods' performance when the trained model encounters a shifted test sample. We experimentally show that existing methods falter in maintaining universality, which stems from their rigid inductive biases. Motivated by this, we aim for more generalized techniques that have more adaptable inductive biases. In this context, we leverage the fact that contrastive learning provides an efficient framework to easily switch and adapt to new inductive biases through the proper choice of augmentations in forming the negative pairs. We propose a novel probabilistic auto-negative pair generation method AutoAugOOD, along with contrastive learning, to yield a universal novelty detector method. Our experiments demonstrate the superiority of our method under different distribution shifts in various image benchmark datasets. Notably, our method emerges universality in the lens of adaptability to different setups of novelty detection, including one-class, unlabeled multi-class, and labeled multi-class settings. Code: https://github.com/mojtaba-nafez/UNODE","url_abs":"https://arxiv.org/abs/2408.10798v1","url_pdf":"https://arxiv.org/pdf/2408.10798v1.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":"universal-novelty-detection-through-adaptive-1","repo_url":"https://github.com/mojtaba-nafez/unode","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"novelty-detection","task_name":"Novelty Detection"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.10798","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.10798"}},"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/mojtaba-nafez/unode","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran":7,"unverified":1},"by_repo_kind":{"official":{"samples":11,"ran":10,"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":"bb8ab909ec16a7ce","entry":"NT_xent","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"training/contrastive_loss.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/training/contrastive_loss.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bb8ab909ec16a7ce"}},{"code_sha256_prefix":"d9def42110729a85","entry":"conv1x1","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"models/custom_resnet.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/models/custom_resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9def42110729a85"}},{"code_sha256_prefix":"160bb14bd76201b4","entry":"conv3x3","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"models/custom_resnet.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/models/custom_resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"160bb14bd76201b4"}},{"code_sha256_prefix":"03e22dcc6d7e01c6","entry":"get_scores","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"evals/evaluation.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/evals/evaluation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"03e22dcc6d7e01c6"}},{"code_sha256_prefix":"457b64cd7b18e55e","entry":"get_shift_classifer","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"models/classifier.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/models/classifier.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"457b64cd7b18e55e"}},{"code_sha256_prefix":"5afb67f2ad4530ff","entry":"get_similarity_matrix","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"training/contrastive_loss.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/training/contrastive_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5afb67f2ad4530ff"}},{"code_sha256_prefix":"97da93f54f25c345","entry":"get_transform","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"datasets/datasets.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/datasets/datasets.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"97da93f54f25c345"}},{"code_sha256_prefix":"2eaf3c05de1ab054","entry":"hsv2rgb","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"models/transform_layers.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/models/transform_layers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2eaf3c05de1ab054"}},{"code_sha256_prefix":"592e441f221bb9a3","entry":"rgb2hsv","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"models/transform_layers.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/models/transform_layers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"592e441f221bb9a3"}},{"code_sha256_prefix":"f54435250a4f87b7","entry":"sparse2coarse","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"datasets/custom_datasets.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/datasets/custom_datasets.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f54435250a4f87b7"}},{"code_sha256_prefix":"da1f55b9381f8dcb","entry":"parse_args","repo":"mojtaba-nafez/unode","repo_kind":"official","path":"args.py","file_url":"https://github.com/mojtaba-nafez/unode/blob/HEAD/args.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da1f55b9381f8dcb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}