Repository: ultralytics/ultralytics

Issue:
dvclive.error
### Search before asking

- [X] I have searched the YOLOv8 [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar bug report.


### YOLOv8 Component

Training

### Bug

Hello,
I have used several time the YOLOV8 without problem.
Today, I tried to retrain my model and I updated the ultralytics packages and when I started the training, i got this error:

      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/model.py", line 371, in train
        self.trainer.train()
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 192, in train
        self._do_train(world_size)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 275, in _do_train
        self._setup_train(world_size)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 268, in _setup_train
        self.run_callbacks('on_pretrain_routine_end')
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 165, in run_callbacks
        callback(self)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 76, in on_pretrain_routine_end
        _log_plots(trainer.plots, 'train')
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 40, in _log_plots
        _log_images(name, prefix)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 33, in _log_images
        live.log_image(os.path.join(prefix, image_path.name), image_path)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/dvclive/live.py", line 249, in log_image
        raise InvalidDataTypeError(name, type(val))
    dvclive.error.InvalidDataTypeError: Data 'train/labels.jpg' has not supported type <class 'pathlib.PosixPath'>

what do you think about it?

Thank you.

### Environment

ultralytics              8.0.114
torch                    2.0.1
torchaudio               0.13.1
torchvision              0.15.2
Ubuntu 22.04.1 LTS

### Minimal Reproducible Example

_No response_

### Additional

_No response_

### Are you willing to submit a PR?

- [ ] Yes I'd like to help by submitting a PR!


Discussion:

Resolving patch:
diff --git a/ultralytics/yolo/utils/callbacks/dvc.py b/ultralytics/yolo/utils/callbacks/dvc.py
--- a/ultralytics/yolo/utils/callbacks/dvc.py
+++ b/ultralytics/yolo/utils/callbacks/dvc.py
@@ -1,6 +1,8 @@
 # Ultralytics YOLO 🚀, GPL-3.0 license
 import os
 
+import pkg_resources as pkg
+
 from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
 from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
 
@@ -10,8 +12,12 @@
     import dvclive
 
     assert not TESTS_RUNNING  # do not log pytest
-    assert version('dvclive')
-except (ImportError, AssertionError):
+
+    ver = version('dvclive')
+    if pkg.parse_version(ver) < pkg.parse_version('2.11.0'):
+        LOGGER.debug(f'DVCLive is detected but version {ver} is incompatible (>=2.11 required).')
+        dvclive = None  # noqa: F811
+except (ImportError, AssertionError, TypeError):
     dvclive = None
 
 # DVCLive logger instance


Test patch: