diff --git a/CHANGELOG.md b/CHANGELOG.md index a751b7c8..0b4ef95f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed multiple errors which arises when polygon is of length 5 or less () - Fixed task creation from PDF () - Fixed CVAT format import for frame stepped tasks () +- Fixed unnecessary pyhash dependency () ### Security - diff --git a/cvat/apps/dataset_manager/formats/utils.py b/cvat/apps/dataset_manager/formats/utils.py index 2e30ab79..184a1331 100644 --- a/cvat/apps/dataset_manager/formats/utils.py +++ b/cvat/apps/dataset_manager/formats/utils.py @@ -3,11 +3,10 @@ # SPDX-License-Identifier: MIT import os.path as osp -from pyhash import murmur3_32 +from hashlib import blake2s from datumaro.cli.util import make_file_name -hasher = murmur3_32() def get_color_from_index(index): def get_bit(number, index): @@ -69,7 +68,8 @@ def get_label_color(label_name, label_names): normalized_name = normalize_label(label_name) color = predefined.get(normalized_name, None) - offset = hasher(normalized_name) + normalized_names.count(normalized_name) + name_hash = int.from_bytes(blake2s(normalized_name.encode(), digest_size=4).digest(), byteorder="big") + offset = name_hash + normalized_names.count(normalized_name) if color is None: color = get_color_from_index(DEFAULT_COLORMAP_CAPACITY + offset) diff --git a/cvat/requirements/base.txt b/cvat/requirements/base.txt index 09fa5fe8..ff8111ca 100644 --- a/cvat/requirements/base.txt +++ b/cvat/requirements/base.txt @@ -10,7 +10,6 @@ Pillow==7.2.0 numpy==1.18.5 python-ldap==3.3.1 pytz==2020.1 -pyhash==0.9.3 pyunpack==0.2.1 rcssmin==1.0.6 redis==3.5.3