From 3201bc6a06f244d414fe90c11d4c827f58502a87 Mon Sep 17 00:00:00 2001 From: syyxsxx Date: Sat, 29 Aug 2020 19:54:22 +0800 Subject: [PATCH] add python mkl supported --- paddlex/deploy.py | 10 ++++++---- requirements.txt | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/paddlex/deploy.py b/paddlex/deploy.py index ced22ae..b8b00b4 100644 --- a/paddlex/deploy.py +++ b/paddlex/deploy.py @@ -13,6 +13,7 @@ # limitations under the License. import os import os.path as osp +import psutil import cv2 import numpy as np import yaml @@ -30,7 +31,7 @@ class Predictor: use_gpu=True, gpu_id=0, use_mkl=False, - mkl_thread_num=4, + mkl_thread_num=psutil.cpu_count(), use_trt=False, use_glog=False, memory_optimize=True): @@ -84,7 +85,7 @@ class Predictor: use_gpu=True, gpu_id=0, use_mkl=False, - mkl_thread_num=4, + mkl_thread_num=psutil.cpu_count(), use_trt=False, use_glog=False, memory_optimize=True): @@ -98,8 +99,9 @@ class Predictor: else: config.disable_gpu() if use_mkl: - config.enable_mkldnn() - config.set_cpu_math_library_num_threads(mkl_thread_num) + if self.model_name not in ["HRNet", "DeepLabv3p"]: + config.enable_mkldnn() + config.set_cpu_math_library_num_threads(mkl_thread_num) if use_glog: config.enable_glog_info() else: diff --git a/requirements.txt b/requirements.txt index 2e290c1..83ae57b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ tqdm colorama sklearn cython +psutil pycocotools visualdl >= 2.0.0b paddleslim == 1.0.1 -- GitLab