{"id":15037371,"url":"https://github.com/zhengpeng7/birefnet","last_synced_at":"2025-05-14T07:10:19.289Z","repository":{"id":226269445,"uuid":"525717745","full_name":"ZhengPeng7/BiRefNet","owner":"ZhengPeng7","description":"[CAAI AIR'24] Bilateral Reference for High-Resolution Dichotomous Image Segmentation","archived":false,"fork":false,"pushed_at":"2025-05-08T07:38:49.000Z","size":5576,"stargazers_count":2184,"open_issues_count":16,"forks_count":162,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-05-08T08:20:07.724Z","etag":null,"topics":["background-removal","birefnet","camouflaged-object-detection","dichotomous-image-segmentation","high-resolution-image-segmentation","image-segmentation","salient-object-detection"],"latest_commit_sha":null,"homepage":"https://www.birefnet.top","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZhengPeng7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-17T09:13:39.000Z","updated_at":"2025-05-08T07:38:52.000Z","dependencies_parsed_at":"2024-05-11T05:23:51.577Z","dependency_job_id":"b0812d3c-ce6f-49c4-8f26-622fde95aab1","html_url":"https://github.com/ZhengPeng7/BiRefNet","commit_stats":{"total_commits":281,"total_committers":7,"mean_commits":"40.142857142857146","dds":0.02135231316725983,"last_synced_commit":"efdfbbb1259255489fce8151b88b5948039b8421"},"previous_names":["zhengpeng7/birefnet"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengPeng7%2FBiRefNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengPeng7%2FBiRefNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengPeng7%2FBiRefNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengPeng7%2FBiRefNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZhengPeng7","download_url":"https://codeload.github.com/ZhengPeng7/BiRefNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092792,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["background-removal","birefnet","camouflaged-object-detection","dichotomous-image-segmentation","high-resolution-image-segmentation","image-segmentation","salient-object-detection"],"created_at":"2024-09-24T20:34:27.950Z","updated_at":"2025-05-14T07:10:14.277Z","avatar_url":"https://github.com/ZhengPeng7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eBilateral Reference for High-Resolution Dichotomous Image Segmentation\u003c/h1\u003e\n\n\u003cdiv align='center'\u003e\n    \u003ca href='https://scholar.google.com/citations?user=TZRzWOsAAAAJ' target='_blank'\u003e\u003cstrong\u003ePeng Zheng\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 1,4,5,6\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=0uPb8MMAAAAJ' target='_blank'\u003e\u003cstrong\u003eDehong Gao\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 2\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=kakwJ5QAAAAJ' target='_blank'\u003e\u003cstrong\u003eDeng-Ping Fan\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 1*\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=9cMQrVsAAAAJ' target='_blank'\u003e\u003cstrong\u003eLi Liu\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 3\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=qQP6WXIAAAAJ' target='_blank'\u003e\u003cstrong\u003eJorma Laaksonen\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 4\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=pw_0Z_UAAAAJ' target='_blank'\u003e\u003cstrong\u003eWanli Ouyang\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 5\u003c/sup\u003e,\u0026thinsp;\n    \u003ca href='https://scholar.google.com/citations?user=stFCYOAAAAAJ' target='_blank'\u003e\u003cstrong\u003eNicu Sebe\u003c/strong\u003e\u003c/a\u003e\u003csup\u003e 6\u003c/sup\u003e\n\u003c/div\u003e\n\n\u003cdiv align='center'\u003e\n    \u003csup\u003e1 \u003c/sup\u003eNankai University\u0026ensp;  \u003csup\u003e2 \u003c/sup\u003eNorthwestern Polytechnical University\u0026ensp;  \u003csup\u003e3 \u003c/sup\u003eNational University of Defense Technology\u0026ensp; \n    \u003cbr /\u003e\n    \u003csup\u003e4 \u003c/sup\u003eAalto University\u0026ensp;  \u003csup\u003e5 \u003c/sup\u003eShanghai AI Laboratory\u0026ensp;  \u003csup\u003e6 \u003c/sup\u003eUniversity of Trento\u0026ensp; \n\u003c/div\u003e\n\n\u003cdiv align=\"center\" style=\"display: flex; justify-content: center; flex-wrap: wrap;\"\u003e\n  \u003ca href='https://www.sciopen.com/article/pdf/10.26599/AIR.2024.9150038.pdf'\u003e\u003cimg src='https://img.shields.io/badge/Journal-Paper-red'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://arxiv.org/pdf/2401.03407'\u003e\u003cimg src='https://img.shields.io/badge/arXiv-Paper-red'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://drive.google.com/file/d/1FWvKDWTnK9RsiywfCsIxsnQzqv-dlO5u/view'\u003e\u003cimg src='https://img.shields.io/badge/中文版-Paper-red'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://www.birefnet.top'\u003e\u003cimg src='https://img.shields.io/badge/Page-Project-red'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM'\u003e\u003cimg src='https://img.shields.io/badge/GDrive-Stuff-green'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='LICENSE'\u003e\u003cimg src='https://img.shields.io/badge/License-MIT-yellow'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://huggingface.co/spaces/ZhengPeng7/BiRefNet_demo'\u003e\u003cimg src='https://img.shields.io/badge/%F0%9F%A4%97%20HF-Space-blue'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://huggingface.co/ZhengPeng7/BiRefNet'\u003e\u003cimg src='https://img.shields.io/badge/%F0%9F%A4%97%20HF-Model-blue'\u003e\u003c/a\u003e\u0026ensp; \n\u003c/div\u003e\n\n\u003cdiv align=\"center\" style=\"display: flex; justify-content: center; flex-wrap: wrap;\"\u003e\n  \u003ca href='https://colab.research.google.com/drive/14Dqg7oeBkFEtchaHLNpig2BcdkZEogba'\u003e\u003cimg src='https://img.shields.io/badge/Multiple_Images_Inference-F9AB00?style=for-the-badge\u0026logo=googlecolab\u0026color=525252'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://colab.research.google.com/drive/1MaEiBfJ4xIaZZn0DqKrhydHB8X97hNXl'\u003e\u003cimg src='https://img.shields.io/badge/Inference_\u0026_Evaluation-F9AB00?style=for-the-badge\u0026logo=googlecolab\u0026color=525252'\u003e\u003c/a\u003e\u0026ensp; \n  \u003ca href='https://colab.research.google.com/drive/1B6aKZ3ekcvKMkSBn0N5mCASLUYMp0whK'\u003e\u003cimg src='https://img.shields.io/badge/Box_Guided_Segmentation-F9AB00?style=for-the-badge\u0026logo=googlecolab\u0026color=525252'\u003e\u003c/a\u003e\u0026ensp; \n\u003c/div\u003e\n\n\n|            *DIS-Sample_1*        |             *DIS-Sample_2*        |\n| :------------------------------: | :-------------------------------: |\n| \u003cimg src=\"https://drive.google.com/thumbnail?id=1ItXaA26iYnE8XQ_GgNLy71MOWePoS2-g\u0026sz=w400\" /\u003e |  \u003cimg src=\"https://drive.google.com/thumbnail?id=1Z-esCujQF_uEa_YJjkibc3NUrW4aR_d4\u0026sz=w400\" /\u003e |\n\nThis repo is the official implementation of \"[**Bilateral Reference for High-Resolution Dichotomous Image Segmentation**](https://arxiv.org/pdf/2401.03407)\" (___CAAI AIR 2024___).\n\n\u003e [!note]\n\u003e **We need more GPU resources** to push forward the performance of BiRefNet, especially on *video* tasks and more *efficient* model designs on higher-resolution images. If you are happy to cooperate, please contact me at zhengpeng0108@gmail.com.\n\n## News :newspaper:\n* **`Feb 12, 2025`:**  We released the [BiRefNet_HR-matting](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting) for general matting use, which was trained on images in `2048x2048` and shows great matting performance on higher resolution images! Thanks again to [Freepik](https://www.freepik.com) their kind GPU support.\n* **`Feb 1, 2025`:**  We released the [BiRefNet_HR](https://huggingface.co/ZhengPeng7/BiRefNet_HR) for general use, which was trained on images in `2048x2048` and shows great performance on higher resolution images! Thanks to [Freepik](https://www.freepik.com) for offering H200x4 GPU for this huge training (~3 weeks).\n* **`Jan 6, 2025`:**  Validate the success of FP16 inference with ~0 decrease of performance and better efficiency: the standard BiRefNet can run in `17 FPS` with `resolution==1024x1024` with `3.45GB GPU memory` on a single `RTX 4090`. Check more details in the model efficiency part below in [model zoo section](https://github.com/ZhengPeng7/BiRefNet?tab=readme-ov-file#model-zoo).\n* **`Dec 5, 2024`:**  Fix the bug of using `torch.compile` in latest PyTorch versions (2.5.1) and the slow iteration in FP16 training with accelerate (set as default).\n* **`Nov 28, 2024`:**  Congrats to students @Nankai University employed BiRefNet to build their project and won the [provincial gold medal](https://drive.google.com/file/d/1WDgcHzzmbPtj3O4tlZyT3HLfNKLBPkje/view?usp=drive_link) and [national bronze medal](https://cy.ncss.cn/information/2c93f4c691983c5b0194264b1880207b) on the [China International College Students’ Innovation Competition 2024](https://cy.ncss.cn/en).\n* **`Oct 26, 2024`:**  We added the [guideline of conducting fine-tuning on custom data](https://github.com/ZhengPeng7/BiRefNet?tab=readme-ov-file#pen-fine-tuning-on-custom-data) with existing weights.\n* **`Oct 6, 2024`:**  We uploaded the [BiRefNet-matting](https://huggingface.co/ZhengPeng7/BiRefNet-matting) model for general trimap-free matting use.\n* **`Sep 24, 2024`:**  We uploaded the [BiRefNet_lite-2K](https://huggingface.co/ZhengPeng7/BiRefNet_lite-2K) model, which takes inputs in a much higher resolution (2560x1440). We also added the [notebook](https://github.com/ZhengPeng7/BiRefNet/blob/main/tutorials/BiRefNet_inference_video.ipynb) for inference on videos.\n* **`Sep 7, 2024`:**  Thanks to [Freepik](https://www.freepik.com) for supporting me with GPUs for more extensive experiments, especially on BiRefNet for 2K inference!\n* **`Aug 30, 2024`:** We uploaded notebooks in `tutorials` to run the inference and ONNX conversion locally.\n* **`Aug 23, 2024`:** Our BiRefNet is now officially released [online](https://www.sciopen.com/article/10.26599/AIR.2024.9150038) on CAAI AIR journal. And thanks to the [press release](https://www.eurekalert.org/news-releases/1055380).\n* **`Aug 19, 2024`:** We uploaded the ONNX model files of all weights in the [GitHub release](https://github.com/ZhengPeng7/BiRefNet/releases/tag/v1) and [GDrive folder](https://drive.google.com/drive/u/0/folders/1kZM55bwsRdS__bdnsXpkmH6QPyza-9-N). Check out the **ONNX conversion** part in [model zoo](https://github.com/ZhengPeng7/BiRefNet?tab=readme-ov-file#model-zoo) for more details.\n* **`Jul 30, 2024`:** Thanks to @not-lain for his kind efforts in adding BiRefNet to the official huggingface.js [repo](https://github.com/huggingface/huggingface.js/blob/3a8651fbc6508920475564a692bf0e5b601d9343/packages/tasks/src/model-libraries-snippets.ts#L763).\n* **`Jul 28, 2024`:** We released the [Colab demo for box-guided segmentation](https://colab.research.google.com/drive/1B6aKZ3ekcvKMkSBn0N5mCASLUYMp0whK).\n* **`Jul 15, 2024`:** We deployed our BiRefNet on [Hugging Face Models](https://huggingface.co/ZhengPeng7/BiRefNet) for users to easily load it in one line code.\n* **`Jun 21, 2024`:** We released and uploaded the Chinese version of our original paper to my [GDrive](https://drive.google.com/file/d/1aBnJ_R9lbnC2dm8dqD0-pzP2Cu-U1Xpt/view).\n* **`May 28, 2024`:** We hold a [model zoo](https://github.com/ZhengPeng7/BiRefNet?tab=readme-ov-file#model-zoo) with well-trained weights of our BiRefNet in different sizes and for different tasks, including general use, matting segmentation, DIS, HRSOD, COD, etc.\n* **`May 7, 2024`:**  We also released the [Colab demo for multiple images inference](https://colab.research.google.com/drive/14Dqg7oeBkFEtchaHLNpig2BcdkZEogba). Many thanks to @rishabh063 for his support on it.\n* **`Apr 9, 2024`:**  Thanks to [Features and Labels Inc.](https://fal.ai/) for deploying a cool online BiRefNet [inference API](https://fal.ai/models/fal-ai/birefnet/playground) and providing me with strong GPU resources for 4 months on more extensive experiments!\n* **`Mar 7, 2024`:**  We released BiRefNet codes, the well-trained weights for all tasks in the original papers, and all related stuff in my [GDrive folder](https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM). Meanwhile, we also deployed our BiRefNet on [Hugging Face Spaces](https://huggingface.co/spaces/ZhengPeng7/BiRefNet_demo) for easier online use and released the [Colab demo for inference and evaluation](https://colab.research.google.com/drive/1MaEiBfJ4xIaZZn0DqKrhydHB8X97hNXl).\n* **`Jan 7, 2024`:**  We released our paper on [arXiv](https://arxiv.org/pdf/2401.03407).\n\n\n## :rocket: Load BiRefNet in _ONE LINE_ by HuggingFace, check more: [![BiRefNet](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/ZhengPeng7/birefnet)\n```python\nfrom transformers import AutoModelForImageSegmentation\nbirefnet = AutoModelForImageSegmentation.from_pretrained('zhengpeng7/BiRefNet', trust_remote_code=True)\n```\n## :flight_arrival: Inference Partner:\nYou can access the **inference API** service of BiRefNet on [FAL](https://fal.ai) or click the `Deploy` button on our [HF model page](https://huggingface.co/ZhengPeng7/BiRefNet) to set up your own deployment.\n+ https://fal.ai/models/fal-ai/birefnet/v2\n+ https://ui.endpoints.huggingface.co/new?repository=ZhengPeng7/BiRefNet\n\nOur BiRefNet has achieved SOTA on many similar HR tasks:\n\n**DIS**: [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/dichotomous-image-segmentation-on-dis-te1)](https://paperswithcode.com/sota/dichotomous-image-segmentation-on-dis-te1?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/dichotomous-image-segmentation-on-dis-te2)](https://paperswithcode.com/sota/dichotomous-image-segmentation-on-dis-te2?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/dichotomous-image-segmentation-on-dis-te3)](https://paperswithcode.com/sota/dichotomous-image-segmentation-on-dis-te3?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/dichotomous-image-segmentation-on-dis-te4)](https://paperswithcode.com/sota/dichotomous-image-segmentation-on-dis-te4?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/dichotomous-image-segmentation-on-dis-vd)](https://paperswithcode.com/sota/dichotomous-image-segmentation-on-dis-vd?p=bilateral-reference-for-high-resolution)\n\n\u003cdetails\u003e\u003csummary\u003eFigure of Comparison on DIS Papers with Codes (by the time of this work):\u003c/summary\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1DLt6CFXdT1QSWDj_6jRkyZINXZ4vmyRp\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1gn5GyKFlJbMIkre1JyEdHDSYcrFmcLD0\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=16CVYYOtafEeZhHqv0am2Daku1n_exMP6\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=10K45xwPXmaTG4Ex-29ss9payA9yBnyLn\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=16EuyqKFJOqwMmagvfnbC9hUurL9pYLLB\u0026sz=w1620\" /\u003e\n\u003c/details\u003e\n\u003cbr /\u003e\n\n**COD**:[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/camouflaged-object-segmentation-on-cod)](https://paperswithcode.com/sota/camouflaged-object-segmentation-on-cod?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/camouflaged-object-segmentation-on-nc4k)](https://paperswithcode.com/sota/camouflaged-object-segmentation-on-nc4k?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/camouflaged-object-segmentation-on-camo)](https://paperswithcode.com/sota/camouflaged-object-segmentation-on-camo?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/camouflaged-object-segmentation-on-chameleon)](https://paperswithcode.com/sota/camouflaged-object-segmentation-on-chameleon?p=bilateral-reference-for-high-resolution)\n\n\u003cdetails\u003e\u003csummary\u003eFigure of Comparison on COD Papers with Codes (by the time of this work):\u003c/summary\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1DLt6CFXdT1QSWDj_6jRkyZINXZ4vmyRp\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1gn5GyKFlJbMIkre1JyEdHDSYcrFmcLD0\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=16CVYYOtafEeZhHqv0am2Daku1n_exMP6\u0026sz=w1620\" /\u003e\n\u003c/details\u003e\n\u003cbr /\u003e\n\n**HRSOD**: [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/rgb-salient-object-detection-on-davis-s)](https://paperswithcode.com/sota/rgb-salient-object-detection-on-davis-s?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/rgb-salient-object-detection-on-hrsod)](https://paperswithcode.com/sota/rgb-salient-object-detection-on-hrsod?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/rgb-salient-object-detection-on-uhrsd)](https://paperswithcode.com/sota/rgb-salient-object-detection-on-uhrsd?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/salient-object-detection-on-duts-te)](https://paperswithcode.com/sota/salient-object-detection-on-duts-te?p=bilateral-reference-for-high-resolution) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/bilateral-reference-for-high-resolution/salient-object-detection-on-dut-omron)](https://paperswithcode.com/sota/salient-object-detection-on-dut-omron?p=bilateral-reference-for-high-resolution)\n\n\u003cdetails\u003e\u003csummary\u003eFigure of Comparison on HRSOD Papers with Codes (by the time of this work):\u003c/summary\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1hNfQtlTAHT4-AVbk_47852zyRp1NOFLs\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1bcVldUAxYkMI3OMTyaP_jNuOugDfYj-d\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1p1zgyVz27cGEqQMtOKzm_6zoYK3Sw_Zk\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1TubAvcoEbH_mHu3I-AxflnB71nkf35jJ\u0026sz=w1620\" /\u003e\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1A3V9HjVtcMQdnGPwuy-DBVhwKuo0q2lT\u0026sz=w1620\" /\u003e\n\u003c/details\u003e\n\u003cbr /\u003e\n\n#### Try our online demos for inference:\n\n+ **Inference and evaluation** of your given weights: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1MaEiBfJ4xIaZZn0DqKrhydHB8X97hNXl)\n+ **Online Inference with GUI** with adjustable resolutions: [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/ZhengPeng7/BiRefNet_demo)  \n+ Online **Multiple Images Inference** on Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14Dqg7oeBkFEtchaHLNpig2BcdkZEogba)\n\n\u003cimg src=\"https://drive.google.com/thumbnail?id=12XmDhKtO1o2fEvBu4OE4ULVB2BK0ecWi\u0026sz=w1620\" /\u003e\n\n\n\n## Model Zoo\n\n\u003e For more general use of our BiRefNet, I extended the original academic one to more general ones for better real-life application.\n\u003e\n\u003e Datasets and datasets are suggested to be downloaded from official pages. But you can also download the packaged ones: [DIS](https://drive.google.com/drive/folders/1hZW6tAGPJwo9mPS7qGGGdpxuvuXiyoMJ), [HRSOD](https://drive.google.com/drive/folders/18_hAE3QM4cwAzEAKXuSNtKjmgFXTQXZN), [COD](https://drive.google.com/drive/folders/1EyHmKWsXfaCR9O0BiZEc3roZbRcs4ECO), [Backbones](https://drive.google.com/drive/folders/1cmce_emsS8A5ha5XT2c_CZiJzlLM81ms).\n\u003e\n\u003e Find performances (almost all metrics) of all models in the `exp-TASK_SETTINGS` folders in [[**stuff**](https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM)].\n\n\n\n\u003cdetails\u003e\u003csummary\u003eModels in the original paper, for \u003cb\u003ecomparison on benchmarks\u003c/b\u003e:\u003c/summary\u003e\n\n| Task  |        Training Sets        |   Backbone    |                           Download                           |\n| :---: | :-------------------------: | :-----------: | :----------------------------------------------------------: |\n|  DIS  |          DIS5K-TR           | swin_v1_large | [google-drive](https://drive.google.com/file/d/1J90LucvDQaS3R_-9E7QUh1mgJ8eQvccb/view) |\n|  COD  |     COD10K-TR, CAMO-TR      | swin_v1_large | [google-drive](https://drive.google.com/file/d/1tM5M72k7a8aKF-dYy-QXaqvfEhbFaWkC/view) |\n| HRSOD |           DUTS-TR           | swin_v1_large | [google-drive](https://drive.google.com/file/d/1f7L0Pb1Y3RkOMbqLCW_zO31dik9AiUFa/view) |\n| HRSOD |      DUTS-TR, HRSOD-TR      | swin_v1_large | [google-drive](https://drive.google.com/file/d/1WJooyTkhoDLllaqwbpur_9Hle0XTHEs_/view) |\n| HRSOD |      DUTS-TR, UHRSD-TR      | swin_v1_large | [google-drive](https://drive.google.com/file/d/1Pu1mv3ORobJatIuUoEuZaWDl2ylP3Gw7/view) |\n| HRSOD |     HRSOD-TR, UHRSD-TR      | swin_v1_large | [google-drive](https://drive.google.com/file/d/1xEh7fsgWGaS5c3IffMswasv0_u-aVM9E/view) |\n| HRSOD | DUTS-TR, HRSOD-TR, UHRSD-TR | swin_v1_large | [google-drive](https://drive.google.com/file/d/13FaxyyOwyCddfZn2vZo1xG1KNZ3cZ-6B/view) |\n\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\u003csummary\u003eModels trained with customed data (general, matting), for \u003cb\u003egeneral use in practical application\u003c/b\u003e:\u003c/summary\u003e\n\n|           Task            |                        Training Sets                         |   Backbone    | Test Set  | Metric (S, wF[, HCE]) |                           Download                           |\n| :-----------------------: | :----------------------------------------------------------: | :-----------: | :-------: | :-------------------: | :----------------------------------------------------------: |\n|      **general use (2048x2048)**      | AIM-500, DIS-TR, DIS-TEs, HIM2K, PPM-100, TE-HRS10K, TE-Human-2k, TE-P3M-500-P, TR-AM-2k, TR-HRSOD, TR-UHRSD, Distinctions-646_BG-20k, Human-2k_BG-20k, TE-AM-2k, TE-HRSOD, TE-P3M-500-NP, TE-UHRSD, TR-HRS10K, TR-P3M-10k, [TR-humans](https://huggingface.co/datasets/schirrmacher/humans) | swin_v1_large |  DIS-VD   |  0.927, 0.894, 881   | [google-drive](https://drive.google.com/file/d/1lWVyimvxQ3bmDlaHeO1IOUbFZqUj9DYg/view) |\n|      **general use**      | DIS5K-TR, DIS-TEs, DUTS-TR_TE, HRSOD-TR_TE, UHRSD-TR_TE, HRS10K-TR_TE, TR-P3M-10k, TE-P3M-500-NP, TE-P3M-500-P, [TR-humans](https://huggingface.co/datasets/schirrmacher/humans) | swin_v1_large |  DIS-VD   |  0.911, 0.875, 1069   | [google-drive](https://drive.google.com/file/d/1_IfUnu8Fpfn-nerB89FzdNXQ7zk6FKxc/view) |\n|      **general use**      | DIS5K-TR, DIS-TEs, DUTS-TR_TE, HRSOD-TR_TE, UHRSD-TR_TE, HRS10K-TR_TE, TR-P3M-10k, TE-P3M-500-NP, TE-P3M-500-P, [TR-humans](https://huggingface.co/datasets/schirrmacher/humans) | swin_v1_tiny |  DIS-VD   |  0.882, 0.830, 1175   | [google-drive](https://drive.google.com/file/d/1fzInDWiE2n65tmjaHDSZpqhL0VME6-Yl/view) |\n|      **general use**      |                      DIS5K-TR, DIS-TEs                       | swin_v1_large |  DIS-VD   |  0.907, 0.865, 1059   | [google-drive](https://drive.google.com/file/d/1P6NJzG3Jf1sl7js2q1CPC3yqvBn_O8UJ/view) |\n| **general matting** | P3M-10k (except TE-P3M-500-NP), [TR-humans](https://huggingface.co/datasets/schirrmacher/humans), AM-2k, AIM-500, Human-2k (synthesized with BG-20k), Distinctions-646 (synthesized with BG-20k), HIM2K, PPM-100 | swin_v1_large | TE-P3M-500-NP | 0.979, 0.988 | [google-drive](https://drive.google.com/file/d/1Nlcg58d5bvE-Tbbm8su_eMQba10hdcwQ/view) |\n| **portrait matting** |                           [P3M-10k](https://github.com/JizhiziLi/P3M), [humans](https://huggingface.co/datasets/schirrmacher/humans)                            | swin_v1_large | P3M-500-P |     0.983, 0.989      | [google-drive](https://drive.google.com/file/d/1uUeXjEUoD2XF_6YjD_fsct-TJp7TFiqh) |\n\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\u003csummary\u003eSegmentation with box \u003cb\u003eguidance\u003c/b\u003e:\u003c/summary\u003e\n\n+ Given box guidance: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1B6aKZ3ekcvKMkSBn0N5mCASLUYMp0whK)\n\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\u003csummary\u003eModel \u003cb\u003eefficiency\u003c/b\u003e:\u003c/summary\u003e\n\n\u003e Screenshot from the original paper. All tests here are conducted on a single A100 GPU.\n\n\u003cimg src=\"https://drive.google.com/thumbnail?id=1mTfSD_qt-rFO1t8DRQcyIa5cgWLf1w2-\u0026sz=h300\" /\u003e  \u003cimg src=\"https://drive.google.com/thumbnail?id=1F_OURIWILVe4u1rSz-aqt6ur__bAef25\u0026sz=h300\" /\u003e\n\n\u003e The devices used in the below table differ from those in the original paper (the standard). So, it's only for reference.\n\n| Runtime | *FP32* | *FP16* |\n| :-----: | :----: | :----: |\n|  A100   | 86.8ms | 69.4ms |\n|  4090   | 95.8ms | 57.7ms |\n|  V100   | 384ms  | 152ms  |\n\n| GPU Memory | *FP32* | *FP16* |\n| :--------: | :----: | :----: |\n| Inference  | 4.76GB | 3.45GB |\n| Training (\\#GPU=1, batch\\_size=2, compile=False+PyTorch=2.5.1) | 36.3GB | 30.4GB |\n| Training (\\#GPU=1, batch\\_size=2, compile=True+PyTorch=2.5.1) | 35.9GB | **22.5GB (4090), 23.5GB (A100)** |\n\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eONNX\u003c/b\u003e conversion:\u003c/summary\u003e\n\n\u003e We converted from `.pth` weights files to `.onnx` files.  \n\u003e We referred a lot to the [Kazuhito00/BiRefNet-ONNX-Sample](https://github.com/Kazuhito00/BiRefNet-ONNX-Sample), many thanks to @Kazuhito00.\n\n+ Check our [Colab demo for ONNX conversion](https://colab.research.google.com/drive/1z6OruR52LOvDDpnp516F-N4EyPGrp5om) or the [notebook file for local running](https://drive.google.com/file/d/1cgL2qyvOO5q3ySfhytypX46swdQwZLrJ), where you can do the conversion/inference by yourself and find all relevant info.\n+ As tested, BiRefNets with SwinL (default backbone) cost `~90%` more time (the inference costs `~165ms` on an A100 GPU) using ONNX files. Meanwhile, BiRefNets with SwinT (lightweight) cost `~75%` more time (the inference costs `~93.8ms` on an A100 GPU) using ONNX files. Input resolution is `1024x1024` as default.\n+ The results of the original pth files and the converted onnx files are slightly different, which is acceptable.\n+ Pay attention to the compatibility among `onnxruntime-gpu, CUDA, and CUDNN` (we use `torch==2.0.1, cuda=11.8` here).\n\n\u003c/details\u003e\n\n\n\n## Third-Party Creations\n\u003eWe found there've been some 3rd party applications based on our BiRefNet. Many thanks for their contribution to the community!  \nChoose the one you like to try with clicks instead of codes:  \n\n1. **Applications**:\n\n   + Thanks [**tin2tin/2D_Asset_Generator**](https://github.com/tin2tin/2D_Asset_Generator): this project combined BiRefNet and FLUX as a **Blender add-on** for \"AI generating 2D cutout assets for ex. previz\".\n\n     https://github.com/user-attachments/assets/6cce7ca7-7817-4406-b6c4-6d4e8c414ed4\n\n   + Thanks [**camenduru/text-behind-tost**](https://github.com/camenduru/text-behind-tost): this project employed BiRefNet to extract foreground subjects and **add texts between the subjects and background**, which looks amazing especially for videos. Check their [tweets](https://x.com/camenduru/status/1856290408294220010) for more examples.\n\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/9969dd10-38a8-4cf2-a6c7-5b11f074b9b4\" height=\"300\"/\u003e\u003c/p\u003e\n\n   + Thanks [**briaai/RMBG-2.0**](https://huggingface.co/briaai/RMBG-2.0): this project trained BiRefNet with their **high-quality private data**, which brings improvement on the DIS task. Note that their weights are for only **non-commercial use** and are **not aware of transparency** due to training in the DIS task setting, which focuses only on predicting binary masks.\n\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://huggingface.co/briaai/RMBG-2.0/resolve/main/t4.png\" height=\"300\"/\u003e\u003c/p\u003e\n\n   + Thanks [**lldacing/ComfyUI_BiRefNet_ll**](https://github.com/lldacing/ComfyUI_BiRefNet_ll): this project further upgrade the **ComfyUI node** for BiRefNet with both our **latest weights** and **the legacy ones**.\n\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/lldacing/ComfyUI_BiRefNet_ll/raw/main/doc/video.gif\" height=\"300\"/\u003e\u003c/p\u003e\n\n   + Thanks [**MoonHugo/ComfyUI-BiRefNet-Hugo**](https://github.com/MoonHugo/ComfyUI-BiRefNet-Hugo): this project further upgrade the **ComfyUI node** for BiRefNet with our **latest weights**.\n\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/MoonHugo/ComfyUI-BiRefNet-Hugo/raw/main/assets/demo4.gif\" height=\"300\"/\u003e\u003c/p\u003e\n\n   + Thanks [**lbq779660843/BiRefNet-Tensorrt**](https://github.com/lbq779660843/BiRefNet-Tensorrt) and [**yuanyang1991/birefnet_tensorrt**](https://github.com/yuanyang1991/birefnet_tensorrt): they both provided the project to convert BiRefNet to **TensorRT**, which is faster and better for deployment. Their repos offer solid local establishment (Win and Linux) and [colab demo](https://colab.research.google.com/drive/1r8GkFPyMMO0OkMX6ih5FjZnUCQrl2SHV?usp=sharing), respectively. And @yuanyang1991 kindly offered the comparison among the inference efficiency of naive PyTorch, ONNX, and TensorRT on an RTX 4080S:\n\n| Methods | [Pytorch](https://drive.google.com/file/d/1_IfUnu8Fpfn-nerB89FzdNXQ7zk6FKxc/view) | [ONNX](https://drive.google.com/drive/u/0/folders/1kZM55bwsRdS__bdnsXpkmH6QPyza-9-N) | TensorRT |\n|:------------------------------------------------------------------------------------:|:--------------:|:--------------:|:--------------:|\n|  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;First Inference Time\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;  |     0.71s      |     5.32s      |     **0.17s**      |\n\n| Methods | [Pytorch](https://drive.google.com/file/d/1_IfUnu8Fpfn-nerB89FzdNXQ7zk6FKxc/view) | [ONNX](https://drive.google.com/drive/u/0/folders/1kZM55bwsRdS__bdnsXpkmH6QPyza-9-N) | TensorRT |\n|:------------------------------------------------------------------------------------:|:--------------:|:--------------:|:--------------:|\n|  Avg Inf Time (excluding 1st)   |     0.15s      |     4.43s      |     **0.11s**      |\n\n   + Thanks [**dimitribarbot/sd-webui-birefnet**](https://github.com/dimitribarbot/sd-webui-birefnet): this project allows to add a BiRefNet section to the original **Stable Diffusion WebUI**'s Extras tab.\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=159bLXI71FWh4ZsHTvc-wApSN9ytVRmua\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n   + Thanks [**fal.ai/birefnet**](https://fal.ai/models/birefnet): this project on `fal.ai` encapsulates BiRefNet **online** with more useful options in **UI** and **API** to call the model.\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1rNk81YV_Pzb2GykrzfGvX6T7KBXR0wrA\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n   + Thanks [**ZHO-ZHO-ZHO/ComfyUI-BiRefNet-ZHO**](https://github.com/ZHO-ZHO-ZHO/ComfyUI-BiRefNet-ZHO): this project further improves the **UI** for BiRefNet in ComfyUI, especially for **video data**.\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1GOqEreyS7ENzTPN0RqxEjaA76RpMlkYM\u0026sz=w1620\" /\u003e\u003c/p\u003e\n     \n     \u003chttps://github.com/ZhengPeng7/BiRefNet/assets/25921713/3a1c7ab2-9847-4dac-8935-43a2d3cd2671\u003e\n\n   + Thanks [**viperyl/ComfyUI-BiRefNet**](https://github.com/viperyl/ComfyUI-BiRefNet): this project packs BiRefNet as **ComfyUI nodes**, and makes this SOTA model easier use for everyone.\n     \u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1KfxCQUUa2y9T-aysEaeVVjCUt3Z0zSkL\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n   + Thanks [**Rishabh**](https://github.com/rishabh063) for offering a demo for the [easier multiple images inference on colab](https://colab.research.google.com/drive/14Dqg7oeBkFEtchaHLNpig2BcdkZEogba).\n\n2. **More Visual Comparisons**\n   + Thanks [**twitter.com/ZHOZHO672070**](https://twitter.com/ZHOZHO672070) for the comparison with more background-removal methods in images:\n\n     \u003cimg src=\"https://drive.google.com/thumbnail?id=1nvVIFt_Ezs-crPSQxUDqkUBz598fTe63\u0026sz=w1620\" /\u003e\n\n   + Thanks [**twitter.com/toyxyz3**](https://twitter.com/toyxyz3) for the comparison with more background-removal methods in videos:\n\n    \u003chttps://github.com/ZhengPeng7/BiRefNet/assets/25921713/40136198-01cc-4106-81f9-81c985f02e31\u003e\n\n    \u003chttps://github.com/ZhengPeng7/BiRefNet/assets/25921713/1a32860c-0893-49dd-b557-c2e35a83c160\u003e\n\n\n## Usage\n\n#### Environment Setup\n\n```shell\n# PyTorch==2.5.1+CUDA12.4 (or 2.0.1+CUDA11.8) is used for faster training (~40%) with compilation.\nconda create -n birefnet python=3.10 -y \u0026\u0026 conda activate birefnet\npip install -r requirements.txt\n```\n\n#### Dataset Preparation\n\nDownload combined training / test sets I have organized well from: [DIS](https://drive.google.com/drive/folders/1hZW6tAGPJwo9mPS7qGGGdpxuvuXiyoMJ)--[COD](https://drive.google.com/drive/folders/1EyHmKWsXfaCR9O0BiZEc3roZbRcs4ECO)--[HRSOD](https://drive.google.com/drive/folders/18_hAE3QM4cwAzEAKXuSNtKjmgFXTQXZN) or the single official ones in the `single_ones` folder, or their official pages. You can also find the same ones on my **BaiduDisk**: [DIS](https://pan.baidu.com/s/1O_pQIGAE4DKqL93xOxHpxw?pwd=PSWD)--[COD](https://pan.baidu.com/s/1RnxAzaHSTGBC1N6r_RfeqQ?pwd=PSWD)--[HRSOD](https://pan.baidu.com/s/1_Del53_0lBuG0DKJJAk4UA?pwd=PSWD).\n\n#### Weights Preparation\n\nDownload backbone weights from [my google-drive folder](https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM) or their official pages.\n\n## Run\n\n```shell\n# Train \u0026 Test \u0026 Evaluation\n./train_test.sh RUN_NAME GPU_NUMBERS_FOR_TRAINING GPU_NUMBERS_FOR_TEST\n# Example: ./train_test.sh tmp-proj 0,1,2,3,4,5,6,7 0\n\n# See train.sh / test.sh for only training / test-evaluation.\n# After the evaluation, run `gen_best_ep.py` to select the best ckpt from a specific metric (you choose it from Sm, wFm, HCE (DIS only)).\n```\n\n### :pen: Fine-tuning on Custom Data\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eGuideline\u003c/b\u003e:\u003c/summary\u003e\n\n\n\u003e Suppose you have some custom data, fine-tuning on it tends to bring improvement.\n\n1. **Pre-requisites**: you have put your datasets in the path `${data_root_dir}/TASK_NAME/DATASET_NAME`. For example, `${data_root_dir}/DIS5K/DIS-TR` and `${data_root_dir}/General/TR-HRSOD`, where `im` and `gt` are both in each dataset folder.\n2. **Change an existing task to your custom one**: replace all `'General'` (with single quotes) in the whole project with `your custom task name` as the screenshot of vscode given below shows:\u003cimg src=\"https://drive.google.com/thumbnail?id=1J6gzTmrVnQsmtt3hi6ch3ZrH7Op9PKSB\u0026sz=w400\" /\u003e\n3. **Adapt settings**:\n   + `sys_home_dir`: path to the root folder, which contains codes / datasets / weights / ... -- project folder / data folder / backbone weights folder are `${sys_home_dir}/codes/dis/BiRefNet / ${sys_home_dir}/datasets/dis/General / ${sys_home_dir}/weights/cv/swin_xxx`, respectively.\n   + `testsets`: your validation set.\n   + `training_set`: your training set.\n   + `lambdas_pix_last`: adapt the weights of different losses if you want, especially for the difference between segmentation (classification task) and matting (regression task).\n4. **Use existing weights**: if you want to use some existing weights to fine-tune that model, please refer to the `resume` argument in `train.py`. Attention: the epoch of training continues from the epochs the weights file name indicates (e.g., `244` in `BiRefNet-general-epoch_244.pth`), instead of `1`. So, if you want to fine-tune `50` more epochs, please specify the epochs as `294`. `\\#Epochs, \\#last epochs for validation, and validation step` are set in `train.sh`.\n5. Good luck to your training :) If you still have questions, feel free to leave issues (recommended way) or contact me.\n\n\u003c/details\u003e\n\n\n\n## Well-trained weights:\n\nDownload the `BiRefNet-{TASK}-{EPOCH}.pth` from [[**stuff**](https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM)] and [the release page](https://github.com/ZhengPeng7/BiRefNet/releases) of this repo. Info of the corresponding (predicted\\_maps/performance/training\\_log) weights can be also found in folders like `exp-BiRefNet-{TASK_SETTINGS}` in the same directory.\n\nYou can also download the weights from the release of this repo.\n\nThe results might be a bit different from those in the original paper, you can see them in the `eval_results-BiRefNet-{TASK_SETTINGS}` folder in each `exp-xx`, we will update them in the following days. Due to the very high cost I used (A100-80G x 8), which many people cannot afford (including myself....), I re-trained BiRefNet on a single A100-40G only and achieved the performance on the same level (even better). It means you can directly train the model on a single GPU with 36.5G+ memory. BTW, 5.5G GPU memory is needed for inference in 1024x1024. (I personally paid a lot for renting an A100-40G to re-train BiRefNet on the three tasks... T_T. Hope it can help you.)\n\nBut if you have more and more powerful GPUs, you can set GPU IDs and increase the batch size in `config.py` to accelerate the training. We have made all these kinds of things adaptive in scripts to seamlessly switch between single-card training and multi-card training. Enjoy it :)\n\n## Some of my messages:\n\nThis project was originally built for DIS only. But after the updates one by one, I made it larger and larger with many functions embedded together. Finally, you can **use it for any binary image segmentation tasks**, such as DIS/COD/SOD, medical image segmentation, anomaly segmentation, etc. You can eaily open/close below things (usually in `config.py`):\n+ Multi-GPU training: open/close with one variable.\n+ Backbone choices: Swin_v1, PVT_v2, ConvNets, ...\n+ Weighted losses: BCE, IoU, SSIM, MAE, Reg, ...\n+ Training tricks: multi-scale supervision, freezing backbone, multi-scale input...\n+ Data collator: loading all in memory, smooth combination of different datasets for combined training and test.\n+ ...\nI really hope you enjoy this project and use it in more works to achieve new SOTAs.\n\n\n### Quantitative Results\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1Ymkh8WN16XMTBOS8dmPTg5eAf-NIl2m5\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1W0mi0ZiYbqsaGuohNXU8Gh7Zj4M3neFg\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n\n\n### Qualitative Results\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1TYZF8pVZc2V0V6g3ik4iAr9iKvJ8BNrf\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://drive.google.com/thumbnail?id=1ZGHC32CAdT9cwRloPzOCKWCrVQZvUAlJ\u0026sz=w1620\" /\u003e\u003c/p\u003e\n\n\n## Acknowledgement:\n\nMany of my thanks to the companies / institutes below.\n+ [FAL](https://fal.ai).\n+ [Freepik](https://www.freepik.com).\n+ [Redmond.ai](https://redmond.ai).\n+ [Alibaba-ICBU](https://www.alibaba.com).\n\n\n### Citation\n\n```\n@article{zheng2024birefnet,\n  title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},\n  author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},\n  journal={CAAI Artificial Intelligence Research},\n  volume = {3},\n  pages = {9150038},\n  year={2024}\n}\n```\n\n\n\n## Contact\n\nAny questions, discussions, or even complaints, feel free to leave issues here (recommended) or send me e-mails (zhengpeng0108@gmail.com) or book a meeting with me: [calendly.com/zhengpeng0108/30min](https://calendly.com/zhengpeng0108/30min). You can also join the Discord Group (https://discord.gg/d9NN5sgFrq) if you want to talk a lot publicly.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhengpeng7%2Fbirefnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhengpeng7%2Fbirefnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhengpeng7%2Fbirefnet/lists"}