about
Image synthesis and editing with stochastic differential equations (arxiv.org)
84 points by lnyan on Aug 3, 2021 | hide | past | pdf | 8 comments on HN

In plain words: It blurs your image or edit with noise, then lets an image generator clean it into a realistic photo; the noise level trades realism against staying true to your input. Human raters scored it up to 98% higher on realism than older single-pass generators.

Abstract · SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations

Guided image synthesis enables everyday users to create and edit photo-realistic images with minimum effort. The key challenge is balancing faithfulness to the user input (e.g., hand-drawn colored strokes) and realism of the synthesized image. Existing GAN-based methods attempt to achieve such balance using either conditional GANs or GAN inversions, which are challenging and often require additional training data or loss functions for individual applications. To address these issues, we introduce a new image synthesis and editing method, Stochastic Differential Editing (SDEdit), based on a diffusion model generative prior, which synthesizes realistic images by iteratively denoising through a stochastic differential equation (SDE). Given an input image with user guide of any type, SDEdit first adds noise to the input, then subsequently denoises the resulting image through the SDE prior to increase its realism. SDEdit does not require task-specific training or inversions and can naturally achieve the balance between realism and faithfulness. SDEdit significantly outperforms state-of-the-art GAN-based methods by up to 98.09% on realism and 91.72% on overall satisfaction scores, according to a human perception study, on multiple tasks, including stroke-based image synthesis and editing as well as image compositing.

Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, Stefano Ermon
arXiv:2108.01073 · cs.CV, cs.AI · submitted Aug 2, 2021 · updated Jan 5, 2022
abstract · pdf · html · https://sde-image-editing.github.io/

add comment on HN

Although the application is interesting, as someone who studies SDEs the notion of "reverse SDEs" is frustrating to me, as Brownian motion really isn't reversible. The citation provided is from 1982, but I'm not convinced the theory can't be situated in the more modern interpretation of "backward SDEs" which became more popular with Peng's work in 1992.

Backward SDEs aren't time-reversed, but satisfy conditions at the end of the time interval instead of the beginning. The idea of time-reversing Brownian motion is like saying that you're running thermodynamics backward--it only makes sense if you sample them forward, then move backwards along the forward sampled motion.

It feels like (2) is just a backward SDE arrived at via the Feynman-Kac theorem applied to the Kolmogorov backward equations.

Yeah, someone rediscovered Kolmogorov path-dependent equations (probably Smoluchowski's in this case) and applied them to another optimization problem. Shock horror that well described old optimization technique works better than winging it with pure variant of gradient descent for some problems.

Rediscovery of anomalous diffusion statistics.

Yeah, the application is definitely interesting.

> The idea of time-reversing Brownian motion is like saying that you're running thermodynamics backward--it only makes sense if you sample them forward, then move backwards along the forward sampled motion.

You are conceptually 100% correct on this matter.

...As for me, I usually solve SDEs using Markov chain Monte Carlo, using esoteric software known as WinBUGS/OpenBUGS/MultiBUGS. I use MultiBUGS [1] (don't bother installing it on Windows or Mac), which is integrated with BlackBox Component Builder [2]. It all runs on a really cool but esoteric language called Component Pascal. Anyways, developers over the years have kept BlackBox in particular alive. But, I always have to say, differential equations are awesome :-) But, Julia is where it is at for DiffEqs in open source.

[1] https://www.multibugs.org/

[2] https://blackbox.oberon.org/

I only ever used BUGS for Bayesian statistical inference. It seems like there's a whole world of math, applications thereof, and related software that I don't know about -- exciting!

What do you use SDEs for? I always skipped diff eq topics because I never had a sensible application for them in the social sciences.

I actually use them for a special cause. I use them for solving for the specific parameters that make each type 1 diabetes patient individual and unique. Once the parameters are solved for, we can make a "virtual patient" and do simulations of the patients, and we can do further optimizations and fine tuning.

We also use the parameters for artificial pancreas systems, in order to give personalized and optimized insulin dosages for each patient, using those same exact parameters. In this case, we use a controller (model predictive control) and plug in the individualized parameters into the controller interface for each individual patient. The system is interfaced with a mobile device, an insulin pump, and a continuous glucose monitor. The mobile device sends data from the insulin pump and continuous glucose monitor to the controller (input) and retrieves data from the controller (output) via the mobile device. Via the output, commands are issued to the insulin pump regarding insulin dosing.

SDEs are the underpinning of most modern mathematical finance models; they're the underlying concept behind the Black–Scholes model for option pricing.
How does this relate to what Friston calls free energy minimization (or simulated annealing) if I might ask?
A stochastic optimal control problem can be interpreted as a free energy minimization problem [0], but this is a more general result than what is looked at in the paper OP linked.

I'm not sure the "reverse SDE" is technically doing this sort of minimization since it seems like it's just trying to reconstruct an unknown forward process. It's possible there's some sort of minimization going on here over some slack variable though.

[0] https://ieeexplore.ieee.org/abstract/document/6426381?casa_t...