Giter VIP home page Giter VIP logo

tactilecyclegan's Introduction

Implementation of CycleGAN for RGB-to-Tactile map translation

Installation setup
conda env create -f conda_env.yaml
Data directory structure:
.
└──TactileCycleGAN/
                  └── src
                  └── data/
                      ├── train/
                      │   ├── rgb
                      │   └── tactile
                      └── val/
                          ├── rgb
                          └── tactile
Training the model

Modify the Trainer instance in the src/train.py file:

trainer = Trainer(
    img_size=(256, 256),
    epochs=100,
    batch_size=20,
    shuffle=True,
    train_D_every=5,
    save_model_every=4,
    save_samples_every=4,
    save_model_dir='checkpoints',
    save_samples_dir='samples',
    # resume_ckpt_dir='checkpoints/91'
  )

  l_G, l_C, l_IDT, l_D = trainer.train()

Run train.py as a python module:

python -m src.train
FID metric

Provide the path to the netG_AB generator in the main function of the src/metrics/fid.py

...
netG_AB.load_state_dict(torch.load('checkpoints/81/netG_AB.pt'))
...

Run the fid.py file as a python module

python -m src.metrics.fid
LPIPS metric

Provide the path to the netG_AB generator in the main function of the src/metrics/lpips.py

...
netG_AB.load_state_dict(torch.load('checkpoints/81/netG_AB.pt'))
...

Run the fid.py file as a python module

python -m src.metrics.lpips
Inference

Modify the src/inference.py file

weight_path = 'checkpoints/81/netG_AB.pt'
_, loader = load_data('data', img_size=(256, 256))
output_path = 'inference'
inference(weight_path, output_path, loader)
...

Run the inference.py file as a python module:

python -m src.inference

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.