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

AOLM的程序问题 #40

Open
xhlho opened this issue May 16, 2023 · 2 comments
Open

AOLM的程序问题 #40

xhlho opened this issue May 16, 2023 · 2 comments

Comments

@xhlho
Copy link

xhlho commented May 16, 2023

您好,我在运行训练时遇到一个问题,源代码如下
properties = measure.regionprops(component_labels)
areas = []
for prop in properties:
areas.append(prop.area)
max_idx = areas.index(max(areas))
报错内容为
ValueError: max() arg is an empty sequence
它显示max()中的areas为空,无法读取
我想询问是少了什么吗?

@xhlho
Copy link
Author

xhlho commented May 17, 2023

是因为社区版本和专业版本的原因吗?

@895318
Copy link

895318 commented May 16, 2024

请问这个问题你解决了吗?我把这个模块加进我的模型以后,一开始在双卡上回报这个错误,但移到单卡上也会发生这个问题。但奇怪的是相同的batch-size有时候就可以畅通无阻的训练,有的时候就会出现这个错误。
Traceback (most recent call last):
File "train.py", line 33, in
do_train(
File "/root/autodl-tmp/PART-master/processor/processor.py", line 102, in do_train
cls_g, cls_1 = model(img, target,mode='train') #0515
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 168, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 178, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 425, in reraise
raise self.exc_type(msg)
ValueError: Caught ValueError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/root/autodl-tmp/PART-master/model/make_model.py", line 321, in forward
return self.forward_multi(inputs, label)
File "/root/autodl-tmp/PART-master/model/make_model.py", line 406, in forward_multi
coordinates = torch.tensor(AOLM(out.detach()))
File "/root/autodl-tmp/PART-master/model/make_model.py", line 33, in AOLM
max_idx = areas.index(max(areas))
ValueError: max() arg is an empty sequence

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

2 participants