DDoS attack is easy to implement, concealed, and destructive. It has been a serious threat to network security. This paper chooses CIC-DDoS2019 as the dataset, removes the invalid redundant features and abnormal data from the dataset through data preprocessing, reconstructs the preprocessed network traffic data using One-Hot encoding, and finally selects the improved ResNet18 as the classifier to detect DDoS attacks. The experimental results show that the method can convert the network traffic data into binary images efficiently and improve the detection accuracy of ResNet18 to 98%.