Perform cross-validation on average patch algorithm