K. M. Mukut
Blog · · 7 min read

SAGE: teaching a neural network to find soot particles in TEM images

Measuring soot from electron-microscope images still means outlining hundreds of overlapping particles by hand. SAGE does it automatically, irregular shapes included, after training first on synthetic images and then on a few hand-segmented real ones.

Soot particles are not spheres. Seen under a transmission electron microscope (TEM), a soot particle is an aggregate: a branching cluster of tiny, roughly round primary particles, fused and overlapping. Their size and arrangement decide how the particle absorbs sunlight, how it ages, and how it behaves in a flame model. To measure them, someone usually outlines each primary particle by hand, one at a time, on image after image.

SAGE (Soot Aggregate Geometry Extraction) does that step automatically. It is a machine-learning model that finds and outlines each primary particle in a TEM image of soot. I co-developed it with Timothy P. Day in Dr. Somesh Roy’s group at Marquette University, and the paper is published in the Proceedings of the Combustion Institute.

Why the existing methods fall short

Automatic methods exist, but they struggle with what makes TEM images of soot hard: low contrast, noise, and primary particles that overlap heavily in a two-dimensional projection of a three-dimensional cluster. The circular Hough transform (CHT) fits circles, so every particle comes out round, and it needs tuning image by image. Euclidean distance mapping with watershed segmentation (EDM-WS) handles irregular shapes better but still trips over overlapping particles.

Machine learning is the obvious next step, with one problem: training a model needs many images that have already been segmented, and hand-segmented soot images are exactly what is scarce.

Train on synthetic images first

SAGE is built on Mask R-CNN, a convolutional neural network that finds objects in an image and draws a pixel mask around each one, which suits densely packed, overlapping particles. The training is the new part, and it happens in stages.

A vertical sequence of four training steps: start from Mask R-CNN with COCO weights; train on 200 synthetic TEM images with 8,991 particles of known outline, giving SAGE 0; fine-tune on 17 hand-segmented real images, giving SAGE 1; fine-tune on the same images segmented by other analysts, giving SAGE 2, the best model
SAGE's training, from general object detection to soot. Diagram drawn for this post.

The model starts from weights trained on everyday photographs. It then learns from 200 synthetic soot images. Two existing tools, FLAGE and PAGenT, generate fractal-like aggregates with chosen particle sizes, fractal dimensions and overlaps; PAGenT renders them as TEM-style images, and Gaussian noise imitates the artifacts of a real microscope. Because the aggregates are generated, the outline of every one of their 8,991 primary particles is known exactly. That first model is SAGE0.

Three synthetic TEM images: gray, grainy backgrounds with a dark branching aggregate in each, every primary particle ringed by a colored outline
Synthetic TEM images of the kind SAGE₀ learned from, with the known primary-particle outlines drawn on. Supplementary Fig. S1 of Day, Mukut et al., Proceedings of the Combustion Institute 41 (2025).

Then comes a small amount of real data: 17 real TEM images, outlined by hand. Hand segmentation is subjective, so each image was outlined independently by two analysts drawn from a pool of three, giving two versions of the same images (M1 and M2). Fine-tuning on M1 gives SAGE1; fine-tuning further on M2 gives SAGE2, which has seen two human opinions of where the boundaries lie.

How far two careful people can disagree is easy to see. On the aggregate below, one analyst found 37 primary particles and the other 39, and many of their boundaries differ. SAGE2, trained on both opinions, found 28.

Four panels of the same soot aggregate: Analyst 1’s segmentation with 37 colored particles, Analyst 2’s with 39, SAGE’s with 28, and the original gray TEM image
One aggregate segmented by two analysts and by SAGE₂, with the original TEM image. Supplementary Fig. S4 of Day, Mukut et al., Proceedings of the Combustion Institute 41 (2025).

How well does it work?

SAGE2 was tested on nine real images it had never seen: three from the same source as the training images and six from different sources, taken on different instruments by different research groups.

CHT EDM-WS SAGE2
Accuracy 14.6% 28.8% 51.1%
F1 score 25.5% 44.7% 67.7%
AP50 14.0% 31.7% 47.4%
Mean IoU 29.8% 40.4% 62.2%

The last row is the useful one for intuition. Intersection over union (IoU) measures how well a predicted outline overlaps the true one. For reference, the two human analysts agree with each other at a mean IoU of 66.9%, so SAGE2 comes close to the level at which two people disagree. It produced about 112 particles with an IoU above 0.5, against 60 for EDM-WS and 32 for CHT.

A chart of the number of predictions above each IoU threshold from 0 to 1 for three methods. The SAGE 2 curve stays highest beyond a threshold of about 0.2; at the dashed line, IoU 0.5, it is near 112, against about 60 for EDM-WS and 32 for CHT
How many predicted particles clear each IoU threshold on the test set. At the usual threshold of 0.5 (dashed line) SAGE₂ keeps far more good outlines than the other two methods. Fig. 2 of Day, Mukut et al., Proceedings of the Combustion Institute 41 (2025).

The synthetic first stage earns its place. The paper’s supplement also trains the same network without it, fine-tuning on M1 and M2 straight from the photograph weights (a model called COCO2). On the same real test images SAGE2 beats it on every measure: F1 67.7% against 61.0%, AP50 47.4% against 39.1%, mean IoU 62.2% against 59.2%.

The same soot aggregate segmented four ways, each primary particle outlined in color: by hand, by the circular Hough transform, by distance mapping with watershed, and by SAGE 2
One aggregate from the test set: (a) outlined by hand, the ground truth; (b) circular Hough transform; (c) Euclidean distance mapping with watershed; (d) SAGE₂. Fig. 3 of Day, Mukut et al., Proceedings of the Combustion Institute 41 (2025).

In the figure, the circles from the Hough transform come out too small and miss particles, and the watershed method struggles where particles overlap. SAGE2 is not perfect, but it covers almost the whole aggregate and follows irregular boundaries.

What matters most for soot science is the shape of the whole aggregate, and there SAGE2 does well. Its particle size distribution matches the hand-segmented one, and the median error is below 5% for the radius of gyration and below 1% for the fractal dimension. The traditional methods were off by more than 10% on the radius of gyration. The fractal dimensions were measured by box counting with my StereoFractAnalyzer package.

Two scatter plots of predicted against ground-truth values for each test aggregate: (a) radius of gyration in nanometers, from about 25 to 110, and (b) fractal dimension, from about 1.65 to 1.85. A dashed diagonal marks perfect agreement; SAGE 2’s stars lie closest to it, CHT’s circles and EDM-WS’s diamonds scatter more, especially for fractal dimension
Radius of gyration (a) and fractal dimension (b) of each test aggregate, predicted against hand-segmented values. Points on the dashed line are perfect. Fig. 5 of Day, Mukut et al., Proceedings of the Combustion Institute 41 (2025).

Once trained, SAGE needs no adjustment from image to image, even for aggregates of different sizes from different microscopes.

Analyzing your own images

The release includes a notebook, SAGE_ANALYZE, that runs the whole analysis. In outline:

  1. Load your images. Put them in a folder under data/, in the same layout as the training data, with hand-drawn masks too if you have them, and list the folder in datasets_to_load.
  2. Load a model. Point model_paths at one or more pre-trained models. The notebook drops predictions with a confidence below 0.6.
  3. Look at the predictions. Save each image with its predicted particles overlaid, and a binary mask for every particle.
  4. Score them, if you have ground truth. IoU heatmaps color each prediction from green (good overlap) to red (poor), with unmatched predictions in pink, and the IoU distributions of several models or methods can be plotted together, as in the chart above.
  5. Measure the aggregates. Give the image scale in nanometers per pixel, and gather_aggregate_morphology() returns two tables: one per aggregate (number of primary particles, mean primary-particle diameter, radius of gyration and fractal dimension) and one per particle. Both can be saved as CSV files.

Choosing the model takes a few lines. Trimmed from the notebook:

model_paths = [
    os.path.join(PRETRAIN_DIR, "SAGE_2/SAGE_2.h5"),
]

class InferenceConfig(SAGEConfig):
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1
    DETECTION_MIN_CONFIDENCE = 0.6  # drop less confident predictions

Limits

  • A small test set. The results come from nine real images; the numbers may shift with a larger and more varied set.
  • TEM images are projections. Depth is lost and particles overlap in the image; synthetic training helps, but it cannot recover what the projection hides.
  • More data would help. More diverse synthetic and real images are the clearest way to improve it.
  • Hardware. The models were trained on older Nvidia Tesla K80 GPUs; newer GPUs need a matching CUDA and TensorFlow setup.

Get it

SAGE is open source under the GPL-3.0 license, on GitHub. The release includes five pre-trained models, SAGE0, SAGE1, SAGE2 and two comparison models trained from COCO weights, plus two Jupyter notebooks: one to train or fine-tune a model, and one to segment your own images, compare models and extract primary-particle diameter, radius of gyration and fractal dimension.

git clone https://github.com/comp-comb/SAGE.git
cd SAGE
conda env create -f requirements.yml     # or: micromamba env create -f requirements.yml -y
conda activate SAGE-env
jupyter notebook                         # then open SAGE_train or SAGE_ANALYZE

If you use SAGE, please cite the paper: T. P. Day, K. M. Mukut, L. Klacik, R. O’Donnell, J. Wasilewski and S. P. Roy, “SAGE: A machine learning model for primary particle segmentation in TEM images of soot aggregates,” Proceedings of the Combustion Institute 41, 105821 (2025), doi:10.1016/j.proci.2025.105821. The BibTeX entry is on the Publications page.

This work was partially funded by the Wisconsin Space Grant Consortium and supported by the National Science Foundation (grant No. 2144290).