Skip to content
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

VOC dataset can't eval the model ? #33

Closed
TaroPlay opened this issue Aug 9, 2023 · 5 comments
Closed

VOC dataset can't eval the model ? #33

TaroPlay opened this issue Aug 9, 2023 · 5 comments

Comments

@TaroPlay
Copy link

TaroPlay commented Aug 9, 2023

作者您好,我使用了VOC格式的数据集进行实验,训练时输入的命令是:python tools/train.py -c configs/rtdetr/ppfall_r50vd_voc.yml --eval ,结果在验证集时发生了报错:trainer object has no attribute '_eval_loader' ,我发现问题是发生在trainer.py中,所以把他的409·439行注释掉了,避免了报错。 但是我其实需要eval验证的结果,请问有什么办法解决吗?难道是我的yml文件设置有误?数据集是ppfall,来自飞浆的官方数据库。
trainer.py:如下

            # if validate and is_snapshot:
            #     if not hasattr(self, '_eval_loader'):
            #         # build evaluation dataset and loader
            #         self._eval_dataset = self.cfg.EvalDataset
            #         self._eval_batch_sampler = \
            #             paddle.io.BatchSampler(
            #                 self._eval_dataset,
            #                 batch_size=self.cfg.EvalReader['batch_size'])
            #         # If metric is VOC, need to be set collate_batch=False.
            #         if self.cfg.metric == 'VOC':
            #             self.cfg['EvalReader']['collate_batch'] = False
            #         else:
            #             self._eval_loader = create('EvalReader')(
            #                 self._eval_dataset,
            #                 self.cfg.worker_num,
            #                 batch_sampler=self._eval_batch_sampler)
            #     # if validation in training is enabled, metrics should be re-init
            #     # Init_mark makes sure this code will only execute once
            #     if validate and Init_mark == False:
            #         Init_mark = True
            #         self._init_metrics(validate=validate)
            #         self._reset_metrics()

            #     with paddle.no_grad():
            #         self.status['save_best_model'] = True
            #         self._eval_with_loader(self._eval_loader)

            # if is_snapshot and self.use_ema:
            #     # reset original weight
            #     self.model.set_dict(weight)
            #     self.status.pop('weight')

感谢您的回复!

@lyuwenyu
Copy link
Owner

你用的是这个项目还是paddledet那个?

@TaroPlay
Copy link
Author

你用的是这个项目还是paddledet那个?

用的是当前仓库下的项目,pddet里面的核心代码,是用的是rt-detr paddle版本呢。就是想知道如何获取验证集结果而且不会报错,如果是源代码会发生报错:trainer object has no attribute '_eval_loader'

@lyuwenyu
Copy link
Owner

lyuwenyu commented Aug 10, 2023

我没跑过voc的数据,做实验的时候为了方便这里面一些没用到的逻辑已经删掉了

  1. 你可以试一下paddledet里的rtdetr 和这个基本是同步的 参数加载已经训练好的就行 直接去eval
  2. 把voc的数据格式转成coco的格式

@TaroPlay
Copy link
Author

好的,那我试试换成coco格式把,如果没有验证这一步骤,我无法保证保存的权重是best.pdparams,只能是modelfinal.pdparams。担心最佳结果在72次之前就已经达到了,但是没有捕捉下来。

@todesti2
Copy link

好的,那我试试换成coco格式把,如果没有验证这一步骤,我无法保证保存的权重是best.pdparams,只能是modelfinal.pdparams。担心最佳结果在72次之前就已经达到了,但是没有捕捉下来。

你好,请问你是如何给数据集转换成COCO格式的呢,我在网上找了很多种方法都转化不成功,但是用VOC格式又会报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants