Semiparametric Bayesian inference for local extrema of functions in the presence of noise