Git Product home page Git Product logo

fair's Introduction

FAIR

This is the official implementation for the paper 'Frequency-aware Image Restoration for Industrial Visual Anomaly Detection'. https://arxiv.org/abs/2309.07068 If you have any questions, you could contact [email protected] OverallFinal

Preparation

The method is evaluated on:
the MVTec AD dataset: https://www.mvtec.com/company/research/datasets/mvtec-ad
the VisA dataset: https://github.com/amazon-science/spot-diff

Training

MVTec AD

The original code uses the DTD dataset to create synthesized anomalies, so you first need to download it
: the DTD dataset (optional): https://www.robots.ox.ac.uk/~vgg/data/dtd/
Then

python train.py --gpu_id 0 --obj_id -1 --lr 0.0001 --bs 8 --epochs 800 --data_path /home/b211-3090ti/Anomaly-Dataset/mvtec_ad/ --anomaly_source_path /home/b211-3090ti/Anomaly-Dataset/dtd/images --log_path /home/b211-3090ti/FAIR/checkpoints_mvtecad/ --checkpoint_path /home/b211-3090ti/FAIR/checkpoints_mvtecad/ --visualize

Change all the involved paths to your own paths

VisA

activate line 16 and line 76 in data_loaderbhpfnoDTD.py

self.images = sorted(glob.glob(root_dir+"/*/*.JPG")) mask_file_name = file_name.split(".")[0]+".png"

Without extra data

It's also feasible to train it without extra data, just activate line 3 in train.py:

from data_loaderbhpfnoDTD import MVTecTrainDataset

Then

python train.py --gpu_id 0 --obj_id -1 --lr 0.0001 --bs 8 --epochs 800 --data_path /home/b211-3090ti/Anomaly-Dataset/mvtec_ad/ --log_path /home/b211-3090ti/FAIR/checkpoints_mvtecad/ --checkpoint_path /home/b211-3090ti/FAIR/checkpoints_mvtecad/ --visualize

Testing

python test.py --gpu_id 0 --base_model_name FAIR_0.0001_800_bs8 --data_path /home/b211-3090ti/Anomaly-Dataset/mvtec_ad/ --checkpoint_path /home/b211-3090ti/FAIR/checkpoints_mvtecad/

Change all the involved paths to your own paths

If you want to visualize the results, add

--saveimages

Pre-trained models

MVTec AD

https://drive.google.com/file/d/1uwodfQZSXNq_TToio0r8gflUCg1EwSJv/view?usp=sharing

https://pan.baidu.com/s/1y8eocVy8FKf88nCkyd_4_A jc5j

VisA

https://drive.google.com/file/d/1DKYOqZAE-wbjRamk8xBhKB1Q2qswYxFR/view?usp=sharing

https://pan.baidu.com/s/1uS6etphpGiVDKTGPYjDdCg qecd

Acknowledgment

We use the codes from https://github.com/VitjanZ/DRAEM, https://github.com/taikiinoue45/RIAD, and https://www.mvtec.com/company/research/datasets/mvtec-3d-ad

A big thanks to their great work

fair's People

Contributors

liutongkun avatar

Stargazers

 avatar Iris avatar  avatar  avatar  avatar shining_love avatar Wei jiajun avatar wind222 avatar  avatar Paolo Manchisi avatar 394481125 avatar  avatar Oliver Simons avatar Dıjvar Ekinci avatar  avatar Lei Zhang avatar MinHaoShao avatar Matic Fučka avatar  avatar RJ YIN avatar cgnerds avatar Scott Laue avatar TOMCAT avatar  avatar  avatar

Watchers

 avatar

fair's Issues

训练阶段对training图像做灰度处理的问题

刚才发你邮件提了个问题,在这里也发一遍以防收不到:
对toothbrush(牙刷)数据集,training数据集里的无缺陷图像,牙刷毛的颜色是多变的,那么如果训练先做灰度处理,怎么让网络学习 到底该输出怎样的牙刷毛的颜色?
在测试集里,牙刷毛的颜色并没有作为一种缺陷,那么testing流程中,把图像变成灰度再输入到网络,怎么保证输出的牙刷毛的颜色和原来的一样?检测性能下降了怎么办?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.