In this study, an improved model based on you only look once version 5 (YOLOv5) is proposed to solve the problem of difficult detection of small targets in images. In the backbone network, a convolutional block attention module (CBAM) is added to enhance the network feature extraction ability. As for the neck network, the bi-directional feature pyramid network (BiFPN) structure is used to replace the path aggregation network (PANet) structure and thereby strengthen the utilization of low-level features. Regarding the detection head, a high-resolution detection head is added to improve the ability of small target detection. A number of comparative experiments are conducted, respectively, on a facial blemish dataset and an unmanned aerial vehicle (UAV) dataset VisDrone2019. The results show that the proposed algorithm can effectively detect small targets.