This library aims to give a simple access to the proposed defect generation approaches for industrial defects.
A demo is available in HuggingFace : Link
The library is designed to be straightforward to use with a single function that generate one or several defects and masks
image = Image.open('path/to/your/image').convert('RGB')
defGen=DefectGenerator(image.size)
defect,msk=defGen.genDefect(image,defectType=["nsa"])
image
(Pil Image)
: The input image defectType
(List[str])
: A list of string containing the defect types, candidates are "nsa", "structural", "textural", "blurred", "cutpaste", "cutpasteScar"category
(str, default="")
: The object category to mask the background if necessary return_list
(bool, default=False)
: To generate the output as a list of defective image and masks instead of a single defective image and maskIf return_list is False :
imageDefect
(torch.Tensor)
: The generated defective image mask
(torch.Tensor)
: The mask of the generated defectIf return_list is True :
imageDefect
(List[torch.Tensor])
: The list of the generated defective images mask
(List[torch.Tensor])
: The list of the masks of the generated defectsMethods currently implemented in the library
Article : https://arxiv.org/pdf/2109.15222.pdf
Code inspiration : https://github.com/hmsch/natural-synthetic-anomalies
Article : https://arxiv.org/pdf/2108.07610.pdf
Code inspiration : https://github.com/VitjanZ/DRAEM
Article : https://arxiv.org/ftp/arxiv/papers/2205/2205.00908.pdf
Code inspiration : https://github.com/TooTouch/MemSeg
Article : https://arxiv.org/pdf/2403.01859.pdf
Code inspiration : https://github.com/SimonThomine/CSE
Article : https://arxiv.org/pdf/2104.04015.pdf
Code inspiration : https://github.com/LilitYolyan/CutPaste