Defect detection is crucial in manufacturing processes but traditional AI-based algorithms require large datasets for accurate results. For new or customized products, the number of images with detected defects is limited. Therefore, we developed a few-shot learning approach integrating a prototypical and relation network (PRN), algorithms with meta-learning, and the Artificial Internet of Things (AIoT). For rapid defect detection with IoT sensors, such minimal data are used for a smart manufacturing ecosystem., making it ideal for dynamic production environments. We tested the AIOT-enhanced PRN on two datasets using the following data augmentation methods: random rotation and horizontal translation (RH), random rotation and vertical translation (RV), and horizontal and vertical translation (HV). The developed PRN efficiently learned from minimal data to reduce the occurrence of overfitting issues in the MVTec 3D-AD dataset which are caused by a limited number of defect sample images. When testing the AIOT-enhanced PRN with the NEU-DET dataset, accuracies in 5-way 5-shot settings using RV, RH, 15° rotation, and HV were 100 %. Under Gaussian noise, the AIOT-enhanced PRN showed an accuracy of 100 % in 5-way 5-shot and 5-way 1-shot scenarios using HV. For salt-and-pepper noise, the accuracy of the AIOT-enhanced PRN ranged from 98.49 to 99.04 %. The developed AIOT-enhanced PRN improved defect detection accuracy and real-time monitoring capability with minimal data. The developed AIOT-enhanced PRN can be used for efficient and flexible product quality control in Industry 4.0.