Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
PHLens opened this issue Mar 14, 2023 · 15 comments
Open
3 tasks done

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

PHLens opened this issue Mar 14, 2023 · 15 comments

Comments

@PHLens
Copy link

PHLens commented Mar 14, 2023

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:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) MKL-DNN v2.1.2 (Git Hash 574ab98256e4b94b681a1413363fd82aef4619f2)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • Build settings: BLAS_INFO=open, BUILD_TYPE=Release, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/g++, CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, FORCE_FALLBACK_CUDA_MPI=1, LAPACK_INFO=open, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=OFF, USE_CUDNN=OFF, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=OFF, USE_MKLDNN=ON, USE_MPI=ON, USE_NCCL=OFF, USE_NNPACK=ON, USE_OPENMP=ON,

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
Copy link

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

@PHLens
Copy link
Author

PHLens commented May 8, 2023

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
Copy link

Thanks! I think this issue is quite odd too.

@markwave
Copy link

i have the same problem ,so how to solve ?

@infatuation0215
Copy link

i have the same problem ,so how to solve ?

you can look at the Additional information section

@sai-krishna-ghanta
Copy link

where is additional information section

@nickjyj
Copy link

nickjyj commented Jun 27, 2023

Got the same error on the Ubuntu.

@ww249
Copy link

ww249 commented Jul 11, 2023

我解决了这个问题,反正是因为没有找到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
Copy link

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
Copy link

xinxinlv commented Mar 15, 2024

我解决了这个问题,反正是因为没有找到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
Copy link

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

@hitbuyi
Copy link

hitbuyi commented Mar 21, 2024

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

@lix19937
Copy link

lix19937 commented Apr 9, 2024

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
Copy link

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
Copy link

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 !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests