Commit 7bf5581a authored by Yuxin Wu's avatar Yuxin Wu

[MaskRCNN] fix the use of `thread_name_prefix` in Python3.5 (fix #1039)

parent f585913b
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# File: eval.py # File: eval.py
import itertools import itertools
import sys
import os import os
import json import json
import numpy as np import numpy as np
...@@ -160,7 +161,8 @@ def multithread_predict_dataflow(dataflows, model_funcs): ...@@ -160,7 +161,8 @@ def multithread_predict_dataflow(dataflows, model_funcs):
assert len(dataflows) == num_worker assert len(dataflows) == num_worker
if num_worker == 1: if num_worker == 1:
return predict_dataflow(dataflows[0], model_funcs[0]) return predict_dataflow(dataflows[0], model_funcs[0])
with ThreadPoolExecutor(max_workers=num_worker, thread_name_prefix='EvalWorker') as executor, \ kwargs = {'thread_name_prefix': 'EvalWorker'} if sys.version_info.minor >= 6 else {}
with ThreadPoolExecutor(max_workers=num_worker, **kwargs) as executor, \
tqdm.tqdm(total=sum([df.size() for df in dataflows])) as pbar: tqdm.tqdm(total=sum([df.size() for df in dataflows])) as pbar:
futures = [] futures = []
for dataflow, pred in zip(dataflows, model_funcs): for dataflow, pred in zip(dataflows, model_funcs):
......
...@@ -37,7 +37,7 @@ def fbresnet_augmentor(isTrain): ...@@ -37,7 +37,7 @@ def fbresnet_augmentor(isTrain):
# Removing lighting leads to a tiny drop in accuracy. # Removing lighting leads to a tiny drop in accuracy.
imgaug.RandomOrderAug( imgaug.RandomOrderAug(
[imgaug.BrightnessScale((0.6, 1.4), clip=False), [imgaug.BrightnessScale((0.6, 1.4), clip=False),
imgaug.Contrast((0.6, 1.4), clip=False), imgaug.Contrast((0.6, 1.4), rgb=False, clip=False),
imgaug.Saturation(0.4, rgb=False), imgaug.Saturation(0.4, rgb=False),
# rgb-bgr conversion for the constants copied from fb.resnet.torch # rgb-bgr conversion for the constants copied from fb.resnet.torch
imgaug.Lighting(0.1, imgaug.Lighting(0.1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment