-
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
Support Y-channel PSNR and SSIM #250
Conversation
mmedit/core/evaluation/metrics.py
Outdated
@@ -165,7 +165,7 @@ def reorder_image(img, input_order='HWC'): | |||
return img | |||
|
|||
|
|||
def psnr(img1, img2, crop_border=0, input_order='HWC'): | |||
def psnr(img1, img2, crop_border=0, input_order='HWC', color_space=None): |
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.
The name "color_space" needs a better design.
"Y" is not a color (standard) space
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.
How about convert_to
? This is what niqe
used.
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.
convert_to is not good either, think harder
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.
Okay, convert_to is ok
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.
Since we either keep the input as it is or turn it to y-channel. How about we use a boolean variable named to_y_channel
? Not sure if there is a need to support other color spaces in the future.
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.
Yes this should be extensible to other channels. Sometimes we want to compute on Hue or Lightness.
Either we do not support color conversion and extraction in this function and users need to convert them before call this function, or we leave a generic interface (no need to actually implement) so that any possible conversion is possible to implement.
Codecov Report
@@ Coverage Diff @@
## master #250 +/- ##
==========================================
+ Coverage 81.31% 81.36% +0.05%
==========================================
Files 156 158 +2
Lines 7503 7733 +230
Branches 1102 1145 +43
==========================================
+ Hits 6101 6292 +191
- Misses 1271 1297 +26
- Partials 131 144 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* Support Y-channel PSNR and SSIM * fix bug * update naming and unittest
Many existing SR methods compute PSNR and SSIM on Y-channel. However, MMEditing currently does not support this operation. This PR adds this operation by adding an argument
color_space
inpsnr
andssim
.