1. A method of weighting visual features in an image, the method comprising: detecting, by a computing device, a plurality of visual features for the image; determining, by the computing device, a plurality of descriptors based on the plurality of visual features; determining, by the computing device, a visual word corresponding to each of the plurality of descriptors by quantizing each descriptor using a collection of known visual words; determining, by the computing device, a weight for each of the plurality of descriptors, wherein determining a weight for a descriptor comprises calculating the weight based on a vector associated with the visual word corresponding to the descriptor and a concatenated vector of a local context and a global context and based on a difference between the vector associated with the visual word corresponding to the descriptor and vectors associated with visual words corresponding to one or more descriptors of the plurality of descriptors that are neighbors of the descriptor; and adding the image to a database of images by the computing device, wherein the database of images is indexed based on the weighted descriptors.