12. A system comprising one or more computers and one or more storage devices storing instructions that, when executed by the one or more computers, cause the one or more computers to perform operations comprising: selecting a plurality of candidate videos from videos identified in a response to a search query derived from a label for an object category; selecting one or more initial frames from each of the candidate videos; detecting one or more initial images of objects in the object category in the initial frames; for each initial frame including an initial image of an object in the object category, tracking the object through surrounding frames to identify additional images of the object; selecting one or more images from the one or more initial images and one or more additional images as database images of objects belonging to the object category; generating statistics that identify frequencies of co-occurrences of objects in the candidate videos; and using the database images as training data for one or more learning models that predict a context of images or videos.
12. A system comprising one or more computers and one or more storage devices storing instructions that, when executed by the one or more computers, cause the one or more computers to perform operations comprising: selecting a plurality of candidate videos from videos identified in a response to a search query derived from a label for an object category; selecting one or more initial frames from each of the candidate videos; detecting one or more initial images of objects in the object category in the initial frames; for each initial frame including an initial image of an object in the object category, tracking the object through surrounding frames to identify additional images of the object; selecting one or more images from the one or more initial images and one or more additional images as database images of objects belonging to the object category; generating statistics that identify frequencies of co-occurrences of objects in the candidate videos; and using the database images as training data for one or more learning models that predict a context of images or videos. 20. The system of claim 12 , the operations further comprising: using the database images as training data for a first learning model that takes as an input sequences of frames extracted from videos and predicts other frames in the videos.