The vehicle detection algorithm is an important part of the intelligent transportation system. The accuracy of the algorithm will determine whether accurate vehicle information can be obtained. The system contains several functional modules, including signal amplification, wireless communication, A/D converter, and sensor set/reset functions. To detect all the intersection vehicles, a number of magnetoresistive sensors are connected to the computer system through the wireless communication module, and then, the detected vehicle information will be transferred back to the master host computer. In this paper, two common vehicle detection algorithms, fixed threshold algorithm and adaptive threshold algorithm, were analyzed in the vehicle detection system with magnetoresistive sensors, simultaneously. Finally, an improved multi-intermediate state machine algorithm for vehicle detection was proposed. Using the intermediate state, this algorithm cannot only detect when the vehicle enters the detection area but also decide whether the vehicle leaves the sensor node or not. In this way, it improves the detection accuracy.