Skip to content

Commit

Permalink
renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Zhavoronkov committed Mar 25, 2020
1 parent 09f9f1e commit a1abc39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cvat/apps/engine/media_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions cvat/apps/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a1abc39

Please sign in to comment.