-
Notifications
You must be signed in to change notification settings - Fork 86
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
您好,我在sh run.sh之后,代码报了错TypeError: __init__() takes 1 positional argument but 4 were given,请问这个问题是什么原因呀,感谢! #17
Comments
可能是你的detectron2版本问题。建议按照readme中的指令安装detectron2 |
I met the same problem. I installed the latest detectron2 (python -m pip install detectron2 -f How can I modify your code to use the official detectron2 instead of your version? Thanks. |
感谢作者给出的建议,我重新配置了环境并成功运行了。环境如下: python 3.7 |
|
[12/22 10:43:48 d2.data.common]: Serializing 117266 elements to byte tensors and concatenating them all ...
[12/22 10:43:52 d2.data.common]: Serialized dataset takes 451.21 MiB
[12/22 10:43:52 detectron2]: Using training sampler TrainingSampler
[12/22 10:43:57 detectron2]: initial from https://download.pytorch.org/models/resnet18-5c106cde.pth
[12/22 10:43:57 detectron2]: The checkpoint state_dict contains keys that are not used by the model:
fc.{weight, bias}
Traceback (most recent call last):
File "/home/yb/centerX/train_net.py", line 66, in
args=(args,),
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/detectron2/engine/launch.py", line 59, in launch
daemon=False,
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 200, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 158, in start_processes
while not context.join():
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 119, in join
raise Exception(msg)
Exception:
-- Process 2 terminated with the following error:
Traceback (most recent call last):
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap
fn(i, *args)
File "/home/yb/anaconda3/envs/centernetx/lib/python3.7/site-packages/detectron2/engine/launch.py", line 94, in _distributed_worker
main_func(*args)
File "/home/yb/centerX/train_net.py", line 52, in main
trainer = Trainer(cfg)
File "/home/yb/centerX/engine/defaults.py", line 71, in init
super(DefaultTrainer, self).init(model, data_loader, optimizer)
TypeError: init() takes 1 positional argument but 4 were given
The text was updated successfully, but these errors were encountered: