Automatic and highly accurate lung segmentation in chest X-ray (CXR) images is the basis of computer-aided diagnosis systems, because the lung is the region of interest of many diseases, and it can show useful information through its contours. However, automatic lung segmentation is immensely challenging due to extreme variations in the shape, obscure lung area, or opacity caused by lung diseases reaches high-intensity values. In the face of these severe situations, the model may segment the lung boundary incorrectly. We designed an improved U-Net network: using the pre-training Efficientnet-b4 as the encoder, and the residual block and LeakyRelu activation function are used in the decoder. The network can not only extract features with high efficiency but also avoid the gradient explosion caused by the multiplication effect in gradient backpropagation. We constructed a CXR lung field segmentation dataset (Haut) based on the NIH CXR dataset. In particular, this lung segmentation dataset contains some serious abnormal cases, such as lung deformation, pleural effusion, covered by foreign matters, or CXR blur caused by severe lung disease. The improved U-Net is evaluated on Haut, JSRT, and Montgomery County (MC) datasets. Experimental results show that our network can achieve high-precision lung segmentation.