The invention belongs to the sub-field of the learning theory and application in the technical field of computer application, and relates to a CCA and 2PKNN based automatic image annotation method, in order to solve problems of a semantic gap, a weak annotation, and category imbalance that exist in an automatic image annotation task. The method comprises: firstly, for a semantic gap problem, mapping two features to a CCA sub-space, and solving a distance between the two features in the sub-space; for a weak annotation problem, establishing a semantic space for each annotation; for a category imbalance problem, by combining a KNN algorithm, finding out k nearest neighbors of a test image in the semantic space of each annotation, constituting the k nearest neighbors to an image sub-set, and by using a visual distance between the sub-set and the test image, and by combining a Bayesian formula, assigning a few annotations with the highest score to the test image; and finally, optimizing an image annotation result by using correlation between annotations. The method disclosed by the present invention has a greater degree of improvement for image annotation performance.