open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.74k stars 9.48k forks source link

DINO训练与测试时评测时间差异巨大 #11312

Open Hongru0306 opened 11 months ago

Hongru0306 commented 11 months ago

我在使用mmdet训练DINO时,在训练过程中的验证部分时间很短,如下:

365436a92667be0fcb240f85f479311

但在使用tools/test.py进行评测时,推理时间巨大:
22332

想问下官方大大,是我使用过程中哪里出了问题吗?
训练config如下:


# Inherit and overwrite part of the config based on this config
_base_ = '/mmdetection/configs/dino/dino-4scale_r50_8xb2-36e_coco.py'

data_root = 'path' # dataset root

train_batch_size_per_gpu = 2
train_num_workers = 2

max_epochs = 36
auto_scale_lr = dict(base_batch_size=16, enable=True)

metainfo = {
    'classes': (etc...),
    'palette': [
        etc...,
    ]
}

train_dataloader = dict(
    batch_size=train_batch_size_per_gpu,
    num_workers=train_num_workers,
    dataset=dict(
        data_root=data_root,
        metainfo=metainfo,
        data_prefix=dict(img='images/'),
        ann_file='annotations/train.json'))

val_dataloader = dict(
    dataset=dict(
        data_root=data_root,
        metainfo=metainfo,
        data_prefix=dict(img='images/'),
        ann_file='annotations/val.json'))

test_dataloader = dict(
    dataset=dict(
        data_root=data_root,
        metainfo=metainfo,
        data_prefix=dict(img='images/'),
        ann_file='annotations/test.json'))

val_evaluator = dict(ann_file=data_root + 'annotations/val.json')

test_evaluator = dict(ann_file=data_root + 'annotations/test.json')

model = dict(bbox_head=dict(num_classes=15))

default_hooks = dict(
    timer=dict(type="IterTimerHook"),
    logger=dict(type="LoggerHook", interval=200),
    param_scheduler=dict(type="ParamSchedulerHook"),
    checkpoint=dict(
        type="CheckpointHook", interval=4, max_keep_ckpts=2, save_best="auto"
    ),
)

train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=max_epochs, val_interval=2)
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'),dict(type='TensorboardVisBackend')])
hhaAndroid commented 11 months ago

从你的图上面来看,我没有发现哪里来的时间差异巨大?

Hongru0306 commented 11 months ago

从你的图上面来看,我没有发现哪里来的时间差异巨大?

十分抱歉佬,我上传错了图片,正确的test脚本运行时间如下:
22332

在训练阶段1分钟就可以验证完,但是单独运行test脚本则需要1个小时。

Quanhui2022 commented 8 months ago

我也曾遇到过,最后发现是修改了配置文件的参数导致的,修改回去就没事了。