In order to solve the problems that ancient calligraphy fonts are missing due to the influence of historical factors, there are many kinds of fonts, but the amount of data is small, and the deep learning technology is not used to realize better recognition, an adaptive image enhancement and DenseNet calligraphy font style recognition algorithm is proposed, and better font recognition effect is achieved through optimization model. Through image processing and other technologies, more than forty thousand pictures of six types of calligraphy were collected, each type of calligraphy font contains at least three thousand common words, and the current popular neural network models: AlexNet, GoogleNet, SimpleNet, ResNet, DenseNet models were compared by training self-built data set. Finally, DenseNet network was selected for optimization, and Lion optimizer was used to optimize the network model. The training accuracy reached 97.24%, and the training effect was better than the popular neural network.