An image forming apparatus includes a photosensitive member charged to a predetermined polarity, an intermediary transfer belt, a primary transfer member forming a primary transfer portion, an
electrode member in contact with the inner
peripheral surface of the photosensitive member on a downstream side, first and second detecting portion to detect a current flowing through or a
voltage applied to the primary transfer member and the
electrode member, respectively, and a control portion, during non-
image formation, to execute a setting operation in which the transfer bias to be set during
image formation is set. In executing the setting operation, the control portion sets the transfer bias based on a first detecting result detected by the first detecting portion while a
voltage is applied to the primary transfer member and a second detecting result detected by the second detecting portion while the
voltage is applied to the primary transfer member.