In order to improve the ability of the collision warning system to perceive the surrounding environment,this paper proposed a collision warning system based on YOLOv5 and hazardous area judgment.Firstly,the discriminative ability and accuracy of the model were improved by the channel attention module,then,the extraction ability of the model for multi-size features was improved by using path aggregation network and spatial pyramid pooling,and finally,the warning accuracy of the warning system was improved by filtering relatively safe targets through the introduction of warning activation regions.The results show that the introduction of warning activation regions improves the accuracy,precision and recall of the warning system by 20%,50%and 26.7%,respectively,the running speed is increased by 49.1%,which further proves the effectiveness of the method.