0

I am parsing thousands of images with Python/Tensorflow/Keras.

The output of my program is "polluted" by constant warnings about images that actually seem to load correctly:

Invalid SOS parameters for sequential JPEG

W tensorflow/core/lib/png/png_io.cc:87] PNG warning: gAMA: gamma value out of range

W tensorflow/core/lib/png/png_io.cc:87] PNG warning: iCCP: known incorrect sRGB profile

How to disable these warnings?

For instance in PHP ini_set ('gd.jpeg_ignore_warning', 1); seems to be the solution to the first one.

A solution that lets other information and other warnings get displayed would be welcome :-)

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373

1 Answers1

1

I don't know if it works for PNG warnings but there is an environment variable that you can set called TF_CPP_MIN_LOG_LEVEL see:

https://github.com/tensorflow/tensorflow/issues/7652

and

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/default/logging.cc#L119

for more details.

LHulk
  • 11
  • 1
  • I added `os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"` and `tf.logging.set_verbosity(tf.logging.ERROR)`, that has made the PNG warnings disappear. The JPEG lines still show up, though, actually they are not log lines, they are outputted to the UNIX error output, so `2>/dev/null` can be a radical solution against them. Still, a less radical solution (that lets other information go through) would be welcome :-) – Nicolas Raoul Sep 26 '18 at 07:54
  • Sounds like the error comes from libjpeg directly and you can't suppress them apart from maybe compiling libjpeg yourself but maybe someone else has an idea. – LHulk Sep 26 '18 at 13:56