We previously found that the baseline drift of external and internal respiratory motion reduced the prediction accuracy of infrared (IR) marker-based dynamic tumor tracking irradiation (IR Tracking) using the Vero4DRT system. Here, we proposed a baseline correction method, applied immediately before beam delivery, to improve the prediction accuracy of IR Tracking. To perform IR Tracking, a four-dimensional (4D) model was constructed at the beginning of treatment to correlate the internal and external respiratory signals, and the model was expressed using a quadratic function involving the IR marker position (x) and its velocity (v), namely function F(x,v). First, the first 4D model, F-1st(x,v), was adjusted by the baseline drift of IR markers (BDIR) along the x-axis, as function F'(x,v). Next, BDdetect, that defined as the difference between the target positions indicated by the implanted fiducial markers (P-detect) and the predicted target positions with F'(x,v) (P-predict) was determined using orthogonal kV X-ray images at the peaks of the P-detect of the end-inhale and end-exhale phases for 10 s just before irradiation. F'(x,v) was corrected with BDdetect to compensate for the residual error. The final corrected 4D model was expressed as F-cor(x,v) = F-1st{(x-BDIR), v}-BDdetect. We retrospectively applied this function to 53 paired log files of the 4D model for 12 lung cancer patients who underwent IR Tracking. The 95th percentile of the absolute differences between P-detect and P-predict (vertical bar E-p vertical bar) was compared between F-1st(x,v) and F-cor(x,v). The median 95th percentile of vertical bar E-p vertical bar (units: mm) was 1.0, 1.7, and 3.5 for F-1st(x,v), and 0.6, 1.1, and 2.1 for F-cor(x,v) in the left-right, anterior-posterior, and superior-inferior directions, respectively. Over all treatment sessions, the 95th percentile of vertical bar E-p vertical bar peaked at 3.2 mm using F-cor(x,v) compared with 8.4 mm using F-1st(x,v). Our proposed method improved the prediction accuracy of IR Tracking by correcting the baseline drift immediately before irradiation.