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

Modify the inference interface to adapt to standalone and distributed… #96

Merged
merged 1 commit into from
Mar 25, 2023

Conversation

wang-hua-2019
Copy link
Collaborator

@wang-hua-2019 wang-hua-2019 commented Mar 23, 2023

… inference

Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:

Motivation

(Write your motivation for proposed changes here.)

Test Plan

(How should this PR be tested? Do you require special setup to run the test or repro the fixed bug?)

Related Issues and PRs

(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)

is_train=False)
cfg.eval.dataset,
cfg.eval.loader,
num_shards=device_num,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

若改成distributed eval,需要对多卡的评估结果做聚合,需注意的是 f1-score, acc等评估指标仅做多卡平均并不能得到正确的结果,需要对预测结果或评估指标做分布式的更新。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改聚合方法

epoch_time = time.time() - self.epoch_start_time
per_step_time = epoch_time * 1000 / cb_params.batch_num
fps = 1000 * self.batch_size / per_step_time
msg = 'epoch: [%s/%s] loss: %.6f, epoch time: %.3f s, per step time: %.3f ms, fps: %.2f' % (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个loss只反映最后一个batch的平均loss,不是整个training data的平均loss,建议复用EvalSaveCallback中的training loss的计算结果,将epoch training loss的在EvalSaveCall的on_train_epoch_end中打印。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个losscallback我这边不涉及修改,后面是不是统一修改一下

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

Successfully merging this pull request may close these issues.

3 participants