mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-07-01 06:59:54 +02:00
switch from stdlib to loky.ProcessPoolExecutor, ensure shutdown
This commit is contained in:
parent
f93c6c288d
commit
0ae28f7d3e
2 changed files with 5 additions and 2 deletions
|
@ -5,3 +5,4 @@ scikit-learn >= 0.23.2
|
|||
tensorflow < 2.13
|
||||
imutils >= 0.5.3
|
||||
numba <= 0.58.1
|
||||
loky
|
||||
|
|
|
@ -10,11 +10,12 @@ import math
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import atexit
|
||||
import warnings
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from multiprocessing import cpu_count
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from loky import ProcessPoolExecutor
|
||||
import gc
|
||||
from ocrd_utils import getLogger
|
||||
import cv2
|
||||
|
@ -257,7 +258,8 @@ class Eynollah:
|
|||
pcgts=pcgts)
|
||||
self.logger = logger if logger else getLogger('eynollah')
|
||||
# for parallelization of CPU-intensive tasks:
|
||||
self.executor = ProcessPoolExecutor(max_workers=cpu_count())
|
||||
self.executor = ProcessPoolExecutor(max_workers=cpu_count(), timeout=1200)
|
||||
atexit.register(self.executor.shutdown)
|
||||
self.dir_models = dir_models
|
||||
self.model_dir_of_enhancement = dir_models + "/eynollah-enhancement_20210425"
|
||||
self.model_dir_of_binarization = dir_models + "/eynollah-binarization_20210425"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue