Objective. Modern motor imagery (MI)-based brain computer interface systems often entail a large number of electroencephalogram (EEG) recording channels. However, irrelevant or highly correlated channels would diminish the discriminatory ability, thus reducing the control capability of external devices. How to optimally select channels and extract associated features remains a big challenge. This study aims to propose and validate a deep learning-based approach to automatically recognize two different MI states by selecting the relevant EEG channels. Approach. In this work, we make use of a sparse squeeze-and-excitation module to extract the weights of EEG channels based on their contribution to MI classification, by which an automatic channel selection (ACS) strategy is developed. Further, we propose a convolutional neural network to fully exploit the time-frequency features, thus outperforming traditional classification methods both in terms of accuracy and robustness. Main results. We execute the experiments using EEG signals recorded at MI where 25 healthy subjects performed MI movements of the right hand and feet to generate motor commands. An average accuracy of 87.2 +/- 5.0% (mean +/- std)Xenos cf. moutoni (Insecta, Strepsiptera, Xenidae) from Gaoligong Mountains, Southwest of China