  Photomultiplier tubes (PMTs) are widely used in particle experiments for
photon detection. PMT waveform analysis is crucial for high-precision
measurement of the position and energy of incident particles in liquid
scintillator (LS) detectors. A key factor contributing to the energy resolution
in large liquid scintillator detectors with PMTs is the charge smearing of
PMTs. This paper presents a machine-learning-based photon counting method for
PMT waveforms and its application to the energy reconstruction, using the JUNO
experiment as an example. The results indicate that leveraging the photon
counting information from the machine learning model can partially mitigate the
impact of PMT charge smearing and lead to a relative 2.0% to 2.8% improvement
on the energy resolution at different energies.
