-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -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. | |||
|
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
…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
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.