Skip to content

Commit

Permalink
fix: fixing the numpy dtype warnings > v1.19 (#117)
Browse files Browse the repository at this point in the history
* ci: fixing the numpy dtype warnings > v1.19

* ci: fixing the numpy dtype warnings > v1.19

* Merge branch 'master' into chore/wadim/np_warnings
  • Loading branch information
wadimkehl authored Aug 23, 2022
1 parent e3862db commit f377eb4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dgp/datasets/base_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def annotation_index(self):
total_annotations += list(self.autolabeled_scenes.keys())

scene_annotation_index = xr.DataArray(
np.zeros((len(self.data), len(total_annotations)), dtype=np.bool),
np.zeros((len(self.data), len(total_annotations)), dtype=bool),
dims=["datums", "annotations"],
coords={"annotations": total_annotations}
)
Expand Down
2 changes: 1 addition & 1 deletion dgp/datasets/frame_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from dgp.datasets import BaseDataset, DatasetMetadata

SUPPORTED_ANNOTATIONS_TABLE = xr.DataArray(
np.zeros((len(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE), len(ALL_ANNOTATION_TYPES)), dtype=np.bool),
np.zeros((len(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE), len(ALL_ANNOTATION_TYPES)), dtype=bool),
dims=["datum_types", "annotations"],
coords={
"datum_types": list(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE),
Expand Down
2 changes: 1 addition & 1 deletion dgp/utils/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def in_frustum(self, X, height, width):
Bool array for X which are inside frustum
"""
if not len(X):
return np.array([], dtype=np.bool)
return np.array([], dtype=bool)

corners = np.asarray([(0, 0), (width - 1, 0), (width - 1, height - 1), (0, height - 1)], dtype=np.float32)
rays = self.unproject(corners)
Expand Down
6 changes: 3 additions & 3 deletions dgp/utils/structures/instance_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class InstanceMask2D():
Parameters
----------
mask: np.ndarray[np.bool, np.uint8, np.int64]
mask: np.ndarray[bool, np.uint8, np.int64]
2D boolean array describiing instance mask.
class_id: int, default: GENERIC_OBJECT_CLASS
Expand All @@ -28,7 +28,7 @@ class InstanceMask2D():
defaults to empty dict.
"""
def __init__(self, mask, class_id=GENERIC_OBJECT_CLASS, instance_id=None, color=(0, 0, 0), attributes=None):
assert mask.dtype in (np.bool, np.uint8, np.int64)
assert mask.dtype in (bool, np.uint8, np.int64)
self._bitmask = mask

self._class_id = class_id
Expand Down Expand Up @@ -120,7 +120,7 @@ class RLEMask():
Parameters
----------
size: list[int] or np.ndarray[np.int]
size: list[int] or np.ndarray[int]
Height and width of mask.
counts: list[int]
Count-encoding of RLE format.
Expand Down
6 changes: 3 additions & 3 deletions dgp/utils/visualization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def mosaic(items, scale=1.0, pad=3, grid_width=None):
N = len(items)
assert N > 0, 'No items to mosaic!'
grid_width = grid_width if grid_width else np.ceil(np.sqrt(N)).astype(int)
grid_height = np.ceil(N * 1. / grid_width).astype(np.int)
grid_height = np.ceil(N * 1.0 / grid_width).astype(int)
input_size = items[0].shape[:2]
target_shape = (int(input_size[1] * scale), int(input_size[0] * scale))
mosaic_items = []
Expand Down Expand Up @@ -340,7 +340,7 @@ def clip_norm(v, x):
v_2d = row_tail - row
v_2d = clip_norm(v_2d, velocity_max_pix * W)
cx, cy = row
cx2, cy2 = row + v_2d.astype(np.int)
cx2, cy2 = row + v_2d.astype(int)
cx2 = np.clip(cx2, 0, W - 1)
cy2 = np.clip(cy2, 0, H - 1)
cv2.arrowedLine(img, (cx, cy), (cx2, cy2), color, thickness=2, line_type=cv2.LINE_AA)
Expand Down Expand Up @@ -552,7 +552,7 @@ def clip_norm(v, x):
v_2d = clip_norm(v_2d, velocity_max_pix * W)

cx, cy = row
cx2, cy2 = row + v_2d.astype(np.int)
cx2, cy2 = row + v_2d.astype(int)

cx2 = np.clip(cx2, 0, W - 1)
cy2 = np.clip(cy2, 0, H - 1)
Expand Down

0 comments on commit f377eb4

Please sign in to comment.