Skip to content

Commit b7c3c88

Browse files
committed
Replace dependency from fvcore with iopath
The used moduled of the fvcore library are available in iopath, which was extracted from fvcore.
1 parent ee20e9b commit b7c3c88

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"torch",
2828
"torchvision",
2929
"pycocotools>=2.0.2",
30-
"fvcore==0.1.1.post20200623",
30+
"iopath",
3131
],
3232
extras_require={
3333
"ocr": [

src/layoutparser/models/catalog.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from fvcore.common.file_io import PathHandler, PathManager, HTTPURLHandler
1+
from iopath.common.file_io import PathHandler, PathManager, HTTPURLHandler
22

33
MODEL_CATALOG = {
44
'HJDataset': {
@@ -77,5 +77,6 @@ def _open(self, path, mode="r", **kwargs):
7777
return PathManager.open(self._get_local_path(path), mode, **kwargs)
7878

7979

80-
PathManager.register_handler(DropboxHandler())
81-
PathManager.register_handler(LayoutParserHandler())
80+
PathManagerSingleton = PathManager()
81+
PathManagerSingleton.register_handler(DropboxHandler())
82+
PathManagerSingleton.register_handler(LayoutParserHandler())

src/layoutparser/models/layoutmodel.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
from PIL import Image
66
import numpy as np
77
import torch
8-
from fvcore.common.file_io import PathManager
9-
10-
# TODO: Update to iopath in the next major release
118

9+
from .catalog import PathManagerSingleton
1210
from ..elements import *
1311

1412
__all__ = ["Detectron2LayoutModel"]
@@ -95,7 +93,7 @@ class Detectron2LayoutModel(BaseLayoutModel):
9593
def __init__(self, config_path, model_path=None, label_map=None, extra_config=[]):
9694

9795
cfg = self._config.get_cfg()
98-
config_path = PathManager.get_local_path(config_path)
96+
config_path = PathManagerSingleton.get_local_path(config_path)
9997
cfg.merge_from_file(config_path)
10098
cfg.merge_from_list(extra_config)
10199

0 commit comments

Comments
 (0)