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

AttributeError: Caught AttributeError in DataLoader worker process 0. #3

Open
WindDevil opened this issue Apr 22, 2022 · 6 comments
Open

Comments

@WindDevil
Copy link

出现在train的331行,提示AttributeError: Caught AttributeError in DataLoader worker process 0.
pip list如图
image
torch可以使用cuda,纯CPU推理模式也尝试过
请您帮帮我

@dianjixz
Copy link
Owner

把完整的报错发一下。这个报错可能是你数据集的大小问题,数据集数量较少会出现触发错误,哈哈哈

@WindDevil
Copy link
Author

WindDevil commented Apr 29, 2022 via email

@dianjixz
Copy link
Owner

yes,this is good.

@zywzywzyw
Copy link

Thank you very much, my error has been resolved. It is a trouble of my GTX1650.

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年4月27日(星期三) 晚上11:43 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [dianjixz/v831_yolo] AttributeError: Caught AttributeError in DataLoader worker process 0. (Issue #3) 把完整的报错发一下。这个报错可能是你数据集的大小问题,数据集数量较少会出现触发错误,哈哈哈 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

可以问一下是怎么解决的问题吗,4080也遇到了这个问题没有解决

@STRIVESS
Copy link

STRIVESS commented Aug 9, 2023

您好!我在RTX3060的华硕天选2笔记本电脑训练,ubuntu20.04+pyorch-gpu+cuda环境配好了,数据集(检测是球ball)也是正常的,用官方的yolov3训练是正常的,但在这里遇到类似的错误,我是用conda创建python3.8的pytorch环境操作,怎么解决?

$ python train.py -d custom --cuda -v slim_yolo_v2 -hr -ms

use hi-res backbone
use cuda
use the multi-scale trick ...
Setting Arguments.. : Namespace(batch_size=32, cos=False, cuda=True, dataset='custom', debug=False, eval_epoch=10, gamma=0.1, high_resolution=True, lr=0.0001, momentum=0.9, multi_scale=True, no_warm_up=False, num_workers=16, resume=None, save_folder='weights/', start_epoch=0, tfboard=False, version='slim_yolo_v2', weight_decay=0.0005, wp_epoch=6)

++++++++++++++++++++++++++++
Loading the dataset...
Training model on: ['train']
The dataset size: 1289
++++++++++++++++++++++++++++

/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Loading the pretrained model ...
Loading the hi-res darknet_tiny-448 ...
Let us train slim_yolo_v2 on the custom dataset ......
2023-08-09 15:02:11.512127
ball
ball
ball
ball
ball
ball
ball
Traceback (most recent call last):
File "train.py", line 428, in
train()
File "train.py", line 331, in train
for iter_i, (images, targets) in enumerate(dataloader):
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 633, in next
data = self._next_data()
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1345, in _next_data
return self._process_data(data)
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1371, in _process_data
data.reraise()
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_utils.py", line 644, in reraise
ball
ball
ball
raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/kevin/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/kevin/deep_learning_collection/v831_yolo/data/custom.py", line 114, in getitem
im, gt, h, w = self.pull_item(index)
File "/home/kevin/deep_learning_collection/v831_yolo/data/custom.py", line 137, in pull_item
img, boxes, labels = self.transform(img, target[:, :4], target[:, 4])
File "/home/kevin/deep_learning_collection/v831_yolo/utils/augmentations.py", line 423, in call
return self.augment(img, boxes, labels)
File "/home/kevin/deep_learning_collection/v831_yolo/utils/augmentations.py", line 52, in call
img, boxes, labels = t(img, boxes, labels)
File "/home/kevin/deep_learning_collection/v831_yolo/utils/augmentations.py", line 242, in call
mode = random.choice(self.sample_options)
File "mtrand.pyx", line 920, in numpy.random.mtrand.RandomState.choice
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6,) + inhomogeneous part.


$ pip list
Package Version


actionlib 1.14.0
angles 1.9.13
astunparse 1.6.3
attrs 23.1.0
autopep8 2.0.2
bondpy 1.8.6
camera-calibration 1.17.0
camera-calibration-parsers 1.12.0
catkin 0.8.10
certifi 2023.7.22
charset-normalizer 3.2.0
cmake 3.27.0
contourpy 1.1.0
controller-manager 0.19.6
controller-manager-msgs 0.19.6
cv-bridge 1.16.2
cycler 0.11.0
diagnostic-analysis 1.11.0
diagnostic-common-diagnostics 1.11.0
diagnostic-updater 1.11.0
dynamic-reconfigure 1.7.3
exceptiongroup 1.1.2
expecttest 0.1.4
filelock 3.12.2
fonttools 4.41.1
fsspec 2023.6.0
gazebo_plugins 2.9.2
gazebo_ros 2.9.2
gencpp 0.7.0
geneus 3.0.0
genlisp 0.4.18
genmsg 0.6.0
gennodejs 2.0.2
genpy 0.6.15
gitdb 4.0.10
GitPython 3.1.32
hypothesis 6.82.0
idna 3.4
image-geometry 1.16.2
importlib-resources 6.0.0
interactive-markers 1.12.0
Jinja2 3.1.2
joblib 1.3.1
joint-state-publisher 1.15.1
joint-state-publisher-gui 1.15.1
kiwisolver 1.4.4
laser_geometry 1.6.7
lit 16.0.6
lxml 4.9.3
MarkupSafe 2.1.3
matplotlib 3.7.2
message-filters 1.16.0
mpmath 1.3.0
networkx 3.1
numpy 1.24.4
nvidia-cublas-cu11 11.10.3.66
nvidia-cuda-cupti-cu11 11.7.101
nvidia-cuda-nvrtc-cu11 11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11 8.5.0.96
nvidia-cufft-cu11 10.9.0.58
nvidia-curand-cu11 10.2.10.91
nvidia-cusolver-cu11 11.4.0.1
nvidia-cusparse-cu11 11.7.4.91
nvidia-nccl-cu11 2.14.3
nvidia-nvtx-cu11 11.7.91
opencv-contrib-python 4.8.0.74
opencv-python 4.8.0.74
packaging 23.1
pandas 2.0.3
Pillow 10.0.0
pip 23.1.2
psutil 5.9.5
py-cpuinfo 9.0.0
pycocotools 2.0.6
pycodestyle 2.10.0
pyparsing 3.0.9
python-dateutil 2.8.2
python-qt-binding 0.4.4
pytils 0.4.1
pytz 2023.3
PyYAML 6.0.1
qt-dotgraph 0.4.2
qt-gui 0.4.2
qt-gui-cpp 0.4.2
qt-gui-py-common 0.4.2
requests 2.31.0
resource_retriever 1.12.7
rosbag 1.16.0
rosboost-cfg 1.15.8
rosclean 1.15.8
roscreate 1.15.8
rosgraph 1.16.0
roslaunch 1.16.0
roslib 1.15.8
roslint 0.12.0
roslz4 1.16.0
rosmake 1.15.8
rosmaster 1.16.0
rosmsg 1.16.0
rosnode 1.16.0
rosparam 1.16.0
rospy 1.16.0
rosservice 1.16.0
rostest 1.16.0
rostopic 1.16.0
rosunit 1.15.8
roswtf 1.16.0
rqt_action 0.4.9
rqt_bag 0.5.1
rqt_bag_plugins 0.5.1
rqt_console 0.4.11
rqt_dep 0.4.12
rqt_graph 0.4.14
rqt_gui 0.5.3
rqt_gui_py 0.5.3
rqt-image-view 0.4.17
rqt_launch 0.4.9
rqt_logger_level 0.4.11
rqt-moveit 0.5.10
rqt_msg 0.4.10
rqt_nav_view 0.5.7
rqt_plot 0.4.13
rqt_pose_view 0.5.11
rqt_publisher 0.4.10
rqt_py_common 0.5.3
rqt_py_console 0.4.10
rqt-reconfigure 0.5.5
rqt-robot-dashboard 0.5.8
rqt-robot-monitor 0.5.14
rqt_robot_steering 0.5.12
rqt_runtime_monitor 0.5.9
rqt-rviz 0.7.0
rqt_service_caller 0.4.10
rqt_shell 0.4.11
rqt_srv 0.4.9
rqt_tf_tree 0.6.3
rqt_top 0.4.10
rqt_topic 0.4.13
rqt_web 0.4.10
rviz 1.14.20
scikit-learn 1.3.0
scipy 1.10.1
seaborn 0.12.2
sensor-msgs 1.13.1
setuptools 67.8.0
six 1.16.0
smach 2.5.1
smach-ros 2.5.1
smclib 1.8.6
smmap 5.0.0
sortedcontainers 2.4.0
sympy 1.12
tf 1.13.2
tf-conversions 1.13.2
tf2-geometry-msgs 0.7.6
tf2-kdl 0.7.6
tf2-py 0.7.6
tf2-ros 0.7.6
thop 0.1.1.post2209072238
threadpoolctl 3.2.0
tomli 2.0.1
tools 0.1.9
topic-tools 1.16.0
torch 2.0.1
torchaudio 2.0.2
torchsummary 1.5.1
torchvision 0.15.2
tqdm 4.65.0
triton 2.0.0
types-dataclasses 0.6.6
typing_extensions 4.7.1
tzdata 2023.3
ultralytics 8.0.143
urllib3 2.0.4
utils 1.0.1
wheel 0.38.4
xacro 1.14.15
zipp 3.16.2

@STRIVESS
Copy link

STRIVESS commented Aug 9, 2023

Thank you very much, my error has been resolved. It is a trouble of my GTX1650.

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年4月27日(星期三) 晚上11:43 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [dianjixz/v831_yolo] AttributeError: Caught AttributeError in DataLoader worker process 0. (Issue #3) 把完整的报错发一下。这个报错可能是你数据集的大小问题,数据集数量较少会出现触发错误,哈哈哈 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

同学,您好!请问你是怎样修复这个问题?我也遇到类似的错误

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

4 participants