Skip to content

Commit

Permalink
patch for newer numpy versions
Browse files Browse the repository at this point in the history
  • Loading branch information
yocabon committed Jan 19, 2024
1 parent 32eca31 commit 5185aa6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kapture/io/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

logger = kapture.logger

np.float = float # monkey patch

# file names conventions
CSV_FILENAMES = {
kapture.Sensors: path.join('sensors', 'sensors.txt'),
Expand Down Expand Up @@ -938,7 +940,7 @@ def keypoints_config_from_file(config_filepath: str) -> KeypointsConfig:
name, dtype, dsize = line[0], line[1], int(line[2])

# try to list all possible type from numpy that can be used in eval(dtype)
from numpy import float, float32, float64, int32, uint8 # noqa: F401
from numpy import float32, float64, int32, uint8 # noqa: F401
if isinstance(type(eval(dtype)), type):
dtype = eval(dtype)
else:
Expand Down Expand Up @@ -1015,7 +1017,7 @@ def descriptors_config_from_file(config_filepath: str) -> DescriptorsConfig:
name, dtype, dsize, keypoints_type, metric_type = line[0], line[1], int(line[2]), line[3], line[4]

# try to list all possible type from numpy that can be used in eval(dtype)
from numpy import float, float32, float64, int32, uint8 # noqa: F401
from numpy import float32, float64, int32, uint8 # noqa: F401
if isinstance(type(eval(dtype)), type):
dtype = eval(dtype)
else:
Expand Down Expand Up @@ -1099,7 +1101,7 @@ def global_features_config_from_file(config_filepath: str) -> GlobalFeaturesConf
name, dtype, dsize, metric_type = line[0], line[1], int(line[2]), line[3]

# try to list all possible type from numpy that can be used in eval(dtype)
from numpy import float, float32, float64, int32, uint8 # noqa: F401
from numpy import float32, float64, int32, uint8 # noqa: F401
if isinstance(type(eval(dtype)), type):
dtype = eval(dtype)
else:
Expand Down

0 comments on commit 5185aa6

Please sign in to comment.