The primary aim of ANTARES is neutrino astronomy with upward going muons created in charged current muon neutrino interactions in the detector and its surroundings. Downward going muons are background for neutrino searches. These muons are the decay products of cosmic-ray collisions in the Earth's atmosphere far above the detector. This paper presents a method to identify and count electromagnetic showers induced along atmospheric muon tracks with the ANTARES detector. The method is applied to both cosmic muon data and simulations and its applicability to the reconstruction of muon event energies is demonstrated.