chaiNNer icon indicating copy to clipboard operation
chaiNNer copied to clipboard

Linear color space (16bit, from 0.0... to 1.0...)

Open 0x4E69676874466F78 opened this issue 3 years ago • 6 comments
trafficstars

Is it possible to process in a 16bit linear color space?

0x4E69676874466F78 avatar Aug 24 '22 11:08 0x4E69676874466F78

And saving in 16bit format (e.g PNG supports 16bit).

0x4E69676874466F78 avatar Aug 24 '22 11:08 0x4E69676874466F78

Currently, no. While we do store images as float32 numbers, numerous operations convert to uint8. So we could add support for saving an image as 16bit, but it wouldn't achieve much.

However, I think that we should support this. Last time I brought this up, I believe that the consensus was that it's a niche use case that isn't a priority.

I also want to point out that many upscaling architectures use uint8 in their APIs, so there is nothing we can do about that.

RunDevelopment avatar Aug 24 '22 12:08 RunDevelopment

@RunDevelopment okay. It's just that I'm thinking of trying to create my own model and I think that it's better to work in linear space, and it's better to save normal maps in 16bit.

0x4E69676874466F78 avatar Aug 24 '22 12:08 0x4E69676874466F78

Also there is another case of "LDR to HDR" models.

0x4E69676874466F78 avatar Aug 24 '22 12:08 0x4E69676874466F78

@RunDevelopment

I also want to point out that many upscaling architectures use uint8 in their APIs, so there is nothing we can do about that.

Do you know which ones support floating point?

0x4E69676874466F78 avatar Aug 25 '22 15:08 0x4E69676874466F78

Do you know which ones support floating point?

All the ones we support in PyTorch use floating point I think. But yeah, many of the nodes in chaiNNer force us to convert to uint8 (thanks to opencv), so this isn't realistic unless we replace those with different functions. Also, saving at different bit depths will theoretically be possible once we add encoding settings to the image save node.

joeyballentine avatar Sep 05 '22 15:09 joeyballentine