Two-photon imaging is a major recording technique used in neuroscience. However, it suffers from several limitations, including a low sampling rate, the nonlinearity of calcium responses, the slow dynamics of calcium dyes and a low SNR, all of which severely limit the potential of two-photon imaging to elucidate neuronal dynamics with high temporal resolution. We developed a hyperacuity algorithm (HA_time) based on an approach that combines a generative model and machine learning to improve spike detection and the precision of spike time inference. Bayesian inference was performed to estimate the calcium spike model, assuming constant spike shape and size. A support vector machine using this information and a jittering method maximizing the likelihood of estimated spike times enhanced spike time estimation precision approximately fourfold (range, 2-7; mean, 3.5-4.0; 2SEM, 0.1-0.25) compared to the sampling interval. Benchmark scores of HA_time for biological data from three different brain regions were among the best of the benchmark algorithms. Simulation of broader data conditions indicated that our algorithm performed better than others with high firing rate conditions. Furthermore, HA_time exhibited comparable performance for conditions with and without ground truths. Thus HA_time is a useful tool for spike reconstruction from two-photon imaging.