Add outdir option to template_match.py