One of the primary causes of traffic accidents is drowsy driving. Therefore, it is of paramount importance to detect driver drowsiness promptly through accurate electroencephalography (EEG) methods. Nevertheless, some existing drowsy driving detection experiments are overly idealized in design, resulting in significant discrepancies between the collected data and the actual driving environment. Additionally, the data granularity is relatively coarse. This paper proposes an EEG data acquisition and driver drowsiness detection scheme that simulates the real driving environment. First, by simulating the real driving environment, more realistic EEG data are successfully collected when the driver is performing a continuous concentration task. Second, a convolutional neural network (CNN) is employed, integrating the attention mechanism and multi -anchor attentive fusion technology. To address the issue of data imbalance resulting from subject -specific differences, a novel loss function was devised in conjunction with Focal Loss. This approach enables the model to focus its attention on a smaller number of samples, thereby enhancing the classification performance and robustness of the model. Furthermore, a contribution -based Gumbel channel selection module was introduced to reduce the computational cost while minimizing the impact of feature reduction on performance. To assess the efficacy of the proposed approach, extensive experiments were conducted on both public and self -built datasets. The experimental results demonstrate that the scheme is capable of effectively simulating real driving situations, accurately capturing drivers' EEG signals, and detecting their drowsy states. This approach may prove valuable in preventing traffic accidents caused by driver drowsiness. Data: https://github.com/jiki-mhe0509/driver_drowsy_data