Skip to content

Commit f377eb4

Browse files
authored
fix: fixing the numpy dtype warnings > v1.19 (#117)
* ci: fixing the numpy dtype warnings > v1.19 * ci: fixing the numpy dtype warnings > v1.19 * Merge branch 'master' into chore/wadim/np_warnings
1 parent e3862db commit f377eb4

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

dgp/datasets/base_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def annotation_index(self):
363363
total_annotations += list(self.autolabeled_scenes.keys())
364364

365365
scene_annotation_index = xr.DataArray(
366-
np.zeros((len(self.data), len(total_annotations)), dtype=np.bool),
366+
np.zeros((len(self.data), len(total_annotations)), dtype=bool),
367367
dims=["datums", "annotations"],
368368
coords={"annotations": total_annotations}
369369
)

dgp/datasets/frame_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from dgp.datasets import BaseDataset, DatasetMetadata
2121

2222
SUPPORTED_ANNOTATIONS_TABLE = xr.DataArray(
23-
np.zeros((len(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE), len(ALL_ANNOTATION_TYPES)), dtype=np.bool),
23+
np.zeros((len(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE), len(ALL_ANNOTATION_TYPES)), dtype=bool),
2424
dims=["datum_types", "annotations"],
2525
coords={
2626
"datum_types": list(DATUM_TYPE_TO_SUPPORTED_ANNOTATION_TYPE),

dgp/utils/camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def in_frustum(self, X, height, width):
334334
Bool array for X which are inside frustum
335335
"""
336336
if not len(X):
337-
return np.array([], dtype=np.bool)
337+
return np.array([], dtype=bool)
338338

339339
corners = np.asarray([(0, 0), (width - 1, 0), (width - 1, height - 1), (0, height - 1)], dtype=np.float32)
340340
rays = self.unproject(corners)

dgp/utils/structures/instance_mask.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class InstanceMask2D():
1313
1414
Parameters
1515
----------
16-
mask: np.ndarray[np.bool, np.uint8, np.int64]
16+
mask: np.ndarray[bool, np.uint8, np.int64]
1717
2D boolean array describiing instance mask.
1818
1919
class_id: int, default: GENERIC_OBJECT_CLASS
@@ -28,7 +28,7 @@ class InstanceMask2D():
2828
defaults to empty dict.
2929
"""
3030
def __init__(self, mask, class_id=GENERIC_OBJECT_CLASS, instance_id=None, color=(0, 0, 0), attributes=None):
31-
assert mask.dtype in (np.bool, np.uint8, np.int64)
31+
assert mask.dtype in (bool, np.uint8, np.int64)
3232
self._bitmask = mask
3333

3434
self._class_id = class_id
@@ -120,7 +120,7 @@ class RLEMask():
120120
121121
Parameters
122122
----------
123-
size: list[int] or np.ndarray[np.int]
123+
size: list[int] or np.ndarray[int]
124124
Height and width of mask.
125125
counts: list[int]
126126
Count-encoding of RLE format.

dgp/utils/visualization_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def mosaic(items, scale=1.0, pad=3, grid_width=None):
9999
N = len(items)
100100
assert N > 0, 'No items to mosaic!'
101101
grid_width = grid_width if grid_width else np.ceil(np.sqrt(N)).astype(int)
102-
grid_height = np.ceil(N * 1. / grid_width).astype(np.int)
102+
grid_height = np.ceil(N * 1.0 / grid_width).astype(int)
103103
input_size = items[0].shape[:2]
104104
target_shape = (int(input_size[1] * scale), int(input_size[0] * scale))
105105
mosaic_items = []
@@ -340,7 +340,7 @@ def clip_norm(v, x):
340340
v_2d = row_tail - row
341341
v_2d = clip_norm(v_2d, velocity_max_pix * W)
342342
cx, cy = row
343-
cx2, cy2 = row + v_2d.astype(np.int)
343+
cx2, cy2 = row + v_2d.astype(int)
344344
cx2 = np.clip(cx2, 0, W - 1)
345345
cy2 = np.clip(cy2, 0, H - 1)
346346
cv2.arrowedLine(img, (cx, cy), (cx2, cy2), color, thickness=2, line_type=cv2.LINE_AA)
@@ -552,7 +552,7 @@ def clip_norm(v, x):
552552
v_2d = clip_norm(v_2d, velocity_max_pix * W)
553553

554554
cx, cy = row
555-
cx2, cy2 = row + v_2d.astype(np.int)
555+
cx2, cy2 = row + v_2d.astype(int)
556556

557557
cx2 = np.clip(cx2, 0, W - 1)
558558
cy2 = np.clip(cy2, 0, H - 1)

0 commit comments

Comments
 (0)