1. A method for training a landmark detector, comprising: receiving training data including a plurality of training bags including: a plurality of positive training bags, each including a plurality of positively annotated instances; and a plurality of negative training bags, each including at least one negatively annotated instance; initializing a classification function by training a first weak classifier based on the positive training bags and the negative training bags; evaluating all training instances using the classification function; for each of a plurality of remaining weak classifiers: calculating a cost value gradient based only on spatial context information of each instance in each positive training bag evaluated by the classification function, wherein calculating the cost value gradient comprises calculating the spatial context information at a training bag level by determining a spread of each training bag; calculating a gradient value associated with each weak classifier based on the cost value gradients; selecting a weak classifier of the plurality of remaining weak classifiers having a lowest associated gradient value; determining a weighting parameter associated with the selected weak classifier; and adding the selected weak classifier to the classification function.