Learning for feature selection and shape detection