Optimal target detection and tracking with accumulated observations