Coder Social home page Coder Social logo

starry-lei / dlt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wix-incubator/dlt

0.0 0.0 0.0 3.9 MB

Diffusion Layout Transformer implementation.

Home Page: https://wix-incubator.github.io/DLT/

License: Apache License 2.0

Shell 0.43% Python 99.57%

dlt's Introduction

[ICCV 23] DLT: Conditioned layout generation with Joint Discrete-Continuous Diffusion Layout Transformer

This repository is an official implementation of DLT paper. Please, refer to the paper for more details and project page for general overview.

Unconditional Category Category + Size
unconditional category category_size

Dev environment

  • Operating System: Ubuntu 18.04
  • CUDA Version: 11.6
  • Python Version: 3.9

Requirements

All relevant requirements are listed in environment.yml. We recommend using conda to create the appropriate environment and install the dependencies:

conda env create -f environment.yml
conda activate dlt

Datasets

Please download the public datasets at the following webpages. Put it in your folder and update ./dlt/configs/remote/dataset_config.yaml accordingly.

  1. RICO
  2. PubLayNet
  3. Magazine

Training

You can train the model using any config script in configs folder. For example, if you want to train the provided DLT model on publaynet dataset, the command is as follows:

cd dlt
python main.py --config configs/remote/dlt_publaynet_config.yaml --workdir <WORKDIR>

Please, see that code is accelerator agnostic. if you don't want to log results to wandb, just set --workdir test in args.

Evaluation

To generate samples for evaluation on the test set, follow these steps:

  • train the model using the above command
  • Run the following command:
# put weights in config.logs folder
DATASET = "publaynet" # or "rico" or "magazine"
python generate_samples.py --config configs/remote/dlt_{$DATASET}_config.yaml \\
                           --workdir <WORKDIR> --epoch <EPOCH> --cond_type <COND_TYPE> \\
                           --save True
# get all the metrics 
# update path to pickle file in dlt/evaluation/metric_comp.py
./download_fid_model.sh
python metric_comp.py

where <COND_TYPE> can be: (all, whole_box, loc) - (unconditional, category, category+size) respectively, <EPOCH> is the epoch number of the model you want to evaluate, and <WORKDIR> is the path to the folder where the model weights are saved (e.g. rico_final). The generated samples will be saved in logs/<WORKDIR>/samples folder if save True.

An output from it is pickle file with generated samples. You can use it to calculate metrics.

The folder with weights after training has this structure:

logs
├── magazine_final
│   ├── checkpoints
│   └── samples
├── publaynet_final
│   ├── checkpoints
│   └── samples
└── rico_final
    ├── checkpoints
    └── samples

Citation

If you find this code useful for your research, please cite our paper:

@misc{levi2023dlt,
      title={DLT: Conditioned layout generation with Joint Discrete-Continuous Diffusion Layout Transformer},
      author={Elad Levi and Eli Brosh and Mykola Mykhailych and Meir Perez},
      year={2023},
      eprint={2303.03755},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

dlt's People

Contributors

mykhailychmykola avatar

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.