Foam is important in many commercial products – from beer to dish liquid. And it’s pretty interesting to watch, for a while.
Over many decades researchers watching foam have identified three ways in which foam changes as it collapses:
- The thin layer liquid that separates each bubble of air drains away due to gravity.
- Bubbles coalescence with other bubbles.
- The larger bubbles get bigger at the expense of the smaller ones (learn why).
If you look carefully, you may be able to see some of these processes in the video. But you probably wouldn’t want to spend all day doing this. Not even the best fed and caffeinated student could provide enough data to explain why specific changes in ingredients change the behavior of foam.
Which is why researchers at the University of New South Wales in Australia have trained an AI to do it instead.

How to look at foam
To really understand the behavior of foam we need look at the bubbles in the middle rather than the few that are on the surface, or next to the glass in your beer. Fortunately we can use X-rays to “see” inside a foam (in the same way as medical X-rays reveal the inside of your body).
Micro-CT (Micro Computed-Tomography) can be used to X-ray materials from all directions. X-rays of slices can be combined to create a 3D model which reveals internal structure. But it is not fast. The technique works well for things like solid foams and porous rocks. But foams in foods and personal care products just won’t stay still enough – and it’s the dynamic behavior that we care about. The obvious solution is to scan faster. Unfortunately this creates noisy images that are hard to use in any analysis. We need to clean up these images. This is where the AI comes in.

Teaching an AI to look at foam
Humans are really good at image analysis. We can look at the noisy image from a rapid scan, like the one on the left in the image above, and instantly spot the bubbles. They are the round things.
The other grey fuzzy stuff that appears between the bubbles is probably just noise, and certainly not part of the bubbles. We know that the texture inside the bubbles is just an artifact. An AI has to be taught to understand all this.
The researchers analyzed 100’s of images by hand – removing the artifacts and showing where the bubble boundaries lay. They gave the AI a series of (a) and (b) images like these:

The AI studied this training set. After 200 epochs (passes of the entire training dataset, not a period in history marked by notable events!) the machine learning algorithm could identify bubbles, even in the fast scans. It could then get to work creating 3D models of foam by patiently identifying the bubbles in 1000’s of fast micro CT scans of foam.

Analyzing all this data provides an unprecedented view of foam dynamics. The researchers could identify trends and discover why specific foams stayed stable or collapsed.
What did the researchers discover?
The team from University of New South Wales studied what happened when microfibrous cellulose (MEC), obtained from plants or bacteria, was added to a foamy surfactant solution. The MEC reduced liquid drainage and significantly increased the lifetime of the foam, even when added at less than 0.05% by weight. They saw more a uniform size distribution of bubbles. Coalescence (when the film between two bubbles breaks and they merge) was reduced.
After an initial collapse the foam stabilized and remained the same for several hours. Maybe this would be useful for making a foamy desert, or a for a foamed cosmetic or hair product?
Chocolate mousse Foaming shaving cream
Their results highlight the potential for this material. MEC could, they suggest, provide an economically viable alternative to inorganic particles. This would be an environmentally friendly option since MFC is non-toxic and biodegradable.
Their work also demonstrates a new way to study bubbles. Now that AI’s have learned to appreciate foam maybe they can help improve the foam on your cappuccino, the head your beer, or in the detergent bubbles in your sink?
Learn more:
Read the paper published by Syeda Rubaiya Muin, Patrick T. Spicer, Kunning Tanga, Yufu Niu, Maryam Hosseini, Peyman Mostaghimi and Ryan T. Armstrong: Dynamic X-ray micotomography of microfibrous cellulose liquid foamsusing deep learning, Chemical Engineering Science 248 (2022) 117173. You can access a preprint of this paper on Pat Spicer’s website Soft Matter Hacker.
The larger bubbles get bigger at the expense of the smaller ones because of Ostwald ripening. I might write a post on this subject at a later date. It is really interesting. But meanwhile here is the relevant section from Prof Steven Abbotts free Practical Surfactants eBook.
And here is a cool video showing Ostwald ripening happening – the big bubbles grow at the expense of the small ones! (on wikipedia):