Skip to content

log_image fails to log metadata when annotations=[] #563

@njacobs2019

Description

@njacobs2019

Describe the Bug

Experiment.log_image successfully logs an image but fails to log metadata. This happens when annotations are set to an empty list.

Expected behavior

I expected Comet to log the image and metadata or throw an error that the list is empty.

Where is the issue?

  • Comet Python SDK
  • Comet UI
  • Third Party Integrations (Huggingface, TensorboardX, Pytorch Lighting etc)

To Reproduce

Run this script

import os

import comet_ml
import numpy as np
from dotenv import load_dotenv

load_dotenv()


experiment = comet_ml.start(
    api_key=os.getenv("COMET_API_KEY"),
    project_name="TEST_PROJECT",
    mode="create",
    online=True,
    experiment_config=comet_ml.ExperimentConfig(
        auto_metric_logging=False,
    ),
)


img = np.random.rand(10,10)
annotations = []
metadata = {"key": "example value"}

experiment.log_image(
    name="TEST_IMAGE",
    image_data=img,
    annotations=annotations,
    metadata=metadata,
)

Screenshots or GIFs

Image

Additional context

Comet successfully logs metadata when annotations is set to None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions