layout-parser icon indicating copy to clipboard operation
layout-parser copied to clipboard

Empty label_map

Open ChenghaoMou opened this issue 3 years ago • 0 comments

Describe the bug

config_path, model_path = self.config_parser(
    config_path, model_path, allow_empty_path=True
)
config_path = PathManager.get_local_path(config_path)

if label_map is None:
    if config_path.startswith("lp://"):
        dataset_name = config_path.lstrip("lp://").split("/")[1]
        label_map = LABEL_MAP_CATALOG[dataset_name]
    else:
        label_map = {}

In src/layoutparser/models/detectron2/layoutmodel.py, config_pathis parsed and translated to a local path before it is parsed for label_map, and label_map becomes empty as a result.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. The bug has not been fixed in the latest version, see the Layout Parser Releases

To Reproduce Steps to reproduce the behavior:

  1. What command or script did you run?
import layoutparser as lp
model = lp.AutoLayoutModel("lp://detectron2/PubLayNet/faster_rcnn_R_50_FPN_3x")
model.label_map != {}

Environment

  1. Please describe your Platform [Windows/MacOS/Linux]: macOS
  2. Please show the Layout Parser version: 0.3.4
  3. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback If applicable, paste the error traceback here.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

ChenghaoMou avatar Sep 23 '22 21:09 ChenghaoMou