In the aerospace manufacturing industry, nondestructive evaluation (NDE) of components plays an important role. Porosities and other defects usually occur in the welds of these components. If such defects end up in the aircraft, the fatigue life of components is lessened, which may cause disastrous accidents. At present, those welds are manually evaluated by human inspectors via reviewing X-ray images. To reduce the workload of inspectors, we have developed an automatic inspection system for identifying defects in linear thin welds. For an X-ray image, this system starts with localizing the central line of the weld using a random forest (RF) regressor. A region surrounding the line is then investigated using an RF classifier in order to detect defects. After extensive experiments, the results demonstrate that the weld can be precisely localized from X-ray images, and the defect detection module can find 80% of defects that have been identified by human inspectors (i.e., true positives), while fewer than 1.6 false positives per image are returned. It is suggested that the system may be beneficial to human inspectors by reducing their workload. In addition, our system produces encouraging results on the publicly available weld X-ray image data set and a magnetic tile image data set.