comet-ml / issue-tracking

Questions, Help, and Issues for Comet ML
https://www.comet.ml
85 stars 7 forks source link

PIL image logging #531

Closed donthomasitos closed 7 months ago

donthomasitos commented 9 months ago

I use this to log an image to comet:

raw_image = Image.open(os.path.join(args.data_root_path, image_file))

comet_ml_tracker.log_image(raw_image, name="caption 123", step=global_step)

Which is pretty clearly a PIL image, but still i get: COMET ERROR: Could not convert image_data into an image; ignored

Any idea why?

donthomasitos commented 9 months ago

When i convert to a numpy array instead, i get COMET ERROR: File upload failed: ValueError('Uploading file failed (400) with max retries: 4 on url \'https://www.comet.com/clientlib/visualizations/upload\': b\'{"msg":"File name exceed the max allowed length (> 100)","code":400,"data":null,"sdk_error_code":0}\''), file: /tmp/tmpl2q1_j4p/tmpci_m0s5b, url: 'https://www.comet.com/clientlib/visualizations/upload', max retries: 4

gidim commented 9 months ago

Is there something unique about your image? Your code sample works for me. Please see here runnable example https://colab.research.google.com/drive/1-4FZDrUO8VT301O3F9MaeepK8sIwnq1j

And what it looks like on Comet: https://www.comet.com/gideon-comet/pil-test/aaae87b16e4c4874bef3baf7e5432536?experiment-tab=images

donthomasitos commented 9 months ago

I generate this PIL image by opening a JPG file directly. These are the vars()of the image: {'im': None, 'mode': 'RGB', '_size': (1024, 576), 'palette': None, 'info': {'jfif': 257, 'jfif_version': (1, 1), 'jfif_unit': 0, 'jfif_density': (1, 1)}, 'readonly': 1, 'pyaccess': None, '_exif': None, '_min_frame': 0, 'custom_mimetype': None, 'tile': [('jpeg', (0, 0, 1024, 576), 0, ('RGB', ''))], 'decoderconfig': (), 'decodermaxblock': 65536, 'fp': <_io.BufferedReader name='1430.jpg'>, 'filename': '1430.jpg', '_exclusive_fp': True, 'bits': 8, 'layers': 3, 'layer': [(1, 2, 2, 0), (2, 1, 1, 1), (3, 1, 1, 1)], 'huffman_dc': {}, 'huffman_ac': {}, 'quantization': {0: [2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6, 1, 1, 2, 2, 4, 6, 7, 6, 1, 2, 2, 3, 5, 9, 8, 6, 2, 2, 4, 6, 7, 11, 10, 8, 2, 4, 6, 6, 8, 10, 11, 9, 5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10], 1: [2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10, 2, 3, 6, 10, 10, 10, 10, 10, 5, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]}, 'app': {'APP0': b'JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00'}, 'applist': [('APP0', b'JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00')], 'icclist': []}

dsblank commented 9 months ago

@donthomasitos I don't see anything wrong with your code. Trying to replicate. Is it possible for you to send me the 1430.jpg image? I'm doug@comet.com

dsblank commented 9 months ago

Nevermind... I can create it with:

image = PIL.Image.new('RGB', (1024, 576))

Still looking...

dsblank commented 9 months ago

@donthomasitos Can you send me a Comet debug log file as described in this section:

https://www.comet.com/docs/v2/api-and-sdk/python-sdk/warnings-errors/#debugging

If so, you can send that to doug@comet.com

That log file should contain the traceback of the error.

donthomasitos commented 9 months ago

I'm trying but can't reach the URL so far: image

gidim commented 9 months ago

Sorry about that-here's the correct url: https://www.comet.com/docs/v2/api-and-sdk/python-sdk/warnings-errors/#debugging

dsblank commented 9 months ago

Opps... sorry about the wrong link.

dsblank commented 9 months ago

When you enter comet --version at the command line, what do you get back?

What OS are you on?

donthomasitos commented 9 months ago

My ubuntu version is 20.04.6 LTS. I tried the pip version 3.35.5 and 3.35.0. I will share debug traces and the image soon, the machine is just occupied with a run.

dsblank commented 8 months ago

Let us know if you have any more information.

dsblank commented 7 months ago

Let us know if you have any more information, otherwise we'll close this issue. Thanks!