mirror of
https://github.com/clearml/clearml
synced 2025-03-03 10:42:00 +00:00
Fix Logger.report_image() throws warning
This commit is contained in:
parent
c9121debc2
commit
9966dd640c
@ -229,7 +229,7 @@ class UploadEvent(MetricsEventAdapter):
|
||||
self._key = None
|
||||
self._count = self._get_metric_count(metric, variant)
|
||||
if not file_history_size:
|
||||
file_history_size = self._file_history_size
|
||||
file_history_size = int(self._file_history_size)
|
||||
self._filename = kwargs.pop('override_filename', None)
|
||||
if not self._filename:
|
||||
if file_history_size < 1:
|
||||
@ -248,7 +248,7 @@ class UploadEvent(MetricsEventAdapter):
|
||||
# e.g.: image.png -> .png or image.raw.gz -> .raw.gz
|
||||
filename_ext = kwargs.pop('override_filename_ext', None)
|
||||
if filename_ext is None:
|
||||
filename_ext = self._format.lower() if self._image_data is not None else \
|
||||
filename_ext = str(self._format).lower() if self._image_data is not None else \
|
||||
'.' + '.'.join(pathlib2.Path(self._local_image_path).parts[-1].split('.')[1:])
|
||||
# always add file extension to the uploaded target file
|
||||
if filename_ext and filename_ext[0] != '.':
|
||||
@ -290,7 +290,7 @@ class UploadEvent(MetricsEventAdapter):
|
||||
local_file = None
|
||||
# don't provide file in case this event is out of the history window
|
||||
last_count = self._get_metric_count(self.metric, self.variant, next=False)
|
||||
if abs(self._count - last_count) > self._file_history_size:
|
||||
if abs(self._count - last_count) > int(self._file_history_size):
|
||||
output = None
|
||||
elif isinstance(self._image_data, (six.StringIO, six.BytesIO)):
|
||||
output = self._image_data
|
||||
@ -313,8 +313,8 @@ class UploadEvent(MetricsEventAdapter):
|
||||
# serialize image
|
||||
image = Image.fromarray(image_data)
|
||||
output = six.BytesIO()
|
||||
image_format = Image.registered_extensions().get(self._format.lower(), 'JPEG')
|
||||
image.save(output, format=image_format, quality=self._quality)
|
||||
image_format = Image.registered_extensions().get(str(self._format).lower(), 'JPEG')
|
||||
image.save(output, format=image_format, quality=int(self._quality))
|
||||
output.seek(0)
|
||||
else:
|
||||
# noinspection PyBroadException
|
||||
|
Loading…
Reference in New Issue
Block a user