# GAN-defect
This project is mainly based on the paper: [A Surface Defect Detection Method
Based on Positive Samples](https://link.springer.com/chapter/10.1007/978-3-319-97310-4_54).
The model details in this project may be not completely consistent to the model proposed in the paper.
![model](demo/model.png)
## Requirements
- pytorch 1.4.0
- torchvision 0.5.0
## Introduction
The model is proved to be able to "repair" the images which are simple and with periodic texture,
here "repair" means generating images without surface defects from the images with defects.
After getting the repaired images, one can use LBP feature to get the defect area, which is proposed in the paper,
or use a segmentation network to output the defect area(to be deployed).
The input images are normal image patches without defects,
the defect will be added automatically during the training process.
The defects can be randomly generated geometric shapes(deployed) or defect patches in the collection.
## Results
The following results come from a simple demo, in which the normal images are artifical grid images(randomly generated).
![train data example](demo/1.jpg)
*train data example*
![train result example](demo/0_defect_repair.jpg)
*train results(certain batch with 16 images)*
![train result example](demo/0_defect_repair_val.jpg)
*val results(certain batch with 16 images)*
In above result images, the top 2 lines shows the images with surface defect,
and the bottom 2 lines show the corresponding repaired results.
In this demo, the surface defects added in the training process are circles and rectangles,
and the surface defects used in validation process are lines.
From validation results, it can be observed that when the normal images
are simple enough, the "repair" results are relatively robust to defect color and shape.
## Train and validate
As far the training and validation settings can be modified in `train.py` directly.
Modify the parameters in `class Config` and then run `train.py`.
## Remark
- The segmentation branch is not well deployed so cannot be used now.
- The test part is not completed so far.
- The project is just a demo to verify the methods proposed in the paper mentioned above.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 基于Python实现无监督正样本训练并进行图片中缺陷检测源码+项目说明.zip 在给定只有正样本的数据情况下,训练我们的模型,输入一张带有缺陷的图片使得模型能够检测出图片中的缺陷mask。 ## 给了两个part的数据,part1包含黑灰图,part2有白边包围和纯黑图,这些都为正样本。此外数据集包含TC_image,测试集,包含了正常样本和负样本,然后判定哪些为负样本,并将负样本中的缺陷mask标记出来。负样本包含了凸起,块状,线状、缺口等缺陷。 背景比较单一,图片属于平坦区域,因此使用较简单的模型。 ## 复杂图像数据集训练集包含无缺陷大图原图(OK Image)而不是简单图像那样的切片。由于数据集的复杂纹理使得适用于简单图像的模型不在适合这里的数据集。待测试的图(TC_image)是一些切片。 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
基于Python实现无监督正样本训练并进行图片中缺陷检测源码+项目说明.zip (120个子文件)
r.bmp 48KB
t.bmp 48KB
k.bmp 48KB
s.bmp 48KB
r.bmp 48KB
Dockerfile 261B
.gitignore 50B
project.iml 454B
description.ipynb 19KB
0_defect_repair_val.jpg 77KB
0_defect_repair.jpg 74KB
1.jpg 3KB
README.md 2KB
项目说明.md 834B
README.md 1B
README.md 1B
README.md 1B
README.md 1B
README.md 1B
正样本缺陷检测.pdf 1.51MB
model.png 51KB
f.png 9KB
wae_flaw.py 16KB
fcn.py 15KB
csf_res2net.py 11KB
csf_res2net.py 11KB
train.py 10KB
gen1.py 9KB
gen1.py 9KB
test.py 9KB
gen2.py 9KB
gen2.py 9KB
imutils.py 9KB
gen3.py 8KB
gen3.py 8KB
trainer.py 8KB
gOctConv.py 6KB
gOctConv.py 6KB
dataset.py 6KB
dataset.py 6KB
indexing.py 6KB
train.py 5KB
train_x.py 5KB
p3.py 5KB
p3.py 5KB
p1.py 5KB
p1.py 5KB
p2.py 5KB
p2.py 5KB
defect.py 5KB
tc_dataloader.py 5KB
model.py 4KB
resnet50.py 4KB
filter.py 4KB
filter.py 4KB
test_wae_flaw.py 4KB
test_part1.py 4KB
utils.py 3KB
utils.py 3KB
test_part2.py 3KB
main.py 3KB
train_part1.py 3KB
train_part1.py 3KB
train_part2.py 3KB
train_part2.py 3KB
train_part3.py 3KB
train_part3.py 3KB
test.py 3KB
pyutils.py 3KB
wae.py 2KB
wae.py 2KB
unet.py 2KB
resnet50_cam.py 2KB
utils.py 2KB
torchutils.py 2KB
test.py 1KB
main.py 1KB
main.py 1KB
loss.py 875B
main.py 663B
test.py 436B
test.py 436B
Test.py 45B
__init__.py 0B
__init__.py 0B
fcn.pyc 13KB
fcn.cpython-37.pyc 11KB
fcn.cpython-36.pyc 11KB
csf_res2net.cpython-37.pyc 9KB
defect.pyc 6KB
trainer.pyc 5KB
defect.cpython-37.pyc 5KB
defect.cpython-36.pyc 5KB
dataset.cpython-37.pyc 5KB
dataset.cpython-37.pyc 5KB
gOctConv.cpython-37.pyc 4KB
trainer.cpython-37.pyc 4KB
trainer.cpython-36.pyc 4KB
model.pyc 4KB
train.cpython-37.pyc 4KB
共 120 条
- 1
- 2
资源评论
Make程序设计
- 粉丝: 6787
- 资源: 3575
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于opencv+yolov8实现目标追踪及驻留时长统计源码.zip
- 水稻病害基于Yolov8算法优化目标检测识别与AI辅助决策python源码+模型+使用说明.zip
- 海尔618算价表_七海5.20_16.00xlsx(1)(2).xlsx
- WebCrawler.scr
- 【计算机专业毕业设计】大学生就业信息管理系统设计源码.zip
- YOLO 数据集:8种路面缺陷病害检测【包含划分好的数据集、类别class文件、数据可视化脚本】
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于YOLOv8的FPS TPS AI自动锁定源码+使用步骤说明.zip
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于yolov8+streamlit的火灾检测部署源码+模型.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功