"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "e0543756b3732fbf50f71bc1b1828f60ec1ee9e4"
Unverified Commit 2abd9b1e authored by ChaimZhu's avatar ChaimZhu Committed by GitHub
Browse files

[Enhance] Update numba version (#1043)

* update numba

* update

* fix numba version in doc

* fix typo

* fix_typos
parent 71c79968
......@@ -19,12 +19,6 @@ We list some potential troubles encountered by users and developers, along with
**NOTE**: We have migrated to use pycocotools in mmdet3d >= 0.13.0.
- If you face the error shown below, and your environment contains numba == 0.48.0 with numpy >= 1.20.0:
``TypeError: expected dtype object, got 'numpy.dtype[bool_]'``
please downgrade numpy to < 1.20.0 or install numba == 0.48 from source, because in numpy == 1.20.0, `np.dtype` produces subclass due to API change. Please refer to [here](https://github.com/numba/numba/issues/6041) for more details.
- If you face the error shown below when importing pycocotools:
``ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject``
......@@ -36,3 +30,4 @@ We list some potential troubles encountered by users and developers, along with
or
``pip install -e "git+https://github.com/ppwwyyxx/cocoapi#egg=pycocotools&subdirectory=PythonAPI"``
......@@ -19,12 +19,6 @@
**注意**: 我们已经在 0.13.0 及之后的版本中全面支持 pycocotools。
- 如果您遇到下面的问题,并且您的环境包含 numba == 0.48.0 和 numpy >= 1.20.0:
``TypeError: expected dtype object, got 'numpy.dtype[bool_]'``
请将 numpy 的版本降级至 < 1.20.0,或者从源码安装 numba == 0.48,这是由于 numpy == 1.20.0 改变了 API,使得在调用 `np.dtype` 会产生子类。请参考 [这里](https://github.com/numba/numba/issues/6041) 获取更多细节。
- 如果您在导入 pycocotools 相关包时遇到下面的问题:
``ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject``
......@@ -36,3 +30,4 @@
或者
``pip install -e "git+https://github.com/ppwwyyxx/cocoapi#egg=pycocotools&subdirectory=PythonAPI"``
......@@ -705,7 +705,7 @@ def points_in_convex_polygon_3d_jit(points,
normal_vec, d, num_surfaces)
@numba.jit
@numba.njit
def points_in_convex_polygon_jit(points, polygon, clockwise=False):
"""Check points is in 2d convex polygons. True when point in polygon.
......@@ -723,14 +723,16 @@ def points_in_convex_polygon_jit(points, polygon, clockwise=False):
num_points_of_polygon = polygon.shape[1]
num_points = points.shape[0]
num_polygons = polygon.shape[0]
# if clockwise:
# vec1 = polygon - polygon[:, [num_points_of_polygon - 1] +
# list(range(num_points_of_polygon - 1)), :]
# else:
# vec1 = polygon[:, [num_points_of_polygon - 1] +
# list(range(num_points_of_polygon - 1)), :] - polygon
# vec1: [num_polygon, num_points_of_polygon, 2]
vec1 = np.zeros((2), dtype=polygon.dtype)
# vec for all the polygons
if clockwise:
vec1 = polygon - polygon[:,
np.array([num_points_of_polygon - 1] + list(
range(num_points_of_polygon - 1))), :]
else:
vec1 = polygon[:,
np.array([num_points_of_polygon - 1] +
list(range(num_points_of_polygon -
1))), :] - polygon
ret = np.zeros((num_points, num_polygons), dtype=np.bool_)
success = True
cross = 0.0
......@@ -738,12 +740,9 @@ def points_in_convex_polygon_jit(points, polygon, clockwise=False):
for j in range(num_polygons):
success = True
for k in range(num_points_of_polygon):
if clockwise:
vec1 = polygon[j, k] - polygon[j, k - 1]
else:
vec1 = polygon[j, k - 1] - polygon[j, k]
cross = vec1[1] * (polygon[j, k, 0] - points[i, 0])
cross -= vec1[0] * (polygon[j, k, 1] - points[i, 1])
vec = vec1[j, k]
cross = vec[1] * (polygon[j, k, 0] - points[i, 0])
cross -= vec[0] * (polygon[j, k, 1] - points[i, 1])
if cross >= 0:
success = False
break
......
......@@ -15,13 +15,13 @@ def div_up(m, n):
return m // n + (m % n > 0)
@cuda.jit('(float32[:], float32[:], float32[:])', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def trangle_area(a, b, c):
return ((a[0] - c[0]) * (b[1] - c[1]) - (a[1] - c[1]) *
(b[0] - c[0])) / 2.0
@cuda.jit('(float32[:], int32)', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def area(int_pts, num_of_inter):
area_val = 0.0
for i in range(num_of_inter - 2):
......@@ -31,7 +31,7 @@ def area(int_pts, num_of_inter):
return area_val
@cuda.jit('(float32[:], int32)', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def sort_vertex_in_convex_polygon(int_pts, num_of_inter):
if num_of_inter > 0:
center = cuda.local.array((2, ), dtype=numba.float32)
......@@ -71,10 +71,7 @@ def sort_vertex_in_convex_polygon(int_pts, num_of_inter):
int_pts[j * 2 + 1] = ty
@cuda.jit(
'(float32[:], float32[:], int32, int32, float32[:])',
device=True,
inline=True)
@cuda.jit(device=True, inline=True)
def line_segment_intersection(pts1, pts2, i, j, temp_pts):
A = cuda.local.array((2, ), dtype=numba.float32)
B = cuda.local.array((2, ), dtype=numba.float32)
......@@ -117,10 +114,7 @@ def line_segment_intersection(pts1, pts2, i, j, temp_pts):
return False
@cuda.jit(
'(float32[:], float32[:], int32, int32, float32[:])',
device=True,
inline=True)
@cuda.jit(device=True, inline=True)
def line_segment_intersection_v1(pts1, pts2, i, j, temp_pts):
a = cuda.local.array((2, ), dtype=numba.float32)
b = cuda.local.array((2, ), dtype=numba.float32)
......@@ -159,7 +153,7 @@ def line_segment_intersection_v1(pts1, pts2, i, j, temp_pts):
return True
@cuda.jit('(float32, float32, float32[:])', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def point_in_quadrilateral(pt_x, pt_y, corners):
ab0 = corners[2] - corners[0]
ab1 = corners[3] - corners[1]
......@@ -178,7 +172,7 @@ def point_in_quadrilateral(pt_x, pt_y, corners):
return abab >= abap and abap >= 0 and adad >= adap and adap >= 0
@cuda.jit('(float32[:], float32[:], float32[:])', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def quadrilateral_intersection(pts1, pts2, int_pts):
num_of_inter = 0
for i in range(4):
......@@ -202,7 +196,7 @@ def quadrilateral_intersection(pts1, pts2, int_pts):
return num_of_inter
@cuda.jit('(float32[:], float32[:])', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def rbbox_to_corners(corners, rbbox):
# generate clockwise corners and rotate it clockwise
angle = rbbox[4]
......@@ -228,7 +222,7 @@ def rbbox_to_corners(corners, rbbox):
1] = -a_sin * corners_x[i] + a_cos * corners_y[i] + center_y
@cuda.jit('(float32[:], float32[:])', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def inter(rbbox1, rbbox2):
"""Compute intersection of two rotated boxes.
......@@ -254,7 +248,7 @@ def inter(rbbox1, rbbox2):
return area(intersection_corners, num_intersection)
@cuda.jit('(float32[:], float32[:], int32)', device=True, inline=True)
@cuda.jit(device=True, inline=True)
def devRotateIoUEval(rbox1, rbox2, criterion=-1):
"""Compute rotated iou on device.
......
......@@ -2,7 +2,7 @@
import numba
import numpy as np
import warnings
from numba.errors import NumbaPerformanceWarning
from numba.core.errors import NumbaPerformanceWarning
from mmdet3d.core.bbox import box_np_ops
......
lyft_dataset_sdk
networkx>=2.2,<2.3
# we may unlock the version of numba in the future
numba==0.48.0
numpy<1.20.0
numba>0.52.1
numpy
nuscenes-devkit
plyfile
scikit-image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment