Update engine.py
Browse files
engine.py
CHANGED
@@ -16,15 +16,15 @@ from .stamp_processing.callback import remove_potiential_table_fp, remove_box_by
|
|
16 |
class Engine(f.Pipe):
|
17 |
|
18 |
def __init__(self, cfg:Config=None, table_checkpoint=None, line_checkpoint=None, verbose=True):
|
19 |
-
super().__init__(
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
self.stamp_detector.model.to(cfg.DEVICE)
|
27 |
-
|
28 |
def run(self, image):
|
29 |
# ratio = 1.0*self.standard_width/image.shape[1]
|
30 |
# image = self.preprocessor(image)
|
|
|
16 |
class Engine(f.Pipe):
|
17 |
|
18 |
def __init__(self, cfg:Config=None, table_checkpoint=None, line_checkpoint=None, verbose=True):
|
19 |
+
super().__init__(
|
20 |
+
cfg = cfg or Config(),
|
21 |
+
standard_width = cfg.STANDARD_WIDTH,
|
22 |
+
preprocessor = Preprocessor(cfg.STANDARD_WIDTH, cfg.STANDARD_INTERPOLATION),
|
23 |
+
post_processor = TableRestore(),
|
24 |
+
table_detector = self._build_table_detector(cfg, table_checkpoint),
|
25 |
+
stamp_detector = StampDetector(model_path=cfg.STAMP_DETECTION_CHECKPOINT, device=cfg.DEVICE)
|
26 |
+
)
|
27 |
self.stamp_detector.model.to(cfg.DEVICE)
|
|
|
28 |
def run(self, image):
|
29 |
# ratio = 1.0*self.standard_width/image.shape[1]
|
30 |
# image = self.preprocessor(image)
|