Gravar-mail: Machine learning for pattern and waveform recognitions in terahertz image data