huzi96 / Coarse2Fine-PyTorch

70 stars 6 forks source link

Symbol out of range #9

Open balabengba opened 2 years ago

balabengba commented 2 years ago

During the compressing stage, module_arithmeticcoding report an error:Symbol out of range. Have you encountered this problem? thanks

huzi96 commented 2 years ago

This might indicate that an element in the to-be-encoded tensor (like z2_rounded) is out of the predefined range [-511, 511]. Please check the values of elements in such tensors. Are you testing with the pre-trained weights with natural images?

balabengba commented 2 years ago

No, I train the model with my own dataset. Why does this phenomenon still occur after input data normalization?

huzi96 commented 2 years ago

This error occurs when an element in the to-be-encoded tensor falls out of the predefined value range. It may have little to do with input normalization. This can happen when a not-well-trained model takes an "outlier" input, so the model fails to constrain the value range of the to-be-encoded tensor in the middle. You may need to check whether or not the model you trained behaves well enough and whether the input image is an "expected" sample for your training data.

balabengba commented 2 years ago

I get it now, thanks!

MagicS0ng commented 1 year ago

@huzi96 , I encountered low or high out of range instead of symbol out of range. I tried to get the value of low and high to check the if expression in if ( (low >= high) || ((low & MASK) != low) || ((high & MASK) != high) ) and I got some as below: image value of if expression is false, and that is what bothers me. Does low or high out of range share same cause with symbol out of range? Thanks in advance~ By the way, I modified the architecture of part of the neural network.

huzi96 commented 1 year ago

I am not 100% sure but you can try to debug by looking into the actual value of sigma, mu, and the actual symbol to code. Do these values look normal? Is the sigma very small while the symbol value is far from mu?

MagicS0ng commented 1 year ago

Appreciate your help. I will try.