Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.75k stars 456 forks source link

[feat] AutoLayoutModel and flexible model configs #69

Closed lolipopshock closed 2 years ago

lolipopshock commented 2 years ago

After this update, layout-parser will provide more flexible ways of initializing the models and specifying the model configs:

  1. New AutoLayoutModel class that supports the convenient loading of the models from different backends. There are several different ways of specifying the models:

    1. AutoLayoutModel("lp://<detector-name>/<dataset-name>/<model-arch>/config") will create a model of the <detector-name> backed using the "lp://<dataset-name>/<model-arch>/config".
    2. AutoLayoutModel("lp://<detector-name>/<dataset-name>/<model-arch>") is more concise: it works the same as the command above, while you don't need to specify the config in the input.
    3. AutoLayoutModel("lp://<detector-name>/<dataset-name>") will automatically find the corresponding <model-arch> for you as long as there are models trained for this dataset.

    Here are some examples:

    1. lp.AutoLayoutModel("lp://efficientdet/PubLayNet/tf_efficientdet_d0/config")
    2. lp.AutoLayoutModel("lp://efficientdet/PubLayNet/tf_efficientdet_d0")
    3. lp.AutoLayoutModel("lp://efficientdet/PubLayNet")
  2. Similar level of flexibility is also supported for existing LayoutModels:

    1. lp.XXLayoutModel("lp://<dataset-name>/<model-arch>/config")
    2. lp.XXLayoutModel("lp://<dataset-name>/<model-arch>")
    3. lp.XXLayoutModel("lp://<dataset-name>")