Git Product home page Git Product logo

drawingwithgaussians's Introduction

Experiments with 2D gaussians

Set up

git clone https://github.com/belkakari/DrawingWithGaussians.git
cd DrawingWithGaussians
pip install poetry
poetry install

For CUDA machine I suggest using the docker image provided or install jax with CUDA support following their official installation guide

Overview

This is not a "production-ready project" by any means but rather my attempts at a low-level tweaking of different image representations based on gaussians and how to control them. I might move to 3D at some point but for now it's more about 2D and adapting some methods I like to 2D setup.

Fit 2D gaussians to an image

python fit.py --config-name fit_to_image.yaml

An example of fitting an image

Here I initialize 50 gaussians and split them every epoch based on the gradient values. After each epoch I multiply all of the gaussians colors by cfg.gaussians.color_demp_coeff which is 0.1 here

Fit 2D gaussians with a diffusion prior

python fit.py --config-name diffusion_guidance.yaml

Prompts is A man standing on the street, it nicely detereorates in an abstract image probably due to the low number of gaussians (50->88->159->256->378), annealing is on, img2img every 50 steps

An example of fitting an image with a diffusion guidance

Another example without annealing but with img2img every 250 steps

An example of fitting an image with a diffusion guidance

This is not SDS but rather something similar to StableDreamer, meaning that I just use img2img mode of SD as a ground truth. No gradients are being passed through the sampling process There is a lot to be optimized in terms of the sampling itself (e.g. different checkpoint, different scheduler)

A bit about the config:

  • img2img_freq sets up how often to run img2img, 1 means every step, >1 means that gaussians are being optimised for a diffusion image for a img2img_freq steps
  • height/width sets up the dimensions in which SD is being inferred since SD1.4 (I know, I'll pick a fancier one later) is quite sensitive to resolution. It is downsampled to image.height/image.width after inference for gaussians optimization
  • strength_annealing toggles diffusion strength scaling so that in the beggining it's set to strength, but at num_epochs * num_steps it becomes zero (the idea is that with more optimization steps one does not need to diffuse that much)

ToDO

  • Move boilerplate to separate functions
  • Add SSIM
  • Ability to copy optimizer state from before the pruning (copy for the splitted gaussians)
  • Test "deferred rendering" like in SpacetimeGaussians
  • Add SDS with SD
  • Add basic 3D version
  • Add alternative alpha-composing with occlusions (prune gaussians based on opacity, currently prunning based on color norm, probably won't do this untill I'll decide to move to 3D)

References

Based on 3DGS, fmb-plus, GaussianImage, works ok on macbook m1 up to ~300 gaussians

drawingwithgaussians's People

Contributors

belkakari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.