The diversification of network applications has become more comprehensive with the development of 5G mobile networks and Internet of things (IoT). Traditional intrusion detection system using rule-based anomaly technology is obviously insufficient for the changing network environment. Integrating the deep learning (DL) model can help intrusion detection system discover newly or unknown hacker’s behavior. However, the quality of training dataset for DL is usually critical. If the dataset has not enough amount for training or is imbalanced for some kinds of attack categories, these situations may influence the detection accuracy. This paper aims to enhance the usage of dataset by dynamically adjusting the records of categories using Random Under-Sampling (RUS) and Generative Adversarial Network (GAN) models. The experiments show that the proposed approach has superior results in terms of the accuracy and some kinds of recall rates, compared to the evaluations of several previous studies.