From a1abc3921ca1a47ab0a2bf4a9b81a86b4bf173e6 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Wed, 25 Mar 2020 13:42:53 +0300 Subject: [PATCH] renamed method --- cvat/apps/engine/media_extractors.py | 8 ++++---- cvat/apps/engine/task.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cvat/apps/engine/media_extractors.py b/cvat/apps/engine/media_extractors.py index 6e30ea9119d2..a775365d15e1 100644 --- a/cvat/apps/engine/media_extractors.py +++ b/cvat/apps/engine/media_extractors.py @@ -66,7 +66,7 @@ def image_names(self): pass @abstractmethod - def get_avg_image_size(self): + def get_image_size(self): pass #Note step, start, stop have no affect @@ -97,7 +97,7 @@ def save_preview(self, preview_path): def image_names(self): return self._source_path - def get_avg_image_size(self): + def get_image_size(self): img = Image.open(self._source_path[0]) return img.width, img.height @@ -191,7 +191,7 @@ def save_preview(self, preview_path): with open(preview_path, 'wb') as f: f.write(self._zip_source.read(self._source_path[0])) - def get_avg_image_size(self): + def get_image_size(self): img = Image.open(BytesIO(self._zip_source.read(self._source_path[0]))) return img.width, img.height @@ -246,7 +246,7 @@ def save_preview(self, preview_path): def image_names(self): return self._source_path - def get_avg_image_size(self): + def get_image_size(self): image = (next(iter(self)))[0] return image.width, image.height diff --git a/cvat/apps/engine/task.py b/cvat/apps/engine/task.py index 18a184d56063..99adf4097a64 100644 --- a/cvat/apps/engine/task.py +++ b/cvat/apps/engine/task.py @@ -256,15 +256,15 @@ def update_progress(progress): # calculate chunk size if it isn't specified if db_data.chunk_size is None: if isinstance(compressed_chunk_writer, ZipCompressedChunkWriter): - avg_w, avg_h = extractor.get_avg_image_size() - avg_area = avg_h * avg_w - if avg_area <= 1920 * 1080: + w, h = extractor.get_image_size() + area = h * w + if area <= 1920 * 1080: db_data.chunk_size = 36 - elif avg_area <= 2560 * 1440: + elif area <= 2560 * 1440: db_data.chunk_size = 18 - elif avg_area <= 3840 * 2160: + elif area <= 3840 * 2160: db_data.chunk_size = 9 - elif avg_area <= 5120 * 2880: + elif area <= 5120 * 2880: db_data.chunk_size = 4 else: db_data.chunk_size = 2