Skip to main navigation Skip to search Skip to main content

Particle Swarm Optimization of SAM 2 Hyperparameters for Accurate Nanoparticle Counting

  • Universidad de Guadalajara

Research output: Chapter in Book/Report/Conference proceeding › Published Conference contribution › peer-review

Abstract

Automatic particle counting in microscopy images is a fundamental task in quantitative image analysis, where segmentation accuracy directly impacts the estimation of morphological and statistical properties. Recently, foundation segmentation models such as Segment Anything Model 2 (SAM2) have demonstrated strong generalization capabilities; however, their performance remains highly sensitive to hyperparameter configuration, which is commonly determined through manual and empirical procedures. Although the motivation of this work is related to nanoparticle analysis in microscopy, the experimental validation is conducted on a controlled synthetic dataset to ensure reproducibility. In this work, we propose an automatic hyperparameter optimization framework for SAM2 based on Particle Swarm Optimization (PSO), aiming to minimize the Mean Absolute Error (MAE) in particle counting. The evaluation was conducted using the BBBC004v1 dataset from the Broad Bioimage Benchmark Collection, which contains synthetic microscopy images with different levels of object overlap. A subset of 25 images was selected across five overlap levels (0%, 15%, 30%, 45%, and 60%), totaling 7,500 annotated particles/objects. The optimization process targeted the hyperparameters points_per_side, pred_iou_thresh, stability_score_thresh, min_mask_region_area, and box_nms_thresh, using the average MAE across the image set as the cost function. Experimental results indicate that the proposed PSO-based method consistently improves counting accuracy compared to baseline configurations. These findings establish a systematic and reproducible strategy for hyperparameter tuning in foundation models, facilitating their application to quantitative analysis of particle-like structures in microscopy images.

Original languageEnglish
Title of host publicationArtificial Intelligence – COMIA 2026 - 18th Mexican Congress, 2026, Proceedings
EditorsHiram Ponce, Hugo Jair Escalante, Roberto A. Vazquez
Pages615-628
Number of pages14
DOIs
Publication statusPublished - 2027
Event18th Mexican Congress on Artificial Intelligence, COMIA 2026 - Cuernavaca, Mexico
Duration: 25 May 2026 → 29 May 2026

Publication series

NameCommunications in Computer and Information Science
Volume3097 CCIS
ISSN (Print)1865-0929
ISSN (Electronic)1865-0937

Conference

Conference18th Mexican Congress on Artificial Intelligence, COMIA 2026
Country/TerritoryMexico
CityCuernavaca
Period25/05/26 → 29/05/26

Keywords

  • Automated particle counting
  • Hyperparameter optimization
  • Microscopy image analysis
  • Nanoparticle counting
  • Particle Swarm Optimization (PSO)
  • Segment Anything Model 2 (SAM2)
  • Transmission electron microscopy (TEM)

Fingerprint

Dive into the research topics of 'Particle Swarm Optimization of SAM 2 Hyperparameters for Accurate Nanoparticle Counting'. Together they form a unique fingerprint.

Cite this