Creating particle recognition training data for deep learning

Last modified by hajaalin@helsinki_fi on 2024/01/24 07:08

(Thanks to Piotr Chmielarz for this info and for pioneering deep-learning approach at the Viikki Campus)

Description of Training data

The training data consists of 1) original data and 2) annotations as binary images with a single white pixel indicating the center of the particle. Other indications:

  • All images the same size.
  • Even image size.
  • Not too big images, 400 x 400 is still good.
  • All particles in the image must be annotated.
  • 8-bit binary images.
  • Include also difficult cases in the training set.
  • Save original and annotation with the same name in different folders
    • training_data/originals/image2.tiff
    • training_data/annotations/image2.tiff

Creating the training data set with Fiji

  1. Open original file (File → Open...).
  2. Duplicate original file (Image → Duplicate...).
  3. Close original file.
  4. Crop duplicate to 400 x 400 or smaller.
    1. Open macro editor (File → New → Script).
    2. Set language to ImageJ macro language (Language → IJ1 macro).
    3. Type in editor screen "makeRectangle(50, 50, 400, 400);" (without the "s).
    4. Click "Run".
    5. Select the image window and verify that a rectangular selection was created.
    6. Drag the selection to a good location on the image.
    7. Crop (Image → Crop).
  5. Create multi-point selection.
    1. Select multi-point tool.
    2. Click on particle centers.
  6. Create a blank annotation image.
    1. Duplicate cropped image (Image → Duplicate).
    2. Edit → Selection → Select all.
    3. Edit → Clear.
    4. Image → Type → 8-bit.
  7. Transfer annotations.
    1. Select the image with particles selected
    2. Edit → Selection → Add to Manager.
    3. Select the blank image.
    4. Select ROI Manager, click on the point set.
  8. Draw pixels.
    1. Select the blank images (now with particle centers)
    2. Edit → Draw.
  9. Save files (File → Save as... → TIFF)