Merge branch 'improvement/RED-10018' into 'master'
feat: parameterize image stiching tolerance Closes RED-10018 See merge request redactmanager/image-classification-service!16
This commit is contained in:
commit
afa6fc34cb
@ -5,6 +5,7 @@ level = "INFO"
|
||||
# Print document processing progress to stdout
|
||||
verbose = false
|
||||
batch_size = 16
|
||||
image_stiching_tolerance = 1 # in pixels
|
||||
mlflow_run_id = "fabfb1f192c745369b88cab34471aba7"
|
||||
|
||||
# These variables control filters that are applied to either images, image metadata or service_estimator predictions.
|
||||
|
||||
@ -36,7 +36,7 @@ def process_pdf(pipeline, pdf_path, page_range=None):
|
||||
|
||||
|
||||
def main(args):
|
||||
pipeline = load_pipeline(verbose=True, batch_size=CONFIG.service.batch_size)
|
||||
pipeline = load_pipeline(verbose=CONFIG.service.verbose, batch_size=CONFIG.service.batch_size, tolerance=CONFIG.service.image_stiching_tolerance)
|
||||
|
||||
if os.path.isfile(args.input):
|
||||
pdf_paths = [args.input]
|
||||
|
||||
@ -3,6 +3,7 @@ from functools import lru_cache, partial
|
||||
from itertools import chain, tee
|
||||
|
||||
from funcy import rcompose, first, compose, second, chunks, identity, rpartial
|
||||
from kn_utils.logging import logger
|
||||
from tqdm import tqdm
|
||||
|
||||
from image_prediction.config import CONFIG
|
||||
@ -21,6 +22,7 @@ os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def load_pipeline(**kwargs):
|
||||
logger.info(f"Loading pipeline with kwargs: {kwargs}")
|
||||
model_loader = get_mlflow_model_loader(MLRUNS_DIR)
|
||||
model_identifier = CONFIG.service.mlflow_run_id
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ logger.reconfigure(sink=stdout, level=CONFIG.logging.level)
|
||||
# FIXME: Find more fine-grained solution or if the problem occurs persistently for python services,
|
||||
@wrap_in_process
|
||||
def process_data(data: bytes, _message: dict) -> list:
|
||||
pipeline = load_pipeline(verbose=CONFIG.service.verbose, batch_size=CONFIG.service.batch_size)
|
||||
pipeline = load_pipeline(verbose=CONFIG.service.verbose, batch_size=CONFIG.service.batch_size, tolerance=CONFIG.service.image_stiching_tolerance)
|
||||
return list(pipeline(data))
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user