||Electromagnetic imaging is an emerging technology widely applied in many fields, such as medical imaging, biomedical imaging, and nondestructive testing. In this study, we place transmitter and receiver antennas around an unknown object. We can use the direct sampling method (DSM) to reconstruct the material size and shape of the unknown object on the basis of the scattered field. We apply U-Net to reconstruct electromagnetic images of perfect conductors. Perfect conductors in free space are studied by irradiating a transverse magnetic (TM) polarization wave. Using the scattered electric field measured outside the object together with the boundary conditions on the conductor surface, a set of nonlinear integral equations can be derived and further converted into matrix form by the method of moments. Since an iterative algorithm is computationally expensive and time-consuming, a real-time electromagnetic imaging technique combining deep learning neural networks is proposed for reconstructing the perfect conductors. The initial shapes of the conductors are first computed by DSM by using the scattered electric field measured outside the object. The initial shapes of the conductors are then input to U-Net for training. Numerical results show that U-Net is capable of reconstructing accurate conductor shapes. Therefore, artificial intelligence techniques can reconstruct shapes more accurately than iterative algorithms, when combined with DSM.