A method for detecting proximity of an object using inputs obtained from a plurality of optical sensors, wherein the plurality of optical sensors are arranged to form an array that is part of a sensor-in-pixel functionality of a display device of one or more computing devices, the method implemented by said one or more computing devices and comprising: receiving a plurality of inputs, each of the inputs being received from a respective one of the plurality of optical sensors; and detecting whether the object is proximal to the respective ones of the plurality of optical sensors, the detecting including classifying each of the plurality of inputs using machine learning as to whether the inputs are indicative of detection of an object by a respective said optical sensor; wherein the classifying is performed using a plurality of classifiers, wherein each of said plurality of classifiers uses machine learning to indicate detection of an object by the respective said optical sensor, and said classifying comprises: a first said classifier performing the classifying by taking as an input an image that includes both reflected infrared light and ambient infrared light and an image having ambient infrared light subtracted from the reflected infrared light and generating a probability map that describes detection of the object by respective ones of the plurality of optical sensors; and a second said classifier performing the classifying based at least in part on the input having the image that includes both reflected infrared light and ambient infrared light and generating a second probability map that describes a likelihood of detection of an object by respective ones of the plurality of optical sensors, and determining whether an object has been detected using the first and second probability maps. receiving a plurality of inputs, each of the inputs being received from a respective one of the plurality of optical sensors; and detecting whether the object is proximal to the respective ones of the plurality of optical sensors, the detecting including classifying each of the plurality of inputs using machine learning as to whether the inputs are indicative of detection of an object by a respective said optical sensor; wherein the classifying is performed using a plurality of classifiers, wherein each of said plurality of classifiers uses machine learning to indicate detection of an object by the respective said optical sensor, and said classifying comprises: a first said classifier performing the classifying by taking as an input an image that includes both reflected infrared light and ambient infrared light and an image having ambient infrared light subtracted from the reflected infrared light and generating a probability map that describes detection of the object by respective ones of the plurality of optical sensors; and a second said classifier performing the classifying based at least in part on the input having the image that includes both reflected infrared light and ambient infrared light and generating a second probability map that describes a likelihood of detection of an object by respective ones of the plurality of optical sensors, and a first said classifier performing the classifying by taking as an input an image that includes both reflected infrared light and ambient infrared light and an image having ambient infrared light subtracted from the reflected infrared light and generating a probability map that describes detection of the object by respective ones of the plurality of optical sensors; and a second said classifier performing the classifying based at least in part on the input having the image that includes both reflected infrared light and ambient infrared light and generating a second probability map that describes a likelihood of detection of an object by respective ones of the plurality of optical sensors, and determining whether an object has been detected using the first and second probability maps.