pytorch / ignite

High-level library to help with training and evaluating neural networks in PyTorch flexibly and transparently.
https://pytorch-ignite.ai
BSD 3-Clause "New" or "Revised" License
4.55k stars 620 forks source link

Warning using ConfusionMatrix and setup_tb_logging #829

Open sdesrozis opened 4 years ago

sdesrozis commented 4 years ago

❓ Questions/Help/Support

logger configured by setup_tb_logging warns when a ConfusionMatrix metric is attached to the evaluator

tensorboard_logger.py:129: UserWarning: TensorboardLogger output_handler can not log metrics value type <class 'torch.Tensor'>
  "TensorboardLogger output_handler can not log " "metrics value type {}".format(type(value))

The reason is setup_tb_logging (via setup_any_logging) defines OutputHandler using metric_names="all" https://github.com/pytorch/ignite/blob/a22a0f5e909ac70d2a1f76a60b6e84b2134f196c/ignite/contrib/engines/common.py#L248-L254

What do you think to expose metric_names in the API to be able to fix the warning ?

sdesrozis commented 4 years ago

Should we do that ?

@vfdev-5 ?

vfdev-5 commented 4 years ago

@sdesrozis confusion matrix is a 2D tensor, I wonder if we can not log it to TB in a certain way: heatmap, something else ... I also agree that exposing metric_names makes sense too.