Automatic annotation of images is considered to be an important research problem in image retrieval. Traditional methods are computationally complex and fail to annotate correctly when the number of image classes is large and related. This paper proposes a novel approach, an autoencoder hashing, to categorize images of large-scale image classes. The intra bin classifiers are trained to classify the query image, and the tag weight and tag frequency are computed to achieve a more effective annotation of the query image. The proposed approach has been compared with other existing approaches in the literature using performance measures, such as precision, accuracy, mean average precision (MAP), and F1 score. The experimental results indicate that our proposed approach outperforms the existing approaches.