STEMGym / README.md
johnpolat's picture
Upload README.md with huggingface_hub
75cc41b verified
metadata
license: cc-by-4.0
task_categories:
  - reinforcement-learning
tags:
  - stem-microscopy
  - electron-microscopy
  - materials-science
  - gymnasium
  - benchmark
  - dose-efficiency
pretty_name: STEMGym
size_categories:
  - 1K<n<10K

STEMGym: Benchmark Data for Dose-Efficient Autonomous STEM Microscopy

This dataset accompanies the STEMGym benchmark — a Gymnasium-based environment for evaluating autonomous dose-efficient scanning transmission electron microscopy (STEM) agents.

Dataset Description

STEMGym provides simulated STEM specimens as HDF5 world files. Each world contains:

  • Overview image: Low-magnification survey of the full specimen
  • Tile grid: High-resolution STEM images (128×128 px tiles, 4px overlap, stride=124) arranged in an 8×8 grid
  • Ground truth annotations: Atom positions, defect types, and phase maps for scoring
  • Metadata: Pixel size, accelerating voltage, detector geometry, material parameters

Materials

Material Description Defect Types
SrTiO₃ Perovskite oxide O vacancies, Sr vacancies, Ti antisites
BaTiO₃ Ferroelectric perovskite O vacancies, Ba vacancies, domain boundaries
SiGe Semiconductor alloy Ge substitutions, strain fields

Difficulty Levels

Each material is provided at three difficulty levels (easy, medium, hard) controlling defect density, noise level, and spatial distribution.

Files

Simulated Worlds (worlds/)

File Material Difficulty Size
test_world.h5 Synthetic (Gaussian blobs) ~5 MB
srtio3_easy.h5 SrTiO₃ Easy ~50 MB
srtio3_medium.h5 SrTiO₃ Medium ~50 MB
srtio3_hard.h5 SrTiO₃ Hard ~50 MB
batio3_easy.h5 BaTiO₃ Easy ~50 MB
batio3_medium.h5 BaTiO₃ Medium ~50 MB
batio3_hard.h5 BaTiO₃ Hard ~50 MB
sige_easy.h5 SiGe Easy ~50 MB
sige_medium.h5 SiGe Medium ~50 MB
sige_hard.h5 SiGe Hard ~50 MB

Model Checkpoints (checkpoints/)

File Model Description Size
atom_finder.pt AtomFinderUNet Atomic column detection ensemble (3 members) ~88 MB
defect_classifier.pt DefectClassifierCNN Defect type classification ~1.4 MB
phase_identifier.pt PhaseIdentifierResNet Material phase identification ~7.4 MB

HDF5 World Format

Each world file follows this layout:

/metadata/
    pixel_size_nm          # Physical pixel size
    tile_size_px           # Tile dimensions (128)
    tile_overlap_px        # Overlap between tiles (4)
    grid_rows, grid_cols   # Grid dimensions
    accelerating_voltage   # Beam energy (keV)
    convergence_angle      # Probe convergence (mrad)
    detector_inner/outer   # HAADF detector angles (mrad)
/overview                  # Low-magnification survey image
/tiles/{row}_{col}         # High-resolution tile images
/ground_truth/
    atom_positions         # (N, 3) array: x, y, atomic_number
    defect_types           # (M, 4) array: x, y, type_id, severity
    phase_map              # 2D array: phase labels per pixel
/valid_region              # Boolean mask of valid scan area

Usage

# Install STEMGym
pip install -e .

# Download this data
python scripts/download_data.py

# Run a benchmark
stemgym run --agent raster_equipped --task defect_census --world srtio3_medium --seeds 3

License

This dataset is released under the CC-BY-4.0 license.

Citation

@inproceedings{stemgym2026,
  title={STEMGym: A Benchmark for Dose-Efficient Autonomous STEM Microscopy},
  author={Polat, John},
  year={2026}
}