In order to address the challenges of limited training data and diverse categories, a few-shot learning method was introduced. In view of the problems existing in dense object counting methods, such as unclear boundaries and spatial inconsistency of dense objects as well as weak generalization capability of model, a few-shot Similarity Matching Feature Enhancement dense object counting Network (SMFENet) was proposed. Firstly, image features were extracted through the feature extraction module, and sample features were aligned using ROI Align. Secondly, a Similarity Comparison Feature Enhancement Module (SCFEM) was designed to calculate similarity between sample features and image features, resulting in a similarity graph. This graph was used as weighting coefficients to enhance the image features adaptively with the sample features, so as to obtain the final enhanced features focusing more on regions with features similar to the sample features. At the same time, methods such as internal feature enhancement, internal scale enhancement and information fusion were employed to solve the problems of unclear boundaries and spatial inconsistency of dense objects. Finally, a density map was generated using the density prediction module. Additionally, the content-aware annotation method was used to generate high-quality Ground-Truth density maps to further improve the model accuracy. During test, the network was adjusted by adaptive loss to generalize to new categories. Experimental results on FSC-147 dataset and CARPK dataset show that compared with the existing few-shot counting methods, the proposed model has the Mean Absolute Error (MAE) reduced to 13.82 and Root Mean Squared Error (RMSE) reduced to 45.91, compared with class-specific counting method, the proposed model has the MAE reduced to 4.16 and RMSE reduced to 5.91. The above fully proves that SMFENet model can achieve good results in improving the accuracy and robustness of counting, demonstrates the practical application value of the model.