Under the combined action of the expansion of the chemical industry zone and urban boundaries, urban areas exposed to danger are also increasing. As containers for chemical storage, storage tanks are potential sources of hazards. Conducting target detection for hazard risk analysis is essential. YOLOv5, a single-stage algorithm with good performance, accurately identifies most storage tanks with clear contours and evident positions; however, the identification effect is not good for storage tanks with small targets or unclear boundaries. This study proposes an optimized model based on the YOLOv5 model. First, the Coordinate Attention (CA) mechanism is introduced to make the model focus on the effective information of the target. Second, to improve the detection effect of small targets, the model adds a small target detection head and performs multiscale target detection. Finally, the EIOU loss function is employed instead of the CIOU loss function in the original model to improve the algorithm’s accuracy and speed. Experimental results show that the optimized model significantly improves the detection effect on small targets compared with the original YOLOv5 model. The number of small targets detected by the optimized model is significantly increased compared with the original model, and the size of the smallest targets detected by the optimized model is reduced by about twice compared with the original model. The model’s accuracy, recall rate, and mean average precision (mAP@0.5) are improved, which can be better applied to the detection of storage tanks.