An image forming apparatus capable of detecting movement of a human body and changing its power supply mode on the basis of its detection comprising: a human body detecting device having a pyroelectric human body sensor being configured to produce a variable output signal having a voltage waveform with a positive or negative peak based on a certain level of offset voltage, depending on the amount of infrared energy emitted by a person and a lens being positioned to cover the human body sensor , the lens being configured to form a detecting area serving for detecting if the person enters, the detecting area extending outside of the human body detecting device itself in front of the image forming apparatus ; a peak detection means being configured to detect a peak of an output signal produced by the human body sensor when the person enters the detecting area ; an offset voltage judgment means being configured to judge if the output signal falls to the offset voltage after the peak detected by the detection means ; a moving direction judgment means being configured to judge the direction in which the person moves in the detecting area, on the basis of the peak value of the peak detected by the peak detection means and the judgment result obtained by the offset voltage judgment means ; and a mode control means being capable of switching a power supply mode for controlling power supply to each portion of the image forming apparatus , between a first operation mode and a second operation mode requiring less power than the first operation mode, the mode control means being configured to switch the power supply mode to the first operation mode if the power supply mode is found to be the second operation mode while the moving direction judgment means judges that the person moves toward the image forming apparatus . a human body detecting device having a pyroelectric human body sensor being configured to produce a variable output signal having a voltage waveform with a positive or negative peak based on a certain level of offset voltage, depending on the amount of infrared energy emitted by a person and a lens being positioned to cover the human body sensor , the lens being configured to form a detecting area serving for detecting if the person enters, the detecting area extending outside of the human body detecting device itself in front of the image forming apparatus ; a peak detection means being configured to detect a peak of an output signal produced by the human body sensor when the person enters the detecting area ; an offset voltage judgment means being configured to judge if the output signal falls to the offset voltage after the peak detected by the detection means ; a moving direction judgment means being configured to judge the direction in which the person moves in the detecting area, on the basis of the peak value of the peak detected by the peak detection means and the judgment result obtained by the offset voltage judgment means ; and a mode control means being capable of switching a power supply mode for controlling power supply to each portion of the image forming apparatus , between a first operation mode and a second operation mode requiring less power than the first operation mode, the mode control means being configured to switch the power supply mode to the first operation mode if the power supply mode is found to be the second operation mode while the moving direction judgment means judges that the person moves toward the image forming apparatus . <EOS>