Browse Source

bugfix(3d_bev_detection):Avoid compiling ops when paddlex is initialized. (#3237)

* modify 3d bev detection pipeline docs : add pipeline output description.

* bugfix(3d_bev_detection):Avoid compiling ops when paddlex is initialized.

* bugfix(3d_bev_detection):Avoid compiling ops when paddlex is initialized.

---------

Co-authored-by: cuicheng01 <45199522+cuicheng01@users.noreply.github.com>
Jonathans575 9 months ago
parent
commit
d4febeacf5
1 changed files with 6 additions and 6 deletions
  1. 6 6
      paddlex/inference/models/3d_bev_detection/predictor.py

+ 6 - 6
paddlex/inference/models/3d_bev_detection/predictor.py

@@ -19,12 +19,6 @@ from importlib import import_module
 import lazy_paddle
 
 from ....utils import logging
-
-if lazy_paddle.is_compiled_with_cuda() and not lazy_paddle.is_compiled_with_rocm():
-    from ....ops.voxelize import hard_voxelize
-    from ....ops.iou3d_nms import nms_gpu
-else:
-    logging.error("3D BEVFusion custom ops only support GPU platform!")
 from ....utils.func_register import FuncRegister
 
 module_3d_bev_detection = import_module(".3d_bev_detection", "paddlex.modules")
@@ -92,6 +86,12 @@ class BEVDet3DPredictor(BasicPredictor):
         Returns:
             tuple: A tuple containing the preprocessors and inference engine.
         """
+        if lazy_paddle.is_compiled_with_cuda() and not lazy_paddle.is_compiled_with_rocm():
+            from ....ops.voxelize import hard_voxelize
+            from ....ops.iou3d_nms import nms_gpu
+        else:
+            logging.error("3D BEVFusion custom ops only support GPU platform!")
+
         pre_tfs = {"Read": ReadNuscenesData()}
         for cfg in self.config["PreProcess"]["transform_ops"]:
             tf_key = list(cfg.keys())[0]