Giter Site home page Giter Site logo

ocr-gan's Introduction

OCR-GAN — Official PyTorch Implementation

For any inquiries, please contact Yufei Liang at [email protected] or [email protected]

Using the Code

Requirements

This code has been developed under Python3.7, PyTorch 1.2.0 and CUDA 10.0 on Ubuntu 16.04.

# Install python3 packages
pip install -r requirements.txt

Datasets

Download MVTec, and the dataset should be copied into ./data directory, and should have the following directory & file structure:

data
├──metal_nut
│   ├── test
│   │   ├── good
│   │   │   └── 000.png
│   │   │   └── 001.png
│   │   │   ...
│   │   │   └── n.png
│   │   ├── bad
│   │   │   └── 000.png
│   │   │   └── 001.png
│   │   │   ...
│   │   │   └── m.png
│   ├── train
│   │   ├── good
│   │   │   └── 000.png
│   │   │   └── 001.png
│   │   │   ...
│   │   │   └── t.png

Inference

  • Download pretraind NetG for the class "metal_nut" in MVTec dataset to the path output/ocr_gan_aug/metal_nut/train/weights/netG_best.pth.
  • Download pretraind NetD for the class "metal_nut" in MVTec dataset to the path output/ocr_gan_aug/metal_nut/train/weights/netD_best.pth.
python test.py --dataset metal_nut --isize 256 --model ocr_gan_aug --load_weights

Training

Train OCR-GAN model.

python train_all.py --dataset all --isize 256 --niter 200 --model ocr_gan_aug --batchsize 32

Citation

If our work is helpful for your research, please consider citing:

@article{liang2022omni,
  title={Omni-frequency Channel-selection Representations for Unsupervised Anomaly Detection},
  author={Liang, Yufei and Zhang, Jiangning and Zhao, Shiwei and Wu, Runze and Liu, Yong and Pan, Shuwen},
  journal={arXiv preprint arXiv:2203.00259},
  year={2022}
}

Acknowledgements

We thank the great work GANomaly for providing assistance for our research.

ocr-gan's People

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.