Skip to content

HAIV-Lab/openhaiv

Repository files navigation

🌍 OpenHAIV

A Framework for Open-World Learning

LICENSEPython PyTorch

[Manual] [Arxiv] [Dataset] [Forum]

Star to bookmark, fork & cite if you use, and welcome to contribute!

👋 Welcome to OpenHAIV

intro

OpenHAIV is a comprehensive framework for open-world object recognition, supporting out-of-distribution detection, novel class discovery, and incremental learning. It is designed to enable robust and flexible object recognition in unconstrained environments.

pipeline

The framework adopts a modular design overall, which is reflected in two key aspects.

  • 🛠️ Functionally: The framework independently incorporates dedicated modules for supervised training, out-of-distribution detection, novel class discovery, and incremental learning.
  • ⚙️ Procedurally:The framework divides its operational workflow into distinct stages, including data processing, model construction, training and evaluation, and visualization.

⭐ Key Features

🧩 Modular Design
  • Easy experimentation with different algorithms
  • Seamless integration of new techniques
  • Flexible deployment configurations
🚀 Scalable Architecture
  • Large-scale dataset processing
  • Distributed training capabilities
  • Efficient memory management
  • Parallel processing optimization
🔌 Extensible Framework
  • Plugin-based algorithm integration
  • Custom loss function support
  • Flexible evaluation metrics
  • Comprehensive logging and monitoring

📑 Table of Contents

🎉 News

[08/2025] 🌟 Our paper "OpenHAIV: A Framework Towards Practical Open-World Learning" is available at [Arxiv]. [08/2025] 🌟 The code repository is is now publicly available. [09/2024] 🌟 The code repository is created.

📋 TODO List

  • Implement core framework structure
  • Support basic OOD detection methods
  • Support basic class-incremental learning methods
  • Complete Novel Class Discovery implementation
  • Add comprehensive benchmarks and evaluation metrics
  • Add Data Augmentation techniques
  • Create detailed documentation and tutorials
  • Add visualization tools for analysis
  • Support Windows & macOS installation guide
  • Create Jupyter notebook examples
  • Set up continuous integration for testing
  • Add pre-trained model zoo
  • Implement unified evaluation protocols

🚀 Getting Started

📦 Installation

It is recommended to use anaconda3 to manage and maintain the python library environment.

  1. Download the .sh file from the anaconda3 website
  2. Install anaconda3 with .sh file
bash Anaconda3-2023.03-Linux-x86_64.sh

🔧 Environment Setup

Create and activate a virtual environment:

conda create -n openhaiv python=3.10 -y
conda activate openhaiv
pip install -r requirements.txt
python setup.py install

Required packages:

  • pytorch>=1.12.0 torchvision>=0.13.0 (recommend official torch command)
  • numpy>=1.26.4
  • scipy>=1.14.0
  • scikit-learn>=1.5.1

🏃‍♂️ Running Examples

Out-of-Distribution Detection

python ncdia/train.py --cfg configs/pipeline/ood_detection/msp/det_oes_rn50_msp_train.yaml --opts device='cuda:0'

Class-incremental Learning

bash ./scripts/inc_BM200_lwf.sh

Novel Class Discovery

# Set required parameters
# - model weight in weight_path
# - id_txt_file and ood_txt_file
# - output_dir

python ncd.py

🤖 Supported Models

ResNetViTCLIP

📚 Supported Methods

🌱 Class-incremental learning

CNN-based methods
Method Paper Venue
Joint update models using all the data from all classes
Finetune baseline method which simply updates model using current data
LwF Learning without Forgetting ECCV 2016
EWC Overcoming catastrophic forgetting in neural networks PNAS 2017
iCaRL Incremental Classifier and Representation Learning CVPR 2017
BiC Large Scale Incremental Learning CVPR 2019
WA Maintaining Discrimination and Fairness in Class Incremental Learning CVPR 2020

|GEM|Gradient Episodic Memory for Continual Learning|NIPS 2017| |SSRE|Self-Sustaining Representation Expansion for Non-Exemplar Class-Incremental Learning|CVPR 2022|

ViT-based methods
Method Paper Venue
Joint update models using all the data from all classes
Finetune baseline method which simply updates model using current data
CLIP-based methods
Method Paper Venue
Joint update models using all the data from all classes
Finetune baseline method which simply updates model using current data
Few-shot class-incremental learning
Method Paper Venue
Alice Few-Shot Class-Incremental Learning from an Open-Set Perspective ECCV 2022
FACT Forward Compatible Few-Shot Class-Incremental Learning CVPR 2022
SAVC Semantic-Aware Virtual Contrastive Constraint for Few-Shot Class-Incremental Learning CVPR 2023

🚨 Out-of-Distribution Detection

CNN-based Methods
Method Paper Venue
MSP A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks ICLR 2017
ODIN Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks ICLR 2018
MDS A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attacks NeurIPS 2018
MLS Scaling Out-of-Distribution Detection for Real-World Settings ICML 2022
ViM Out-Of-Distribution with Virtual-logit Matching CVPR 2022
FDBD Fast Decision Boundary based Out-of-Distribution Detector ICML 2024
VOS Learning What You Don't Know by Virtual Outlier Synthesis ICLR 2022
LogitNorm Mitigating Neural Network Overconfidence with Logit Normalization ICML 2022
DML Decoupling MaxLogit for Out-of-Distribution Detection CVPR 2023
CLIP-based Methods
Method Paper Venue
MCM Delving into Out-of-Distribution Detection with Vision-Language Representations NeurIPS 2022
GLMCM Global and Local Maximum Concept Matching for Zero-Shot Out-of-Distribution Detection IJCV 2025
CoOp Learning to Prompt for Vision-Language Models IJCV 2022
LoCoOp Few-Shot Out-of-Distribution Detection via Prompt Learning NeurIPS 2023
SCT Self-Calibrated Tuning of Vision-Language Models for Out-of-Distribution Detection NeurIPS 2024
DPM Vision-Language Dual-Pattern Matching for Out-of-Distribution Detection ECCV 2024

🔍 Novel Class Discovery

TBD

🧬 Data Augmentation

TBD

🛠️ Contributing Guidelines

We welcome contributions to OpenHAIV🤗 If you're interested in improving the project, please follow these guidelines:

🧹 Code Style

This project uses pre-commit to automatically enforce code style and quality before each commit. Please install pre-commit and run:

pip install pre-commit
pre-commit install

The main checks include:

  • flake8: PEP8 code style checking
  • yapf: automatic Python code formatting
  • codespell: spell checking
  • docformatter: automatic docstring formatting
  • trailing-whitespace, end-of-file-fixer, mixed-line-ending and other basic formatting fixes

See the .pre-commit-config.yaml file for detailed configuration. All these checks and fixes will be run automatically before every commit.

Note: After running pre-commit install, the configured hooks will automatically run on every git commit. It is recommended to run pre-commit run --all-files once to fix and harmonize existing files in the repository before making commits. To skip hooks for a specific commit, use git commit --no-verify (not recommended).

📜 Code of Conduct

Please note that all contributors are expected to follow our Code of Conduct to foster a welcoming and inclusive community.

🐛 Reporting Issues

  1. Check existing issues first to avoid duplicates
  2. Use the issue template when available
  3. Be specific about the problem:
    • Include steps to reproduce
    • Provide environment details (OS, Python version, dependencies)
    • Add screenshots if applicable
    • Describe expected vs. actual behavior

💡 Submitting Pull Requests

  1. Create an issue first to discuss major changes
  2. Fork the repository and create a branch from main
  3. Follow the coding style used throughout the project:
    • Adhere to PEP 8 guidelines
    • Use meaningful variable/function names
    • Add docstrings for new functions/classes
  4. Write tests for new features
  5. Ensure all tests pass before submitting
  6. Update documentation reflecting your changes
  7. Make atomic commits with clear messages

🤝Contributors

Xiang Xiang, Qinhao Zhou, Jing Ma, Zhuo Xu, Jiaxin Dai, Yifan Liang, Hanlin Li, Yao Deng, Zhipeng Chen, Zihan Zhang, Yuwen Tan.

📖Citation

If you find our repository useful for your research, please consider citing these papers:

@article{xiang2025openhaiv,
  title={OpenHAIV: A Framework Towards Practical Open-World Learning},
  author={Xiang, Xiang and Zhou, Qinhao and Xu, Zhuo and Ma, Jing and Dai, Jiaxin and Liang, Yifan and Li, Hanlin},
  journal={arXiv preprint arXiv:2508.07270},
  year={2025},
  url={https://arxiv.org/abs/2508.07270},
  doi={10.48550/arXiv.2508.07270}
}

🙏Acknowledgement

  • OpenOOD, an extensible codebase for out-of-distribution detection with Vision Models only.
  • OpenOOD-VLM, an extensible codebase for out-of-distribution detection with both Vision Models and Vision-Language Models.
  • PyCIL, an extensible codebase for incremental learning.

✉️Contact

If there are any questions, please feel free to propose new features by opening an issue or contact with the team leader: Xiang Xiang (xex@hust.edu.cn). Enjoy the code.

About

OpenHAIV is an open-source deep-learning framework for open-world learning developed by HAIV Lab

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors