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

[Feature] Support different filename templates in GenerateSegmentIndices #325

Merged
merged 7 commits into from
May 24, 2021

Conversation

ckkelvinchan
Copy link
Member

Motivation

As mentioned in issue #323, there will be errors if the file names are not formated as {v:08d}.png. This may cause problems if one use custom filename format.

Modification

In this PR, we modify GenerateSegmentIndices so that one can use different filename formats. But note that the frame indices must start from 0.

@codecov
Copy link

codecov bot commented May 24, 2021

Codecov Report

Merging #325 (ac8768b) into master (b5c745d) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #325      +/-   ##
==========================================
+ Coverage   80.84%   80.92%   +0.07%     
==========================================
  Files         166      168       +2     
  Lines        8359     8409      +50     
  Branches     1205     1216      +11     
==========================================
+ Hits         6758     6805      +47     
- Misses       1453     1454       +1     
- Partials      148      150       +2     
Flag Coverage Δ
unittests 80.92% <100.00%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
mmedit/apis/restoration_video_inference.py 21.42% <100.00%> (ø)
mmedit/datasets/pipelines/augmentation.py 97.05% <100.00%> (+<0.01%) ⬆️
mmedit/models/__init__.py 100.00% <0.00%> (ø)
mmedit/models/extractors/lte.py 93.47% <0.00%> (ø)
mmedit/models/extractors/__init__.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5c745d...ac8768b. Read the comment docs.

@@ -27,15 +27,18 @@ def restoration_video_inference(model, img_dir, window_size):
window_size (int): The window size used in sliding-window framework.
This value should be set according to the settings of the network.
A value smaller than 0 means using recurrent framework.

Copy link
Contributor

Choose a reason for hiding this comment

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

and here, of course

@@ -964,11 +966,13 @@ def __call__(self, results):
lq_path_root = results['lq_path']
gt_path_root = results['gt_path']
lq_path = [
osp.join(lq_path_root, clip_name, f'{v:08d}.png')
osp.join(lq_path_root, clip_name,
f'{self.filename_tmpl.format(v)}.png')
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: should .png be part of the template?

Copy link
Member Author

Choose a reason for hiding this comment

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

We usually use .png, but I think that could work if someone wants to use jpg as inputs. I will modify that.

osp.join(lq_path_root, clip_name, f'{v:08d}.png')
for v in neighbor_list
osp.join(lq_path_root, clip_name,
f'{self.filename_tmpl.format(v)}') for v in neighbor_list
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, the f-str is redundant

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh you are right. I missed that.

@innerlee innerlee merged commit e6406c1 into open-mmlab:master May 24, 2021
@ckkelvinchan ckkelvinchan deleted the demo branch May 24, 2021 12:55
Yshuo-Li pushed a commit to Yshuo-Li/mmediting that referenced this pull request Jul 15, 2022
…ces (open-mmlab#325)

* Add message.

* Use os.path.isfile

* Support different filename template in GenerateSegmentIndices

* Add space line

* Move .png into the filename_tmpl

* Remove f-string
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.

None yet

2 participants