End-to-End Framework for Efficient Deep Learning Using Metasurfaces Optics