Deep learning for object detection offers the advantage of very low electrical power requirements but with the potential of a very large computation bandwidth due to the ability of Fraunhofer diffraction to perform correlation operations. However, many of the current designs of deep learning networks are not easily implemented in the optical domain. In this paper we develop a modified version of the deep learning library, Keras, that can accurately model optical systems. This allows the discovery of the optimal weights by calculating them on a realistic optical system. Noise sources, speckle models, and calibration errors can be accounted for. The effect of using readily realisable filters such as nematic liquid crystal phase only spatial light modulators is investigated. The effect of multiplexing a number of correlations in order to replicate the Conv2D multiple channel input is assessed. The effect of an optically implementable bias and activation functions are examined and compared to the state-of-the-art software implementations. We show that object recognition can be achieved using spatial light modulator technology and give comparable results to digital implementations.