1. A non-transitory computer-readable medium comprising one or more sets of instructions which, when executed by one or more processors, causes the one or more processors to perform a method for training an adaptive thresholding model for detecting an object in an image, the method comprising: for each training image in a set of training images: obtaining a set of training image patches, each training image patch having an associated detector response value; computing a normalized histogram of the detector response values; computing an optimal threshold value using the detector response values and the ground truth for the training image; and training a regression model using the normalized histograms and their associated optimal threshold values, the regression model for predicting an optimal threshold value for an input image given a set of detector response values for the input image.