Skip to content

Releases: zsylvester/segmenteverygrain

v0.3.0 — SAM 2.1 Migration

09 Feb 21:04

Choose a tag to compare

What's New

SAM 2.1 Migration

  • Migrated from segment-anything (SAM 1) to sam2 (SAM 2.1) across the entire codebase
  • SAM 2.1 checkpoint: sam2.1_hiera_large.pt (~900MB, down from ~2.4GB)
  • All notebooks, core library, docs, and dependencies updated

Cross-Platform GPU Support

  • Automatic device detection (CUDA / MPS / CPU) for all build_sam2() calls
  • macOS Apple Silicon: TensorFlow via Metal + PyTorch via MPS in the same environment
  • Pinned tensorflow<=2.18.1 for tensorflow-metal compatibility

Breaking Changes

  • Python ≥3.10 required (SAM 2 dependency)
  • segment-anything replaced by sam2 — update your imports:
    # Old (v0.2.x)
    from segment_anything import sam_model_registry, SamPredictor
    
    # New (v0.3.0)
    from sam2.build_sam import build_sam2
    from sam2.sam2_image_predictor import SAM2ImagePredictor
  • SAM checkpoint changed: download sam2.1_hiera_large.pt from here

segmenteverygrain v0.2.5

18 Jan 11:45

Choose a tag to compare

Major New Features

  1. New Interactive Editing Interface (interactions module)
  • New GrainPlot class - A fast interactive interface for editing grain segmentations (contributed by Dave Matthews)
  • New Grain class - Object-oriented representation of individual grains with measurement methods
  • New controls:
    • Left-click for instant grain creation or selection
    • Alt+click for multi-prompt grain creation
    • Shift+drag to draw scale bar for unit conversion
    • d to delete, m to merge, z to undo
    • Ctrl to temporarily hide grain masks
  • Helper functions: load_image(), polygons_to_grains(), save_grains(), save_summary(), save_histogram(), save_mask(), get_summary()
  1. New Grain Extraction & Clustering Module (grain_utils)
  • extract_grain_image() / extract_all_grains() - Extract individual grain images
  • extract_vgg16_features() - Deep learning feature extraction using pre-trained CNNs
  • extract_color_features() - Color-based feature extraction
  • cluster_grains() - Cluster grains using K-means/DBSCAN with PCA
  • create_clustered_grain_montage() - Visualize clustered grains
  • ClusterMontageSelector - Interactive QC tool for removing bad grains
  • ClusterMontageLabeler - Interactive tool for labeling grains by category
  • plot_classified_grains() - Visualize grains colored by classification

Repository Reorganization

  • Moved all Jupyter notebooks to notebooks/ folder
  • Updated all documentation links accordingly

Documentation Updates

  • Rewrote interactive editing documentation for new GrainPlot API
  • Added documentation for grain_utils module
  • Reorganized API reference with proper sections
  • Updated README with new interactive controls

Notebook Updates

  • Updated Segment_every_grain.ipynb to use new GrainPlot workflow
  • Updated Segment_every_grain_w_georeferencing.ipynb for new API
  • Updated Segment_every_grain_colab.ipynb for new API
  • Removed obsolete interactive notebook

Bug Fixes

  • Fixed edge grain handling
  • Fixed code to work when no scale bar is present
  • Reverted changes that were causing test failures

segmenteverygrain v0.2.3

04 Aug 21:43

Choose a tag to compare

Fixes mostly related to JOSS review process
Added materials related to the manuscript
Added notebook that illustrates training the U-Net model from scratch

segmenteverygrain v0.2.2

05 Feb 21:30

Choose a tag to compare

Fixes to notebook with georeferencing
Improved documentation
Minor fixes and tweaks

segmenteverygrain v0.2.1

22 Nov 23:06

Choose a tag to compare

Switch from Keras 2 to Keras 3
Updated Unet model (in Keras 3 format)
Added more sophisticated grain size distribution plots
Fixed bug in grain rasterization function

segmenteverygrain v0.2.0

31 Oct 18:26

Choose a tag to compare

Functions for fine tuning the Unet model
Saving and loading grain polygons
Add new grains to large images
Improvements to SAM segmentation function
Added initial set of tests

segmenteverygrain v0.1.9

01 Oct 10:20

Choose a tag to compare

Added documentation; improved efficiency when handling large images

segmenteverygrain v0.1.8

12 Sep 17:22

Choose a tag to compare

General code cleanup and better documentation. New function for working with large images, by breaking it up into patches. New option for cleaning up the SAM segmentation result when it is of poor quality and contains large objects that span multiple grains.

segmenteverygrain v0.1.7

05 Apr 21:44

Choose a tag to compare

Fixed installation issues.

segmenteverygrain v0.1.3

30 Mar 04:11

Choose a tag to compare

Better Unet model and improved Unet training.
Added notebook with georeferenced example.
Deleted images as they were taking up too much space.
https://pypi.org/project/segmenteverygrain/0.1.3/