Refactor NUM_THREADS (#5954)
This commit is contained in:
1 parent
2c6317547a
commit
8f875d93a2
2 files changed
+7
-7
No files matched your search
+5
-4
@@ -33,14 +33,15 @@ from utils.downloads import gsutil_getsize
|
||||
from utils.metrics import box_iou, fitness
|
||||
|
||||
# Settings
|
||||
FILE = Path(__file__).resolve()
|
||||
ROOT = FILE.parents[1] # YOLOv5 root directory
|
||||
NUM_THREADS = min(8, max(1, os.cpu_count() - 1)) # number of YOLOv5 multiprocessing threads
|
||||
|
||||
torch.set_printoptions(linewidth=320, precision=5, profile='long')
|
||||
np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format}) # format short g, %precision=5
|
||||
pd.options.display.max_columns = 10
|
||||
cv2.setNumThreads(0) # prevent OpenCV from multithreading (incompatible with PyTorch DataLoader)
|
||||
os.environ['NUMEXPR_MAX_THREADS'] = str(min(os.cpu_count(), 8)) # NumExpr max threads
|
||||
|
||||
FILE = Path(__file__).resolve()
|
||||
ROOT = FILE.parents[1] # YOLOv5 root directory
|
||||
os.environ['NUMEXPR_MAX_THREADS'] = str(NUM_THREADS) # NumExpr max threads
|
||||
|
||||
|
||||
def set_logging(name=None, verbose=True):
|
||||
|
||||
Reference in new issue
Block a user