TY - GEN
T1 - Particle Swarm Optimization of SAM 2 Hyperparameters for Accurate Nanoparticle Counting
AU - Pantaleón, Jesús Manuel Anguiano
AU - De-la-Torre, Miguel
AU - Dewan, M. Ali Akber
N1 - Publisher Copyright:
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2027.
PY - 2027
Y1 - 2027
N2 - 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.
AB - 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.
KW - Automated particle counting
KW - Hyperparameter optimization
KW - Microscopy image analysis
KW - Nanoparticle counting
KW - Particle Swarm Optimization (PSO)
KW - Segment Anything Model 2 (SAM2)
KW - Transmission electron microscopy (TEM)
UR - https://www.scopus.com/pages/publications/105052472397
U2 - 10.1007/978-3-032-37441-7_47
DO - 10.1007/978-3-032-37441-7_47
M3 - Published Conference contribution
AN - SCOPUS:105052472397
SN - 9783032374400
T3 - Communications in Computer and Information Science
SP - 615
EP - 628
BT - Artificial Intelligence – COMIA 2026 - 18th Mexican Congress, 2026, Proceedings
A2 - Ponce, Hiram
A2 - Escalante, Hugo Jair
A2 - Vazquez, Roberto A.
T2 - 18th Mexican Congress on Artificial Intelligence, COMIA 2026
Y2 - 25 May 2026 through 29 May 2026
ER -