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

about the data bits depth and normalization #2

Closed
Jam-G opened this issue Feb 25, 2020 · 2 comments
Closed

about the data bits depth and normalization #2

Jam-G opened this issue Feb 25, 2020 · 2 comments
Labels
Dataset Zurich RAW-to-RGB dataset question Further information is requested

Comments

@Jam-G
Copy link

Jam-G commented Feb 25, 2020

As far as I am concerned, the huawei P20's raw image is 10bits dng files. but the data downloaded form the link http://people.ee.ethz.ch/~ihnatova/pynet.html#dataset are mixed with 8bits and 10bits png files. And the normalization code for training and testting in load_dataset.py at 21th line is shown below where the divisor is 4*255:

RAW_norm = RAW_combined.astype(np.float32) / (4 * 255)

Since there are part of data are 8bits depth, the divisor is too big for them.

And I tryed to used the pretrained model to test my own data captuered by huawei P20, the result is slightly overlighted.

So Is that a bug? or something far from my understand?

I try to fix this by replace the code in load_dataset.py at 21th line and re-train the model:

RAW_norm = RAW_combined.astype(np.float32) / (4 * 255)

by

if raw.dtype == np.uint16:
    # 10bits

   RAW_norm = RAW_combined.astype(np.float32) / (1023)

elif raw.dtype == np.uint8:

    # 8bits

    RAW_norm = RAW_combined.astype(np.float32) / (255)
Is that correct?
@aiff22
Copy link
Owner

aiff22 commented Feb 25, 2020

Hi @Jam-G,

All image crops were saved as 4-channel 10-bit png files, though some of the crops correspond to dark image areas and thus their values might lie between 0 and 255. Therefore, some libraries might show that they are just 8-bit images since the values are lying in the 8-bit interval.

@Jam-G
Copy link
Author

Jam-G commented Feb 26, 2020

@aiff22
Thanks for your reply!
I try to save a ndarray with shape 448x448 which values lies between 0 and 255 by imageio.imwrite, no matter the ndarray's dtype is uint8 or uint16 , both of the png file saved have 8bit depth.
Thanks again!

@Jam-G Jam-G closed this as completed Feb 26, 2020
@aiff22 aiff22 added question Further information is requested Dataset Zurich RAW-to-RGB dataset labels Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dataset Zurich RAW-to-RGB dataset question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants