From 783b34c40a2218f8438b7f833dca18902dca67c4 Mon Sep 17 00:00:00 2001 From: Double_V Date: Thu, 27 Feb 2020 13:39:26 +0800 Subject: [PATCH] do not print stack frame when train process killed (#4346) (#4352) * do not print stack frame when train process killed * add note about VOT does not support windows platform! --- PaddleCV/tracking/README.md | 4 +++- PaddleCV/tracking/ltr/data/loader.py | 17 ----------------- PaddleCV/tracking/ltr/trainers/ltr_trainer.py | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/PaddleCV/tracking/README.md b/PaddleCV/tracking/README.md index e27ecb11..aa326444 100644 --- a/PaddleCV/tracking/README.md +++ b/PaddleCV/tracking/README.md @@ -69,10 +69,12 @@ Datasets是数据集保存的路径。 ## 快速开始 tracking的工作环境: +- Linux - python3 - PaddlePaddle1.7 -> 注意:如果遇到cmath无法import的问题,建议切换Python版本,建议使用python3.6.8, python3.7.0 +> 注意:如果遇到cmath无法import的问题,建议切换Python版本,建议使用python3.6.8, python3.7.0 。另外, +> tracking暂不支持在window上运行,如果开发者有需求在window上运行tracking,请在issue中提出需求。 ### 安装依赖 diff --git a/PaddleCV/tracking/ltr/data/loader.py b/PaddleCV/tracking/ltr/data/loader.py index 0d7c8f11..2f6bd488 100644 --- a/PaddleCV/tracking/ltr/data/loader.py +++ b/PaddleCV/tracking/ltr/data/loader.py @@ -1,27 +1,10 @@ import os -import signal import sys import dataflow as df import numpy as np -# handle terminate reader process, do not print stack frame -def _reader_quit(signum, frame): - print("Reader process exit.") - sys.exit() - - -def _term_group(sig_num, frame): - print('pid {} terminated, terminate group ' - '{}...'.format(os.getpid(), os.getpgrp())) - os.killpg(os.getpgid(os.getpid()), signal.SIGKILL) - - -signal.signal(signal.SIGTERM, _reader_quit) -signal.signal(signal.SIGINT, _term_group) - - class LTRLoader(df.DataFlow): """ Data loader. Combines a dataset and a sampler, and provides diff --git a/PaddleCV/tracking/ltr/trainers/ltr_trainer.py b/PaddleCV/tracking/ltr/trainers/ltr_trainer.py index c8b03808..d928f7e9 100644 --- a/PaddleCV/tracking/ltr/trainers/ltr_trainer.py +++ b/PaddleCV/tracking/ltr/trainers/ltr_trainer.py @@ -10,6 +10,25 @@ import paddle.fluid.dygraph as dygraph import time import numpy as np +import sys +import signal + + +# handle terminate reader process, do not print stack frame +def _reader_quit(signum, frame): + print("Reader process exit.") + sys.exit() + + +def _term_group(sig_num, frame): + print('pid {} terminated, terminate group ' + '{}...'.format(os.getpid(), os.getpgrp())) + os.killpg(os.getpgid(os.getpid()), signal.SIGKILL) + + +signal.signal(signal.SIGTERM, _reader_quit) +signal.signal(signal.SIGINT, _term_group) + class LTRTrainer(BaseTrainer): def __init__(self, actor, loaders, optimizer, settings, lr_scheduler=None): -- GitLab