For most existing fault diagnosis methods, feature extraction is always based on a complex artificial design and the complete feature extraction from an original signal. With the gradual complication of modern industrial machinery and equipment, it has become more difficult for traditional feature extractors to achieve the desired results. Deep convolutional neural networks (DCNNs) have been developed as effective techniques for fault classification but require large-scale high-intensity computing and prohibitive hardware resource requirements. This paper proposes a lightweight CNN that can be easily used for the fault diagnosis of rotating machinery by adjusting the network structure and optimizing the network. First, the raw vibration acceleration signal is transformed into a two-dimensional gray image. Second, two mature and commonly used modules named LeNet and NIN are combined to form a new model with a simple structure. Then, through parameter adjustment and optimization, an improved and optimized CNN with a lightweight structure and fewer parameters is constructed. The experimental verification has shown that this method has high accuracy and stability in fault diagnosis. Finally, the application of this new network for the fault diagnosis of rolling bearings with different damage levels but similar fault types shows high diagnostic accuracy and good generalization ability. In addition, we attempt to explain how the feature filters of a CNN work by visualizing the convolutional layer of the network.