Skip to content
Artificial intelligence. Clearly. RSS feed
AI NEWS AI

News. Evidence. Perspective.

Train an image mask with a few brush strokes in ilastik

Turn a small photo into a two-class label image by teaching a local classifier which pixels belong together.

ilastik’s Pixel Classification trains a random forest from painted examples. This exercise follows the product documentation.[1]

With ilastik installed, prepare a small PNG of dark buttons on pale paper for this exercise.[2]

  1. Create a Pixel Classification project. In Input Data, choose Add New → Add separate image(s) and open the PNG.
  2. Under Feature Selection → Select features, select all feature types and scales for this small 2D image.
  3. In Training, rename the two labels Button and Paper. Select each label and draw short scribbles inside matching areas.
  4. Turn on Live update. Inspect the Segmentation overlay; add corrective scribbles where paper becomes button, or vice versa. Include edges and shadows.
[4][2][1]

If a stroke marks the wrong class, erase it. The classifier updates as you correct the examples.[1]

In Prediction Export, choose Simple Segmentation as Source. Under Choose Settings, select TIFF and a destination filename. Check Live Preview against the button edges, then Export. The saved image assigns a class label to each pixel.[3][1]

Follow the evidence

Sources & further reading

  1. Pixel Classification ilastik · Accessed 20 Oct 2026
  2. Data Selection ilastik · Accessed 20 Oct 2026
  3. Exporting Output ilastik · Accessed 20 Oct 2026
  4. The Startup Screen ilastik · Accessed 20 Oct 2026