{"id":21010518,"url":"https://github.com/hughplay/dfnet","last_synced_at":"2025-05-07T10:42:49.432Z","repository":{"id":47440147,"uuid":"180760279","full_name":"hughplay/DFNet","owner":"hughplay","description":":art: Deep Fusion Network for Image Completion - ACMMM 2019","archived":false,"fork":false,"pushed_at":"2023-04-20T02:11:07.000Z","size":8635,"stargazers_count":216,"open_issues_count":0,"forks_count":43,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-31T09:11:13.439Z","etag":null,"topics":["acmmm2019","deep-learning","dfnet","edgeconnect","fusion-block","image-completion","image-inpainting","inpainting","pytorch"],"latest_commit_sha":null,"homepage":"https://hongxin2019.github.io/pdf/mm-2019-dfnet.pdf","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hughplay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-04-11T09:34:20.000Z","updated_at":"2025-03-19T04:02:19.000Z","dependencies_parsed_at":"2023-01-20T10:46:04.370Z","dependency_job_id":"bac73953-13e8-43bc-9a93-22af50e2a539","html_url":"https://github.com/hughplay/DFNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hughplay%2FDFNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hughplay%2FDFNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hughplay%2FDFNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hughplay%2FDFNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hughplay","download_url":"https://codeload.github.com/hughplay/DFNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252862186,"owners_count":21815812,"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":["acmmm2019","deep-learning","dfnet","edgeconnect","fusion-block","image-completion","image-inpainting","inpainting","pytorch"],"created_at":"2024-11-19T09:21:05.823Z","updated_at":"2025-05-07T10:42:49.409Z","avatar_url":"https://github.com/hughplay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Fusion Network for Image completion\n\nOfficial repository for [\"Deep Fusion Network for Image completion\"](https://github.com/hughplay/DFNet).\n\n\u003c!-- ![inpainting results](imgs/github_teaser.jpg) --\u003e\n\u003cimg width=\"720\" src=\"imgs/github_teaser.jpg\"\u003e\n\n**Figure:** *Results from DFNet. Fusion Result = (1 - Alpha) \\* Input + Alpha \\* Raw. Both Raw and Alpha are model outputs.*\n\n\u003e **Deep Fusion Network for Image Completion** \u003cbr\u003e\n\u003e Xin Hong, Pengfei Xiong, Renhe Ji, Haoqiang Fan \u003cbr\u003e\n\u003e *Published on Proceedings of the 27th ACM International Conference on Multimedia (ACMMM 2019)*\n\n\u003c!-- [![](docs/_static/imgs/project.svg)](https://hongxin2019.github.io) --\u003e\n[![](https://img.shields.io/badge/-code-green?style=flat-square\u0026logo=github\u0026labelColor=gray)](https://github.com/hughplay/DFNet)\n[![](https://img.shields.io/badge/-pdf-b31b1b?style=flat-square\u0026logo=adobeacrobatreader)](https://dl.acm.org/doi/pdf/10.1145/3343031.3351002)\n[![](https://img.shields.io/badge/Open_in_Colab-blue?style=flat-square\u0026logo=google-colab\u0026labelColor=gray)](https://colab.research.google.com/github/hughplay/DFNet/blob/master/demo.ipynb)\n[![](https://img.shields.io/badge/PyTorch-ee4c2c?style=flat-square\u0026logo=pytorch\u0026logoColor=white)](https://pytorch.org/get-started/locally/)\n\u003c!-- [![](https://img.shields.io/badge/-Lightning-792ee5?style=flat-square\u0026logo=pytorchlightning\u0026logoColor=white)](https://pytorchlightning.ai/) --\u003e\n[![](docs/_static/imgs/hydra.svg)](https://hydra.cc)\n\n\n## Description\n\nDeep image completion usually fails to harmonically blend the restored image into existing content,\nespecially in the boundary area. And it often fails to complete complex structures.\n\n\u003cimg align=\"right\" width=\"360\" src=\"imgs/fusion-block.jpg\"\u003e\n\nWe first introduce **Fusion Block** for generating a flexible alpha composition map to combine known and unknown regions.\nIt builds a bridge for structural and texture information, so that information in known region can be naturally propagated into completion area.\nWith this technology, the completion results will have smooth transition near the boundary of completion area. Furthermore, the architecture of fusion block enable us to apply **multi-scale constraints**.\nMulti-scale constrains improves the performance of DFNet a lot on structure consistency.\n\nMoreover, **it is easy to apply this fusion block and multi-scale constrains to other existing deep image completion models**.\nA fusion block feed with feature maps and input image, will give you a completion result in the same resolution as given feature maps.\n\nIf you find this code useful, please consider to star this repo and cite us:\n\n``` bibtex\n@inproceedings{hongDeepFusionNetwork2019,\n  title = {Deep {{Fusion Network}} for {{Image Completion}}},\n  booktitle = {Proceedings of the 27th {{ACM International Conference}} on {{Multimedia}}},\n  author = {Hong, Xin and Xiong, Pengfei and Ji, Renhe and Fan, Haoqiang},\n  year = {2019},\n  series = {{{MM}} '19},\n  pages = {2033--2042},\n  keywords = {alpha composition,deep fusion network,fusion block,image completion,inpainting}\n}\n```\n\n\n## Prerequisites\n- Python 3\n- PyTorch 1.0\n- OpenCV\n\n\n## Testing\n\nWe provide an interactive [Colab demo](https://colab.research.google.com/github/hughplay/DFNet/blob/master/demo.ipynb) for trying DFNet. You can also test our model with the following steps.\n\nClone this repo:\n\n``` py\ngit clone https://github.com/hughplay/DFNet.git\ncd DFNet\n```\n\nDownload pre-trained model from [Google Drive](https://drive.google.com/drive/folders/1lKJg__prvJTOdgmg9ZDF9II8B1C3YSkN?usp=sharing)\nand put them into `model`.\n\n### Testing with Places2 model\n\nThere are already some sample images in the `samples/places2` folder.\n\n``` sh\npython test.py --model model/model_places2.pth --img samples/places2/img --mask samples/places2/mask --output output/places2 --merge\n```\n\n### Testing with CelebA model\n\nThere are already some sample images in the `samples/celeba` folder.\n\n``` sh\npython test.py --model model/model_celeba.pth --img samples/celeba/img --mask samples/celeba/mask --output output/celeba --merge\n```\n\n## Training\n\nPlease refer to: https://github.com/deepcodebase/inpaint. It is building in progress but looks good so far.\n\n## License\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003eThis work is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"\u003eCreative Commons Attribution-NonCommercial 4.0 International License\u003c/a\u003e.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhughplay%2Fdfnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhughplay%2Fdfnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhughplay%2Fdfnet/lists"}