|
|
|
|
|
|
|
|
# limitations under the License. |
|
|
# limitations under the License. |
|
|
# |
|
|
# |
|
|
import logging |
|
|
import logging |
|
|
|
|
|
import os |
|
|
import re |
|
|
import re |
|
|
from concurrent.futures import ThreadPoolExecutor, ALL_COMPLETED, wait |
|
|
from concurrent.futures import ThreadPoolExecutor, ALL_COMPLETED, wait |
|
|
from threading import Lock |
|
|
from threading import Lock |
|
|
|
|
|
|
|
|
lbls = [np.where(prob > self._threshold)[0] for prob in probs] |
|
|
lbls = [np.where(prob > self._threshold)[0] for prob in probs] |
|
|
lbls = [lbl[0] if isinstance(lbl, np.ndarray) else lbl for lbl in lbls] |
|
|
lbls = [lbl[0] if isinstance(lbl, np.ndarray) else lbl for lbl in lbls] |
|
|
lock = Lock() |
|
|
lock = Lock() |
|
|
with ThreadPoolExecutor(max_workers=12) as executor: |
|
|
|
|
|
|
|
|
with ThreadPoolExecutor(max_workers=int(os.environ.get('GRAPH_EXTRACTOR_MAX_WORKERS', 10))) as executor: |
|
|
threads = [] |
|
|
threads = [] |
|
|
for c in range(n_clusters): |
|
|
for c in range(n_clusters): |
|
|
ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c] |
|
|
ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c] |