open-mmlab / mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
https://mmdetection3d.readthedocs.io/en/latest/
Apache License 2.0
5.31k stars 1.54k forks source link

[Bug] ModuleNotFoundError: No module named 'tools.data_converter' #2352

Open PHLens opened 1 year ago

PHLens commented 1 year ago

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmdetection3d

Environment

Python: 3.6.12 (default, Dec 9 2022, 16:54:45) [GCC 7.5.0] CUDA available: False GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.9.0 PyTorch compiling details: PyTorch built with:

TorchVision: 0.10.0a0+300a8a4 OpenCV: 4.7.0 MMCV: 1.7.1 MMCV Compiler: GCC 7.5 MMCV CUDA Compiler: not available MMDetection: 2.26.0 MMSegmentation: 0.29.1 MMDetection3D: 1.0.0rc7+b3c990a spconv2.0: False

Reproduces the problem - code sample

none

Reproduces the problem - command or script

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes

Reproduces the problem - error message

Traceback (most recent call last): File "tools/create_data.py", line 5, in from tools.data_converter import indoor_converter as indoor ModuleNotFoundError: No module named 'tools.data_converter'

Additional information

i'm using the dev branch, and when i change the following two files like below, then it works fine. i don't know if this is a bug of the python script. Thanks for any advice.


diff --git a/tools/create_data.py b/tools/create_data.py index 32337d1a..1c3efd74 100644 --- a/tools/create_data.py +++ b/tools/create_data.py @@ -2,14 +2,13 @@ import argparse from os import path as osp

-from tools.data_converter import indoor_converter as indoor -from tools.data_converter import kitti_converter as kitti -from tools.data_converter import lyft_converter as lyft_converter -from tools.data_converter import nuscenes_converter as nuscenes_converter -from tools.data_converter.create_gt_database import ( +from data_converter import indoor_converter as indoor +from data_converter import kitti_converter as kitti +from data_converter import lyft_converter as lyft_converter +from data_converter import nuscenes_converter as nuscenes_converter +from data_converter.create_gt_database import ( GTDatabaseCreater, create_groundtruth_database)


diff --git a/tools/data_converter/indoor_converter.py b/tools/data_converter/indoor_converter.py index ee6c0387..3c2dfa5f 100644 --- a/tools/data_converter/indoor_converter.py +++ b/tools/data_converter/indoor_converter.py @@ -4,9 +4,9 @@ import os import mmcv import numpy as np

-from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData -from tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData -from tools.data_converter.sunrgbd_data_utils import SUNRGBDData +from data_converter.s3dis_data_utils import S3DISData, S3DISSegData +from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData +from data_converter.sunrgbd_data_utils import SUNRGBDData

infatuation0215 commented 1 year ago

I have the same issue. Have you solved this problem? If so, could you please give me some information?

PHLens commented 1 year ago

I have the same issue. Have you solved this problem? If so, could you please give me some information?

you can look at the Additional information section

infatuation0215 commented 1 year ago

Thanks! I think this issue is quite odd too.

markwave commented 1 year ago

i have the same problem ,so how to solve ?

infatuation0215 commented 1 year ago

i have the same problem ,so how to solve ?

you can look at the Additional information section

sai-krishna-ghanta commented 1 year ago

where is additional information section

nickjyj commented 1 year ago

Got the same error on the Ubuntu.

ww249 commented 1 year ago

我解决了这个问题,反正是因为没有找到data_convert这个包,所以你需要改成这样 import sys sys.path.append('/home/ww/BEVFormer/tools/') from data_converter.s3dis_data_utils import S3DISData, S3DISSegData from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData from data_converter.sunrgbd_data_utils import SUNRGBDData 给他一个路径让他找到这个包就行了

AlertFresh commented 1 year ago

I solved the problem by adding a init.py file to ~/BEVFormer/ it's an empy file which helps the project finding the modules

xinxinlv commented 7 months ago

我解决了这个问题,反正是因为没有找到data_convert这个包,所以你需要改成这样 import sys sys.path.append('/home/ww/BEVFormer/tools/') from data_converter.s3dis_data_utils import S3DISData, S3DISSegData from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData from data_converter.sunrgbd_data_utils import SUNRGBDData 给他一个路径让他找到这个包就行了

成功了,我在对nuscenes-mini数据集处理。 我的报错信息是: python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes --version v1.0-mini --canbus ./data Traceback (most recent call last): File "tools/create_data.py", line 10, in <module> from data_converter import indoor_converter as indoor File "/data/liuxx/other_projects/bev-projects/BEVFormer/tools/data_converter/indoor_converter.py", line 9, in <module> from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData ModuleNotFoundError: No module named 'tools.data_converter' 我修改了“/data/liuxx/other_projects/bev-projects/BEVFormer/tools/data_converter/indoor_converter.py”的代码: `import sys sys.path.append('/data/liuxx/other_projects/bev-projects/BEVFormer/tools/')

from data_converter.s3dis_data_utils import S3DISData, S3DISSegData from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData from data_converter.sunrgbd_data_utils import SUNRGBDData`

再重新运行一下,数据集处理的代码create_data.py 成功了

weimengchuan commented 7 months ago

最简单的方法: touch tools/init.py

hitbuyi commented 7 months ago

最简单的方法: touch tools/init.py 我这里没有效果

lix19937 commented 7 months ago

from

from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from tools.data_converter.sunrgbd_data_utils import SUNRGBDData`

to

import sys
sys.path.append('/mnt/d/workspace/BEVFormer-master/tools/') # here your path 

from data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from data_converter.sunrgbd_data_utils import SUNRGBDData

it works.

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes --version v1.0-mini --canbus ./data  

v1.0-mini ./data/nuscenes
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.564 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
total scene num: 10
exist scene num: 10
train scene: 8, val scene: 2
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 404/404, 13.6 task/s, elapsed: 30s, ETA:     0s
train sample: 323, val sample: 81
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.519 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 323/323, 3.5 task/s, elapsed: 91s, ETA:     0s
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.472 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 81/81, 3.1 task/s, elapsed: 26s, ETA:     0s
Vi0letYan commented 6 months ago

from

from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from tools.data_converter.sunrgbd_data_utils import SUNRGBDData`

to

import sys
sys.path.append('/mnt/d/workspace/BEVFormer-master/tools/') # here your path 

from data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from data_converter.sunrgbd_data_utils import SUNRGBDData

it works.

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes --version v1.0-mini --canbus ./data  

v1.0-mini ./data/nuscenes
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.564 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
total scene num: 10
exist scene num: 10
train scene: 8, val scene: 2
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 404/404, 13.6 task/s, elapsed: 30s, ETA:     0s
train sample: 323, val sample: 81
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.519 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 323/323, 3.5 task/s, elapsed: 91s, ETA:     0s
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.472 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 81/81, 3.1 task/s, elapsed: 26s, ETA:     0s

thx a lot, this works for me.

KamiKamiKumo commented 4 months ago

from

from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from tools.data_converter.sunrgbd_data_utils import SUNRGBDData`

to

import sys
sys.path.append('/mnt/d/workspace/BEVFormer-master/tools/') # here your path 

from data_converter.s3dis_data_utils import S3DISData, S3DISSegData
from data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
from data_converter.sunrgbd_data_utils import SUNRGBDData

it works.

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes --version v1.0-mini --canbus ./data  

v1.0-mini ./data/nuscenes
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.564 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
total scene num: 10
exist scene num: 10
train scene: 8, val scene: 2
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 404/404, 13.6 task/s, elapsed: 30s, ETA:     0s
train sample: 323, val sample: 81
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.519 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 323/323, 3.5 task/s, elapsed: 91s, ETA:     0s
======
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 0.472 seconds.
======
Reverse indexing ...
Done reverse indexing in 0.0 seconds.
======
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 81/81, 3.1 task/s, elapsed: 26s, ETA:     0s

oh my god, this is the best solving method !!!