In the course of my research on detecting defects in fabric, titled Deftecht, I initiated the data collection process by acquiring images, followed by pre-processing steps. Subsequently, the images were cropped and inputted into a machine learning model for comprehensive training. Using the python package, OpenCV. I implemented a method where non-defective regions in each image were isolated through masking, leaving the remaining parts blackened. These processed images serve as training data for Mask R-CNN, enabling it to identify and classify fabric defects. Mask R-CNN employs a set of bounding boxes, and takes an image as input in order to generate pixel segmentation masks for each object. This facilitates the precise identification of pixels corresponding to each object, enhancing the model’s ability to recognise and categorize fabric defects accurately.