Git Product home page Git Product logo

bcmi / libcom Goto Github PK

View Code? Open in Web Editor NEW
252.0 12.0 16.0 60.95 MB

Image composition toolbox: everything you want to know about image composition or object insertion

License: Apache License 2.0

Python 98.37% Shell 0.02% C++ 0.78% C 0.12% Objective-C 0.04% Cuda 0.67%
foreground-object-search image-blending image-composition image-harmonization inharmonious-region-localization object-placement painterly-image-harmonization shadow-generation cross-domain-image-composition generative-image-composition

libcom's Introduction


libcom: everything about image composition


PyPI Downloads Hits Static Badge Static Badge Static Badge

Introduction

libcom (the library of image composition) is an image composition toolbox. The goal of image composition (object insertion) is inserting one foreground into a background image to get a realistic composite image, by addressing the inconsistencies (appearance, geometry, and semantic inconsistency) between foreground and background. Generally speaking, image composition could be used to combine the visual elements from different images.


libcom covers a diversity of related tasks in the field of image composition, including image blending, standard/painterly image harmonization, shadow generation, object placement, generative composition, quality evaluation, etc. For each task, we integrate one or two selected methods considering both efficiency and effectiveness. The selected methods will be continuously updated upon the emergence of better methods.

The ultimate goal of this library is solving all the problems related to image composition with simple import libcom.

Main Functions

  • get_composite_image generates composite images using naive copy-and-paste followed by image blending.
  • OPAScoreModel [OPA] evaluates the rationality of foreground object placement in a composite image.
  • FOPAHeatMapModel [FOPA] can predict the rationality scores for all locations/scales given a background-foreground pair, and output the composite image with optimal location/scale.
  • color_transfer adjusts the foreground color to match the background using traditional color transfer method.
  • ImageHarmonizationModel [CDTNet] [PCTNet] adjusts the foreground illumination to be compatible the background given photorealistic background and photorealistic foreground.
  • PainterlyHarmonizationModel [PHDNet] [PHDiffusion] adjusts the foreground style to be compatible with the background given artistic background and photorealistic foreground.
  • HarmonyScoreModel [BargainNet] evaluates the harmony level between foreground and background in a composite image.
  • InharmoniousLocalizationModel [MadisNet] localizes the inharmonious region in a synthetic image.
  • FOSScoreModel [DiscoFOS] evaluates the compatibility between foreground and background in a composite image in terms of geometry and semantics.
  • ShadowGenerationModel [ControlNet] generates plausible shadow for the inserted object in a composite image.
  • ControlComModel [ControlCom] is a generative image composition model which unifies image blending and image harmonization. The generated foreground has high fidelity.
  • ObjectStitchModel [ObjectStitch] is another generative image composition model which can adjust the pose and view of foreground, but the fidelity of generated foreground is worse than ControlComModel.

For the detailed method descriptions, code examples, visualization results, and performance comments, please refer to our [documents]. If the model performance is not satisfactory, you can finetune the pretrained model on your own dataset using the source repository and replace the original model.

Requirements

The main branch is built on the Linux system with Python 3.8 and PyTorch>=1.10.1. For other dependencies, please refer to [conda_env] and [runtime_dependencies].

Get Started

Please refer to [Installation] for installation instructions and [documents] for user guidance.

Contributors

License

This project is released under the Apache 2.0 license.

Bibtex

If you use our toolbox, please cite our survey paper using the following BibTeX [arxiv]:

@article{niu2021making,
  title={Making images real again: A comprehensive survey on deep image composition},
  author={Niu, Li and Cong, Wenyan and Liu, Liu and Hong, Yan and Zhang, Bo and Liang, Jing and Zhang, Liqing},
  journal={arXiv preprint arXiv:2106.14490},
  year={2021}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.