1. An image forming apparatus comprising: a control device configured to read a predetermined image pattern formed on an image forming medium using an optical sensor and configured to control image forming conditions based on information on the predetermined image pattern thus read; and a setting device configured to set an accumulation time of the optical sensor in accordance with at least one of a color and a density of the predetermined image pattern.