Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed pyhash dependency #2170

Merged
merged 2 commits into from
Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<https://github.com/opencv/cvat/pull/2100>)
- Fixed task creation from PDF (<https://github.com/opencv/cvat/pull/2141>)
- Fixed CVAT format import for frame stepped tasks (<https://github.com/openvinotoolkit/cvat/pull/2151>)
- Fixed unnecessary pyhash dependency (<https://github.com/openvinotoolkit/cvat/pull/2170>)

### Security
-
Expand Down
6 changes: 3 additions & 3 deletions cvat/apps/dataset_manager/formats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion cvat/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down