文章目录
- 一. 运行 create_data.py 遇到的问题
- 1. 路径问题
- 2. ModuleNotFoundError: No module named 'pybind11'
- 3. ModuleNotFoundError: No module named 'mmcv'
- 4. ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so
- 5. ModuleNotFoundError: No module named 'pycocotools'
- 6. ModuleNotFoundError: No module named 'mmdet.ops.iou3d.iou3d_cuda'
- 7. ModuleNotFoundError: No module named 'terminaltables'
- 8. No such file or directory: '/home/seivl/data/KITTI/ImageSets/trainval.txt'
- 二.运行 train.py 遇到的问题
- 三.运行 test.py 遇到的问题
自己在复现SA-SSD 的时候遇到了许多坑,很多安装依赖作者都没详细说,那我在这里记录一下我遇到的问题和解决办法。另外有做3d object detection 的朋友也可以互相交流~
一. 运行 create_data.py 遇到的问题
1. 路径问题
if __name__ == '__main__':
create_kitti_info_file('/home/billyhe/data/KITTI')
create_reduced_point_cloud('/home/billyhe/data/KITTI')
create_groundtruth_database(data_path='/home/billyhe/data/KITTI', \
info_path='/home/billyhe/data/KITTI/kitti_infos_trainval.pkl', \
db_info_save_path='/home/billyhe/data/KITTI/kitti_dbinfos_trainval.pkl')
改成自己的就行
2. ModuleNotFoundError: No module named ‘pybind11’
(pc) seivl@seivl-Default-string:~/SA-SSD/mmdet/ops/points_op$ python3 setup.py build_ext --inplace
running build_ext
building 'points_op_cpu' extension
Traceback (most recent call last):
File "setup.py", line 34, in <module>
'build_ext': BuildExtension
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/setuptools/__init__.py", line 161, in setup
return distutils.core.setup(**attrs)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 87, in run
_build_ext.run(self)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 343, in build_extensions
build_ext.build_extensions(self)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/ccompiler.py", line 566, in compile
depends, extra_postargs)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/ccompiler.py", line 341, in _setup_compile
pp_opts = gen_preprocess_options(macros, incdirs)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/distutils/ccompiler.py", line 1075, in gen_preprocess_options
pp_opts.append("-I%s" % dir)
File "setup.py", line 14, in __str__
import pybind11
ModuleNotFoundError: No module named 'pybind11'
解决方法
pip install pybind11
3. ModuleNotFoundError: No module named ‘mmcv’
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
Traceback (most recent call last):
File "tools/create_data.py", line 7, in <module>
from mmdet.core.bbox3d.geometry import remove_outside_points, points_in_rbbox, box_camera_to_lidar
File "/home/seivl/SA-SSD/mmdet/core/__init__.py", line 1, in <module>
from .anchor import * # noqa: F401, F403
File "/home/seivl/SA-SSD/mmdet/core/anchor/__init__.py", line 2, in <module>
from .anchor_target import anchor_target
File "/home/seivl/SA-SSD/mmdet/core/anchor/anchor_target.py", line 2, in <module>
from ..bbox import assign_and_sample, BBoxAssigner, SamplingResult, bbox2delta, rbbox3d2delta
File "/home/seivl/SA-SSD/mmdet/core/bbox/__init__.py", line 2, in <module>
from .assignment import BBoxAssigner, AssignResult
File "/home/seivl/SA-SSD/mmdet/core/bbox/assignment.py", line 3, in <module>
from mmdet.core.bbox3d import region_similarity
File "/home/seivl/SA-SSD/mmdet/core/bbox3d/region_similarity.py", line 23, in <module>
from mmdet.core.post_processing.rotate_nms_gpu import rotate_iou_gpu, rotate_iou_gpu_eval
File "/home/seivl/SA-SSD/mmdet/core/post_processing/__init__.py", line 1, in <module>
from .merge_augs import (merge_aug_proposals, merge_aug_bboxes,
File "/home/seivl/SA-SSD/mmdet/core/post_processing/merge_augs.py", line 4, in <module>
from mmdet.core.bbox.transforms import bbox_mapping_back
File "/home/seivl/SA-SSD/mmdet/core/bbox/transforms.py", line 1, in <module>
import mmcv
ModuleNotFoundError: No module named 'mmcv'
解决办法
pip install pytest-runner -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install mmcv -i https://pypi.tuna.tsinghua.edu.cn/simple
4. ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
Traceback (most recent call last):
File "tools/create_data.py", line 7, in <module>
from mmdet.core.bbox3d.geometry import remove_outside_points, points_in_rbbox, box_camera_to_lidar
File "/home/seivl/SA-SSD/mmdet/core/__init__.py", line 1, in <module>
from .anchor import * # noqa: F401, F403
File "/home/seivl/SA-SSD/mmdet/core/anchor/__init__.py", line 2, in <module>
from .anchor_target import anchor_target
File "/home/seivl/SA-SSD/mmdet/core/anchor/anchor_target.py", line 2, in <module>
from ..bbox import assign_and_sample, BBoxAssigner, SamplingResult, bbox2delta, rbbox3d2delta
File "/home/seivl/SA-SSD/mmdet/core/bbox/__init__.py", line 2, in <module>
from .assignment import BBoxAssigner, AssignResult
File "/home/seivl/SA-SSD/mmdet/core/bbox/assignment.py", line 3, in <module>
from mmdet.core.bbox3d import region_similarity
File "/home/seivl/SA-SSD/mmdet/core/bbox3d/region_similarity.py", line 23, in <module>
from mmdet.core.post_processing.rotate_nms_gpu import rotate_iou_gpu, rotate_iou_gpu_eval
File "/home/seivl/SA-SSD/mmdet/core/post_processing/__init__.py", line 1, in <module>
from .merge_augs import (merge_aug_proposals, merge_aug_bboxes,
File "/home/seivl/SA-SSD/mmdet/core/post_processing/merge_augs.py", line 4, in <module>
from mmdet.core.bbox.transforms import bbox_mapping_back
File "/home/seivl/SA-SSD/mmdet/core/bbox/transforms.py", line 1, in <module>
import mmcv
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/mmcv/__init__.py", line 5, in <module>
from .image import *
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/mmcv/image/__init__.py", line 2, in <module>
from .colorspace import (bgr2gray, bgr2hls, bgr2hsv, bgr2rgb, bgr2ycbcr,
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/mmcv/image/colorspace.py", line 2, in <module>
import cv2
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
解决办法,找到/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/mmcv/image/colorspace.py
那个文件。改一下
import sys
ros_path = '/opt/ros/kinetic/lib/python2.7/dist-packages'
if ros_path in sys.path:
sys.path.remove(ros_path)
import cv2
5. ModuleNotFoundError: No module named ‘pycocotools’
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
Traceback (most recent call last):
File "tools/create_data.py", line 7, in <module>
from mmdet.core.bbox3d.geometry import remove_outside_points, points_in_rbbox, box_camera_to_lidar
File "/home/seivl/SA-SSD/mmdet/core/__init__.py", line 1, in <module>
from .anchor import * # noqa: F401, F403
File "/home/seivl/SA-SSD/mmdet/core/anchor/__init__.py", line 2, in <module>
from .anchor_target import anchor_target
File "/home/seivl/SA-SSD/mmdet/core/anchor/anchor_target.py", line 2, in <module>
from ..bbox import assign_and_sample, BBoxAssigner, SamplingResult, bbox2delta, rbbox3d2delta
File "/home/seivl/SA-SSD/mmdet/core/bbox/__init__.py", line 2, in <module>
from .assignment import BBoxAssigner, AssignResult
File "/home/seivl/SA-SSD/mmdet/core/bbox/assignment.py", line 3, in <module>
from mmdet.core.bbox3d import region_similarity
File "/home/seivl/SA-SSD/mmdet/core/bbox3d/region_similarity.py", line 23, in <module>
from mmdet.core.post_processing.rotate_nms_gpu import rotate_iou_gpu, rotate_iou_gpu_eval
File "/home/seivl/SA-SSD/mmdet/core/post_processing/__init__.py", line 1, in <module>
from .merge_augs import (merge_aug_proposals, merge_aug_bboxes,
File "/home/seivl/SA-SSD/mmdet/core/post_processing/merge_augs.py", line 4, in <module>
from mmdet.core.bbox.transforms import bbox_mapping_back
File "/home/seivl/SA-SSD/mmdet/core/bbox/transforms.py", line 4, in <module>
from mmdet.datasets.kitti_utils import project_rect_to_image, project_velo_to_rect
File "/home/seivl/SA-SSD/mmdet/datasets/__init__.py", line 2, in <module>
from .coco import CocoDataset
File "/home/seivl/SA-SSD/mmdet/datasets/coco.py", line 2, in <module>
from pycocotools.coco import COCO
ModuleNotFoundError: No module named 'pycocotools'
解决办法:下载pycocotools
package 然后安装
安装成功结果:
(pc) seivl@seivl-Default-string:~/下载$ pip install pycocotools-2.0.1.tar.gz
Processing ./pycocotools-2.0.1.tar.gz
Requirement already satisfied: setuptools>=18.0 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from pycocotools==2.0.1) (47.3.1.post20200616)
Requirement already satisfied: cython>=0.27.3 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from pycocotools==2.0.1) (0.29.20)
Requirement already satisfied: matplotlib>=2.1.0 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from pycocotools==2.0.1) (3.2.2)
Requirement already satisfied: cycler>=0.10 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.1) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.1) (2.4.7)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.1) (1.2.0)
Requirement already satisfied: numpy>=1.11 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.1) (1.18.5)
Requirement already satisfied: python-dateutil>=2.1 in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools==2.0.1) (2.8.1)
Requirement already satisfied: six in /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages (from cycler>=0.10->matplotlib>=2.1.0->pycocotools==2.0.1) (1.15.0)
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... done
Created wheel for pycocotools: filename=pycocotools-2.0.1-cp36-cp36m-linux_x86_64.whl size=282836 sha256=94ddfbc55d38a7a575cd825d7816345afe54aa980b5b3167f2b1f795307972cf
Stored in directory: /home/seivl/.cache/pip/wheels/0a/3c/ff/9f4f09fd5a7531bb35d8c8bf58117f105e0c9f67d8a9f53a03
Successfully built pycocotools
Installing collected packages: pycocotools
Successfully installed pycocotools-2.0.1
6. ModuleNotFoundError: No module named ‘mmdet.ops.iou3d.iou3d_cuda’
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
Traceback (most recent call last):
File "tools/create_data.py", line 7, in <module>
from mmdet.core.bbox3d.geometry import remove_outside_points, points_in_rbbox, box_camera_to_lidar
File "/home/seivl/SA-SSD/mmdet/core/__init__.py", line 1, in <module>
from .anchor import * # noqa: F401, F403
File "/home/seivl/SA-SSD/mmdet/core/anchor/__init__.py", line 2, in <module>
from .anchor_target import anchor_target
File "/home/seivl/SA-SSD/mmdet/core/anchor/anchor_target.py", line 2, in <module>
from ..bbox import assign_and_sample, BBoxAssigner, SamplingResult, bbox2delta, rbbox3d2delta
File "/home/seivl/SA-SSD/mmdet/core/bbox/__init__.py", line 2, in <module>
from .assignment import BBoxAssigner, AssignResult
File "/home/seivl/SA-SSD/mmdet/core/bbox/assignment.py", line 4, in <module>
from mmdet.ops.iou3d import iou3d_utils
File "/home/seivl/SA-SSD/mmdet/ops/iou3d/iou3d_utils.py", line 2, in <module>
import mmdet.ops.iou3d.iou3d_cuda as iou3d_cuda
ModuleNotFoundError: No module named 'mmdet.ops.iou3d.iou3d_cuda'
解决办法,进入对应的文件夹下编译
(pc) seivl@seivl-Default-string:~/SA-SSD/mmdet/ops/iou3d$ python3 setup.py build_ext --inplace
7. ModuleNotFoundError: No module named ‘terminaltables’
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
Traceback (most recent call last):
File "tools/create_data.py", line 7, in <module>
from mmdet.core.bbox3d.geometry import remove_outside_points, points_in_rbbox, box_camera_to_lidar
File "/home/seivl/SA-SSD/mmdet/core/__init__.py", line 5, in <module>
from .evaluation import * # noqa: F401, F403
File "/home/seivl/SA-SSD/mmdet/core/evaluation/__init__.py", line 4, in <module>
from .coco_utils import coco_eval, fast_eval_recall, results2json
File "/home/seivl/SA-SSD/mmdet/core/evaluation/coco_utils.py", line 6, in <module>
from .recall import eval_recalls
File "/home/seivl/SA-SSD/mmdet/core/evaluation/recall.py", line 2, in <module>
from terminaltables import AsciiTable
ModuleNotFoundError: No module named 'terminaltables'
解决办法
pip install terminaltables -i https://pypi.tuna.tsinghua.edu.cn/simple
8. No such file or directory: ‘/home/seivl/data/KITTI/ImageSets/trainval.txt’
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
Traceback (most recent call last):
File "tools/create_data.py", line 276, in <module>
create_kitti_info_file('/home/seivl/data/KITTI')
File "tools/create_data.py", line 57, in create_kitti_info_file
trainval_img_ids = _read_imageset_file(osp.join(data_path, "ImageSets/trainval.txt"))
File "tools/create_data.py", line 13, in _read_imageset_file
with open(path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/seivl/data/KITTI/ImageSets/trainval.txt'
在这里下载一下,放到对应的路径下就好了
https://xiaozhichen.github.io/files/mv3d/imagesets.tar.gz
成功运行数据处理程序。其实就是和second一样的
(pc) seivl@seivl-Default-string:~/SA-SSD$ python3 tools/create_data.py
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
Generate info. this may take several minutes.
/home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py:189: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "points_in_convex_polygon_3d_jit" failed type inference due to: Invalid use of type(CPUDispatcher(<function surface_equ_3d_jit at 0x7fc8d316cc80>)) with parameters (array(float64, 4d, A))
During: resolving callee type: type(CPUDispatcher(<function surface_equ_3d_jit at 0x7fc8d316cc80>))
During: typing of call at /home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py (210)
File "mmdet/core/bbox3d/geometry.py", line 210:
def points_in_convex_polygon_3d_jit(points,
<source elided>
num_surfaces = np.full((num_polygons,), 9999999, dtype=np.int64)
normal_vec, d = surface_equ_3d_jit(polygon_surfaces[:, :, :3, :])
^
@numba.jit(nopython=False)
/home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py:189: NumbaWarning:
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "points_in_convex_polygon_3d_jit" failed type inference due to: cannot determine Numba type of <class 'numba.core.dispatcher.LiftedLoop'>
File "mmdet/core/bbox3d/geometry.py", line 215:
def points_in_convex_polygon_3d_jit(points,
<source elided>
sign = 0.0
for i in range(num_points):
^
@numba.jit(nopython=False)
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:178: NumbaWarning: Function "points_in_convex_polygon_3d_jit" was compiled in object mode without forceobj=True, but has lifted loops.
File "mmdet/core/bbox3d/geometry.py", line 205:
def points_in_convex_polygon_3d_jit(points,
<source elided>
"""
max_num_surfaces, max_num_points_of_surface = polygon_surfaces.shape[1:3]
^
state.func_ir.loc))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:188: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "mmdet/core/bbox3d/geometry.py", line 205:
def points_in_convex_polygon_3d_jit(points,
<source elided>
"""
max_num_surfaces, max_num_points_of_surface = polygon_surfaces.shape[1:3]
^
state.func_ir.loc))
/home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py:76: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "corner_to_surfaces_3d" failed type inference due to: No implementation of function Function(<built-in function array>) found for signature:
>>> array(list(list(array(float64, 2d, A))))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload in function 'array': File: <built-in>: Line <N/A>.
With argument(s): '(list(list(array(float64, 2d, A))))':
Rejected as the implementation raised a specific error:
TypingError: array(float64, 2d, A) not allowed in a homogeneous sequence
raised from /home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/typing/npydecl.py:471
During: resolving callee type: Function(<built-in function array>)
During: typing of call at /home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py (93)
File "mmdet/core/bbox3d/geometry.py", line 93:
def corner_to_surfaces_3d(corners):
<source elided>
[corners[:, 0], corners[:, 4], corners[:, 5], corners[:, 1]],
[corners[:, 3], corners[:, 2], corners[:, 6], corners[:, 7]],
^
@numba.jit(nopython=False)
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:178: NumbaWarning: Function "corner_to_surfaces_3d" was compiled in object mode without forceobj=True.
File "mmdet/core/bbox3d/geometry.py", line 77:
@numba.jit(nopython=False)
def corner_to_surfaces_3d(corners):
^
state.func_ir.loc))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:188: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "mmdet/core/bbox3d/geometry.py", line 77:
@numba.jit(nopython=False)
def corner_to_surfaces_3d(corners):
^
state.func_ir.loc))
/home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py:189: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "points_in_convex_polygon_3d_jit" failed type inference due to: Invalid use of type(CPUDispatcher(<function surface_equ_3d_jit at 0x7fc8d316cc80>)) with parameters (array(float64, 4d, A))
During: resolving callee type: type(CPUDispatcher(<function surface_equ_3d_jit at 0x7fc8d316cc80>))
During: typing of call at /home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py (210)
File "mmdet/core/bbox3d/geometry.py", line 210:
def points_in_convex_polygon_3d_jit(points,
<source elided>
num_surfaces = np.full((num_polygons,), 9999999, dtype=np.int64)
normal_vec, d = surface_equ_3d_jit(polygon_surfaces[:, :, :3, :])
^
@numba.jit(nopython=False)
/home/seivl/SA-SSD/mmdet/core/bbox3d/geometry.py:189: NumbaWarning:
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "points_in_convex_polygon_3d_jit" failed type inference due to: cannot determine Numba type of <class 'numba.core.dispatcher.LiftedLoop'>
File "mmdet/core/bbox3d/geometry.py", line 215:
def points_in_convex_polygon_3d_jit(points,
<source elided>
sign = 0.0
for i in range(num_points):
^
@numba.jit(nopython=False)
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:178: NumbaWarning: Function "points_in_convex_polygon_3d_jit" was compiled in object mode without forceobj=True, but has lifted loops.
File "mmdet/core/bbox3d/geometry.py", line 205:
def points_in_convex_polygon_3d_jit(points,
<source elided>
"""
max_num_surfaces, max_num_points_of_surface = polygon_surfaces.shape[1:3]
^
state.func_ir.loc))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/core/object_mode_passes.py:188: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "mmdet/core/bbox3d/geometry.py", line 205:
def points_in_convex_polygon_3d_jit(points,
<source elided>
"""
max_num_surfaces, max_num_points_of_surface = polygon_surfaces.shape[1:3]
^
state.func_ir.loc))
Kitti info train file is saved to /home/seivl/data/KITTI/kitti_infos_train.pkl
Kitti info val file is saved to /home/seivl/data/KITTI/kitti_infos_val.pkl
Kitti info trainval file is saved to /home/seivl/data/KITTI/kitti_infos_trainval.pkl
Kitti info test file is saved to /home/seivl/data/KITTI/kitti_infos_test.pkl
load 28742 Car database infos
load 4487 Pedestrian database infos
load 1627 Cyclist database infos
load 2914 Van database infos
load 222 Person_sitting database infos
load 1094 Truck database infos
load 511 Tram database infos
load 973 Misc database infos
注意修改 /configs/car_cfg.py
文件里的路径
二.运行 train.py 遇到的问题
1. 路径问题
解决办法
import sys
sys.path.append('/home/seivl/SA-SSD')
2. No module named ‘mmdet.ops.pointnet2.pointnet2_cuda’
(pc) seivl@seivl-Default-string:~/SA-SSD/tools$ python3 train.py ../configs/car_cfg.py
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
Traceback (most recent call last):
File "train.py", line 15, in <module>
from mmdet.models import build_detector
File "/home/seivl/SA-SSD/mmdet/models/__init__.py", line 1, in <module>
from .detectors import (BaseDetector,RPN)
File "/home/seivl/SA-SSD/mmdet/models/detectors/__init__.py", line 2, in <module>
from .single_stage import SingleStageDetector
File "/home/seivl/SA-SSD/mmdet/models/detectors/single_stage.py", line 7, in <module>
from .. import builder
File "/home/seivl/SA-SSD/mmdet/models/builder.py", line 4, in <module>
from . import (backbones, necks, roi_extractors, rpn_heads, bbox_heads,
File "/home/seivl/SA-SSD/mmdet/models/necks/__init__.py", line 2, in <module>
from .cmn import SpMiddleFHD
File "/home/seivl/SA-SSD/mmdet/models/necks/cmn.py", line 4, in <module>
from mmdet.ops.pointnet2 import pointnet2_utils
File "/home/seivl/SA-SSD/mmdet/ops/pointnet2/pointnet2_utils.py", line 7, in <module>
import mmdet.ops.pointnet2.pointnet2_cuda as pointnet2
ModuleNotFoundError: No module named 'mmdet.ops.pointnet2.pointnet2_cuda'
解决办法
(pc) seivl@seivl-Default-string:~/SA-SSD/mmdet/ops/pointnet2$ python3 setup.py build_ext --inplace
3. ImportError: cannot import name ‘parallel_test’
(pc) seivl@seivl-Default-string:~/SA-SSD/tools$ python3 test.py ../configs/car_cfg.py ../saved_model_vehicle/epoch_50.pth
Traceback (most recent call last):
File "test.py", line 4, in <module>
from mmcv.runner import load_checkpoint, parallel_test
ImportError: cannot import name 'parallel_test'
解决办法:注释掉就好了
4. ModuleNotFoundError: No module named ‘mmdet’
(pc) seivl@seivl-Default-string:~/SA-SSD/tools$ python3 test.py ../configs/car_cfg.py ../saved_model_vehicle/epoch_50.pth
Traceback (most recent call last):
File "test.py", line 6, in <module>
from mmdet.core.evaluation.kitti_eval import get_official_eval_result
ModuleNotFoundError: No module named 'mmdet'
解决办法
pip install mmdet
5. OSError: [Errno 12] Cannot allocate memory
2020-07-24 21:19:41,508 - INFO - **********************Start training**********************
Traceback (most recent call last):
File "/home/seivl/SA-SSD/tools/train.py", line 134, in <module>
main()
File "/home/seivl/SA-SSD/tools/train.py", line 128, in main
log_interval = cfg.log_config.interval
File "/home/seivl/SA-SSD/tools/train_utils/__init__.py", line 95, in train_model
log_interval = log_interval
File "/home/seivl/SA-SSD/tools/train_utils/__init__.py", line 40, in train_one_epoch
for i, data_batch in enumerate(train_loader):
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 193, in __iter__
return _DataLoaderIter(self)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 469, in __init__
w.start()
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/multiprocessing/process.py", line 105, in start
self._popen = self._Popen(self)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/multiprocessing/context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/multiprocessing/context.py", line 277, in _Popen
return Popen(process_obj)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/home/seivl/anaconda3/envs/pc/lib/python3.6/multiprocessing/popen_fork.py", line 66, in _launch
self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory
解决办法:
修改 car_cfg.py
里面的线程数量
data = dict(
imgs_per_gpu=2,
# workers_per_gpu=4,
workers_per_gpu=0,
...
三.运行 test.py 遇到的问题
1. KeyError: ‘model_state’
(pc) seivl@seivl-Default-string:~/SA-SSD/tools$ python3 test.py ../configs/car_cfg.py ../saved_model_vehicle/epoch_50.pth
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
/home/seivl/anaconda3/envs/pc/lib/python3.6/site-packages/numba/cuda/envvars.py:17: NumbaWarning:
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.
For more information about alternatives visit: ('http://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
warnings.warn(errors.NumbaWarning(msg))
[40, 1600, 1408]
==> Loading parameters from checkpoint ../saved_model_vehicle/epoch_50.pth to GPU
Traceback (most recent call last):
File "test.py", line 158, in <module>
main()
File "test.py", line 140, in main
load_params_from_file(model, args.checkpoint)
File "/home/seivl/SA-SSD/tools/train_utils/__init__.py", line 157, in load_params_from_file
model_state_disk = checkpoint['model_state']
KeyError: 'model_state'
解决办法:原答案,修改代码,不太对~
# model_state_disk = checkpoint[‘model_state’]
model_state_disk = checkpoint[‘state_dict’]
感谢 Ronaan 在评论中指出:
KeyError: ‘model_state’这个错误,是因为用了官方模型产生的,用自己训练的就不会有,也就不需要改,结果就还不错。