Optimization Algorithm and Implementation of Pedestrian Detection