Closed githigher closed 3 months ago
I have observed that there is an OpenCOOD-main/setup.py file in the official code repository of opencood. I suspect that it is due to the missing setup.py file in the code repository you provided, which resulted in the ModuleNotFoundError.
After my experiment, you can save the following code as a setup.py file:
# -*- coding: utf-8 -*-
# Author: Runsheng Xu <rxx3386@ucla.edu>
# License: TDG-Attribution-NonCommercial-NoDistrib
from os.path import dirname, realpath
from setuptools import setup, find_packages, Distribution
from opencood.version import __version__
def _read_requirements_file():
"""Return the elements in requirements.txt."""
req_file_path = '%s/requirements.txt' % dirname(realpath(__file__))
with open(req_file_path) as f:
return [line.strip() for line in f]
setup(
name='OpenCOOD',
version=__version__,
packages=find_packages(),
url='https://github.com/ucla-mobility/OpenCDA.git',
license='MIT',
author='Runsheng Xu, Hao Xiang',
author_email='rxx3386@ucla.edu',
description='An opensource pytorch framework for autonomous driving '
'cooperative detection',
# long_description=open("README.md").read(),
# install_requires=_read_requirements_file(),
)
Then place it in a directory at the same level as opencool, and finally run the following command:
python setup.py develop
This is equivalent to downloading the opencood library directly, and you can use conda list
to check it. I am confident that this can solve the ModuleNotFoundError, and I also hope that the author can resolve this bug.
Thanks for your valuable feedback! This is an issue caused by mistake when reorganizing the codebase.
We will fix this bug. Thanks a lot!
Thank you very much for finally adopting my suggestion. I would like to add some considerations for configuring the environment.
Do not run its python setup. py develop
code when configuring the opencood environment according to the installation instruction. At the end, you must run python setup. py develop
in the DAIR-RCooper project. Otherwise, the following error will occur:
raceback (most recent call last):
File "opencood_plugin/opencood/tools/train.py", line 209, in <module>
main()
File "opencood_plugin/opencood/tools/train.py", line 142, in main
for i, batch_data in enumerate(train_loader):
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
data = self._next_data()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data
return self._process_data(data)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data
data.reraise()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/_utils.py", line 461, in reraise
raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
data = fetcher.fetch(index)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/coop/gyt/OpenCOOD-main/opencood/data_utils/datasets/intermediate_fusion_dataset.py", line 58, in __getitem__
cur_ego_pose_flag=self.cur_ego_pose_flag)
File "/home/coop/gyt/OpenCOOD-main/opencood/data_utils/datasets/basedataset.py", line 262, in retrieve_base_data
pcd_utils.pcd_to_np(cav_content[timestamp_key_delay]['lidar'])
File "/home/coop/gyt/OpenCOOD-main/opencood/utils/pcd_utils.py", line 36, in pcd_to_np
pcd_np = np.hstack((xyz, intensity))
File "<__array_function__ internals>", line 6, in hstack
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/numpy/core/shape_base.py", line 345, in hstack
return _nx.concatenate(arrs, 1)
File "<__array_function__ internals>", line 6, in concatenate
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 201600 and the array at index 1 has size 0
Hi @githigher Thanks for your valuable suggestion! We have updated related readmes. Thanks a lot!
When I was preparing for training, I ran the following code:
bash scripts/det_train_corridor_fcooper.sh
But the following error occurred:Traceback (most recent call last): File "opencood_plugin/opencood/tools/train.py", line 15, in
import opencood.hypes_yaml.yaml_utils as yaml_utils
ModuleNotFoundError: No module named 'opencood'
I checked that there is a file named init. py in the opencool folder, but I don't know why an error occurred.