A machine vision system based on a convolutional neural network (CNN) was proposed to sortAmomum villosumusing X-ray non-destructive testing technology in this study. TheAmomum villosumfruit network (AFNet) algorithm was developed to identify the internal structure for quality classification and origin identification in this manuscript. This network model is composed of experimental features ofAmomum villosum. In this study, we adopted a binary classification method twice consecutive to identify the origin and quality ofAmomum villosum. The results show that the accuracy, precision, and specificity of the AFNet for quality classification were 96.33%, 96.27%, and 100.0%, respectively, achieving higher accuracy than traditional CNN under the condition of faster operation speed. In addition, the model can also achieve an accuracy of 90.60% for the identification of places of origin. The accuracy of multi-category classification performed later with the consistent network structure is lower than that of the cascaded CNNs solution. With this intelligent feature recognition model, the internal structure information ofAmomum villosumcan be determined based on X-ray technology. Its application will play a positive role to improve industrial production efficiency.