-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PaddlePaddle Hackathon] Task 66 #4317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要增加multiscale-test的使用文档
@@ -97,7 +97,11 @@ def update(self, inputs, outputs): | |||
for k, v in outputs.items(): | |||
outs[k] = v.numpy() if isinstance(v, paddle.Tensor) else v | |||
|
|||
im_id = inputs['im_id'] | |||
# multi-scale inputs: all inputs have same im_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是否只支持batch size=1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,只支持batch size 1。因为我看到静态图的实现好像也是batch size 1,就和他一致了
static/ppdet/utils/post_process.py:207
def mstest_box_post_process(result, config, num_classes):
"""
Multi-scale Test
Only available for batch_size=1 now.
"""
post_bbox = {}
use_flip = False
|
||
def merge_multi_scale_predictions(self, outs): | ||
# default values for architectures not included in following list | ||
num_classes = 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里RCNN是否可以统一使用bbox_post_process中nms的参数
另外num_classe能否可以调整成输入参数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,新提交的代码已修改为统一使用bbox_post_process中nms的参数。
您说的num_classe调整成输入参数,是指从配置文件里面配置吗?如果是配置文件的话,现在的num_classes会使用配置文件中的BBoxHead.num_classes值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在是否仅支持rcnn系列模型做ms-test,是的话可以在这里给出提示信息
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的。最新的提交版本已添加了错误信息
需要增加multiscale-test的使用文档和限定条件 |
最新的版本添加了使用文档(位置在docs/tutorials/config_annotation/multi_scale_test_config.md),您看是否合适呢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,测试文件已添加(位于ppdet/modeling/tests/test_mstest.py) |
ppdet/modeling/tests/test_mstest.py
Outdated
cfg = load_config(self.mstest_cfg_file) | ||
trainer = Trainer(cfg, mode='test') | ||
|
||
if not os.path.exists(cfg.weights): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
权重使用https://paddledet.bj.bcebos.com/models/faster_rcnn_r34_fpn_1x_coco.pdparams
测试图片放在test文件夹中并使用相对路径
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,最新的提交版本已修改
|
||
`target_size: [700 , 900]` property is used to specify different scales. | ||
|
||
It can be plugged into evaluation process or test (inference) process, by adding `MultiscaleTestResize` entry to `EvalReader.sample_transforms` or `TestReader.sample_transforms` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
说明目前支持rcnn系列模型,并且batch_size要求为1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,最新的提交版本已修改
好的,测试文件已添加(位于ppdet/modeling/tests/test_mstest.py) |
@@ -58,15 +58,21 @@ def __call__(self, samples, context=None): | |||
""" | |||
coarsest_stride = self.pad_to_stride | |||
|
|||
max_shape = np.array([data['image'].shape for data in samples]).max( | |||
# multi scale input is nested list | |||
if type(samples) in (list, tuple) and type(samples[0]) in (list, tuple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isinstance(samples, typing.Sequence) and len(samples) > 0 and isinstance(samples[0], typing.Sequence)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,最新的提交版本已修改
ppdet/engine/trainer.py
Outdated
@@ -428,7 +428,11 @@ def _eval_with_loader(self, loader): | |||
for metric in self._metrics: | |||
metric.update(data, outs) | |||
|
|||
sample_num += data['im_id'].numpy().shape[0] | |||
# multi-scale inputs: all inputs have same im_id | |||
if type(data) in (list, tuple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,最新的提交版本已修改
ppdet/engine/trainer.py
Outdated
@@ -471,7 +475,10 @@ def predict(self, | |||
outs = self.model(data) | |||
|
|||
for key in ['im_shape', 'scale_factor', 'im_id']: | |||
outs[key] = data[key] | |||
if type(data) in (tuple, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,最新的提交版本已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,辛苦向develop分支也提交个pr吧
好的,已提交PR。提交PR时发生的冲突需要我去合并吗?如果需要的话,是只合并我的修改造成的冲突,还是都修改呢?(包括release/2.2分支和develop分支之间的冲突) |
建议把改动先手动加到develop分支上再提交pr,这个分支直接向develop分支提pr的话冲突会比较多 |
好的 |
from ppdet.core.workspace import register | ||
from static.ppdet.utils.post_process import nms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不能从static文件夹中导入 nms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,新提交的PR已修复 #4375
This reverts commit 47fc188.
PR types
New features
PR changes
APIs
Describe
你好,
该PR根据 #4225 添加了多尺度测试
使用方法
在配置文件中添加MultiscaleTestResize配置,具体使用方法可以参考新添加的配置文件:configs/faster_rcnn/faster_rcnn_r34_fpn_multiscaletest_1x_coco.yml
测试方法
评估
(该测试使用了backbone为resnet34的faster rcnn配置,需要修改上面的权重文件为正确位置)
预测
评估效果对比
根据上面的配置文件的配置(resnet34-faster-rcnn-fpn)在coco2017验证集上进行评估
多尺度
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.382
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.588
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.416
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.217
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.413
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.512
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.320
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.504
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.530
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.334
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.564
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.680
[10/15 13:50:21] ppdet.engine INFO: Total sample number: 4952, averge FPS: 5.121671015456265
单尺度
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.378
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.586
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.412
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.219
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.410
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.483
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.314
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.496
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.521
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.333
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.558
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.646
[10/15 14:07:58] ppdet.engine INFO: Total sample number: 4952, averge FPS: 15.107217863848637