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

Fix some browse dataset script bugs and draw textdet gt instance with ignore flags #1701

Merged

Conversation

KevinNuNu
Copy link
Contributor

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

1.textdet可视化gt_instance 增加根据ignore属性情况来可视化的功能
2.明确recog_lmdb_dataset在准备数据时属性值含义,将img_key内容赋给results['img_path']会导致后续的一些奇怪的报错
3.LoadImageFromNDArray函数不再强制赋值results['img_path']=None,同2会导致后续一些奇怪的报错
4.修复make_grid函数pipeline模式下显示ori_shapes数值错误的bug
5.删除InspectCompose 记录原始数据部分,修复后续找不到'data_sample'关键字的bug
6.修复auto+original模式下默认只使用LoadImageFromFile的图片读取方式的bug,优化为优先选用自定义图片读取方式
7.修复可视化test数据集时,由于test_pipeline的LoadOCRAnnotation位于倒数第二步gt_instance都为原图尺度,导致在缩放后的图像上画上了原图尺度的标注的bug
8.修复textrecog读取灰度图片时产生的bug

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

@codecov
Copy link

codecov bot commented Feb 1, 2023

Codecov Report

Base: 88.30% // Head: 88.24% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (aae17ab) compared to base (332089c).
Patch coverage: 42.85% of modified lines in pull request are covered.

❗ Current head aae17ab differs from pull request most recent head 38b5350. Consider uploading reports for the commit 38b5350 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #1701      +/-   ##
===========================================
- Coverage    88.30%   88.24%   -0.07%     
===========================================
  Files          175      175              
  Lines        10904    10913       +9     
  Branches      1529     1531       +2     
===========================================
+ Hits          9629     9630       +1     
- Misses         993      999       +6     
- Partials       282      284       +2     
Flag Coverage Δ
unittests 88.24% <42.85%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmocr/visualization/textdet_visualizer.py 84.74% <30.00%> (-11.26%) ⬇️
mmocr/datasets/transforms/loading.py 96.29% <50.00%> (-0.60%) ⬇️
mmocr/datasets/recog_lmdb_dataset.py 82.00% <100.00%> (ø)
mmocr/models/textrecog/decoders/aster_decoder.py 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@KevinNuNu KevinNuNu requested a review from Harold-lkk February 6, 2023 15:04
@Harold-lkk
Copy link
Collaborator

what is the problem when img_path is set in recog_lmdb_dataset?

@KevinNuNu
Copy link
Contributor Author

what is the problem when img_path is set in recog_lmdb_dataset?

Recog_lmdb_dataset里现在img_path这个属性实际赋的值时img_key,后续在调用results['img_path']的时候拿到的实际是img_key( like ‘image-0000001’),例如这里就会报错,拿到的image-000001不是原文件的真实文件名。

if hasattr(datasample, 'img_path'):
filename = osp.basename(datasample.img_path)
else:
# some dataset have not image path
filename = f'{i}.jpg'
out_file = osp.join(args.output_dir,
filename) if args.output_dir is not None else None
if out_file is not None:
mmcv.imwrite(image[..., ::-1], out_file)

@gaotongxiao gaotongxiao merged commit 37c5d37 into open-mmlab:dev-1.x Feb 17, 2023
@KevinNuNu KevinNuNu deleted the fix_browse_dataset_script_bugs branch February 17, 2023 15:11
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.

4 participants