1. An image forming apparatus comprising: a storage unit configured to store data of a plurality of patch images; an image forming unit configured to form, on a recording material, the plurality of patch images whose data is stored in the storage unit; a spectral data detection unit configured to irradiate the recording material with light, photoelectrically convert light beams of different wavelengths included in the reflected light, and detect an amount of the light beam of each wavelength; a border judgment unit configured to judge a border between two patch images adjacent to each other among the plurality of patch images formed on the recording material, based on change in the amount of the light beam of at least one noticed wavelength detected by the spectral data detection unit; a color value calculation unit configured to calculate a color value of a patch image from the amount of the light beam of each wavelength detected by the spectral data detection unit irradiating the patch image with the light; and a control unit configured to control an accumulation period of charge for the photoelectric conversion at the spectral data detection unit, wherein the control unit is further configured to make the accumulation period of the spectral data detection unit shorter when judging the border between the two patch images adjacent to each other than when calculating the color value of each of the two patch images.