feat: parameterize image stiching tolerance
Also sets image stitching tolerance default to one (pixel) and adds informative log of which settings are loaded when initializing the image classification pipeline.
This commit is contained in:
parent
d23034e38a
commit
a192e05be2
@ -5,6 +5,7 @@ level = "INFO"
|
|||||||
# Print document processing progress to stdout
|
# Print document processing progress to stdout
|
||||||
verbose = false
|
verbose = false
|
||||||
batch_size = 16
|
batch_size = 16
|
||||||
|
image_stiching_tolerance = 1 # in pixels
|
||||||
mlflow_run_id = "fabfb1f192c745369b88cab34471aba7"
|
mlflow_run_id = "fabfb1f192c745369b88cab34471aba7"
|
||||||
|
|
||||||
# These variables control filters that are applied to either images, image metadata or service_estimator predictions.
|
# 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):
|
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):
|
if os.path.isfile(args.input):
|
||||||
pdf_paths = [args.input]
|
pdf_paths = [args.input]
|
||||||
|
|||||||
@ -3,6 +3,7 @@ from functools import lru_cache, partial
|
|||||||
from itertools import chain, tee
|
from itertools import chain, tee
|
||||||
|
|
||||||
from funcy import rcompose, first, compose, second, chunks, identity, rpartial
|
from funcy import rcompose, first, compose, second, chunks, identity, rpartial
|
||||||
|
from kn_utils.logging import logger
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from image_prediction.config import CONFIG
|
from image_prediction.config import CONFIG
|
||||||
@ -21,6 +22,7 @@ os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
|
|||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@lru_cache(maxsize=None)
|
||||||
def load_pipeline(**kwargs):
|
def load_pipeline(**kwargs):
|
||||||
|
logger.info(f"Loading pipeline with kwargs: {kwargs}")
|
||||||
model_loader = get_mlflow_model_loader(MLRUNS_DIR)
|
model_loader = get_mlflow_model_loader(MLRUNS_DIR)
|
||||||
model_identifier = CONFIG.service.mlflow_run_id
|
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,
|
# FIXME: Find more fine-grained solution or if the problem occurs persistently for python services,
|
||||||
@wrap_in_process
|
@wrap_in_process
|
||||||
def process_data(data: bytes, _message: dict) -> list:
|
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))
|
return list(pipeline(data))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user