Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
目标
修改代码以提升PaddleCV套件一致性,同时适配X项目。修改后,套件应满足如下一致性要求:
best_model
子目录中,文件命名为model.pdparams
。与之相配套的优化器参数(如果存储的话)文件命名为model.pdopt
,也存储在该目录中。requirements.txt
文件,指定使用套件基础功能需要的依赖。在套件根目录可通过pip install .
或pip install -e .
方式(至少其中一种)安装套件核心库。inference.pdiparams
:保存权重参数。inference.pdiparams.info
:保存与参数有关的额外信息。inference.pdmodel
:保存模型结构描述信息。inference.yml
:预处理配置文件。代码变动
tools/infer_det.py
中raw_det_res
对『零目标框』情形的处理逻辑,在该情形下仍然存储图像(存的是原图),从而使用户在各种情况下均能获得输出图像,而无需关注目标框数量。ppocr.data
时自动设置,但这种做法有以下缺点:1) 用户在使用Python REPL或进行断点调试时经常需要输入Ctrl+C,而这将直接触发程序的终止,令用户感到疑惑和不便;2) 从调用关系的角度来看,作为callee,逻辑上来说应当尽可能减少对caller的影响,而目前的实现显然不满足这一点;3) 如果库在子进程中被调用,作为子进程,即使不考虑权限问题,只从资源回收的角度来看,试图通过SIGKILL
杀死包括父进程以及其它旁支进程在内的整个进程组内的成员仍是危险的行为。修改后,signal handlers只在当前进程为进程组leader、且用户通过脚本执行(排除了REPL的情况)的情况下被设置。此做法仍有优化空间,详见ppocr/data/__init__.py
中的注释。遗留问题
best_model
目录。因此,输出目录中将存在model.pdparams
和model.pdopt
的两份拷贝。后续需考虑渐进地改动旧的存储机制,使最优模型只保留一份。