Skip to content

Generate training set writes zero-size .scnt despite visible annotations and training boxes #13

Description

@hwl26

Hi,

I am using Ais to create a training set from a .scns file. The GUI shows that both annotation masks and training boxes are present, but when I click Generate set, the exported .scnt file is always an empty TIFF with shape (0,).

Image Image

What I did:

  1. Opened a .scns file in Ais: ais 2025080xxxxxx_Position_2_2_12.11Apx_d3.scns
  2. In the GUI, I created annotations for feature A.
  3. I added positive boxes for A and negative boxes for notB.
  4. The GUI shows:
  • Positive samples: 31
  • Negative samples: 59
  • box size: 106 pixel
  1. I saved the .scns file.
  2. I reopened the saved .scns file and confirmed that the annotation masks and boxes are still visible.
  3. I clicked Generate set and saved the training set as: 106_A.scnt

Expected behavior:
The exported .scnt file should contain the extracted training patches, for example with a shape similar to:
(N, 2, box_size, box_size)
or another non-empty training-data array.

Actual behavior:
The exported .scnt file is always very small and contains an empty array:
Use:
python - <<'PY'
import os, tifffile
p = "106_A.scnt"
print("file size:", os.path.getsize(p))
a = tifffile.imread(p)
print("shape:", a.shape)
print("ndim:", a.ndim)
print("dtype:", a.dtype)
print("size:", a.size)
PY

Output:
file size: 296
shape: (0,)
ndim: 1
dtype: float64
size: 0

During export, Ais prints this warning in prompt:
/home/wl/.conda/envs/ais/lib/python3.9/site-packages/tifffile/tifffile.py:2357:
UserWarning: <tifffile.TiffWriter '106_A.scnt'> writing zero-size array to nonconformant TIFF
warnings.warn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions