facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.05k stars 7.42k forks source link

TypeError: _train_loader_from_config() takes 1 positional argument but 2 were given #2291

Closed wincle closed 3 years ago

wincle commented 3 years ago

Traceback (most recent call last): File "tools/train_net.py", line 237, in launch( File "/root/anaconda3/lib/python3.8/site-packages/detectron2/engine/launch.py", line 62, in launch main_func(args) File "tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "tools/train_net.py", line 62, in init data_loader = self.build_train_loader(cfg) File "tools/train_net.py", line 128, in build_train_loader return build_detection_train_loader(cfg, mapper) File "/root/anaconda3/lib/python3.8/site-packages/detectron2/config/config.py", line 201, in wrapped explicit_args = _get_args_from_config(from_config, args, *kwargs) File "/root/anaconda3/lib/python3.8/site-packages/detectron2/config/config.py", line 236, in _get_args_from_config ret = from_config_func(args, **kwargs) TypeError: _train_loader_from_config() takes 1 positional argument but 2 were given

I don't know why it comes up, anyone could help me? Thx!

ppwwyyxx commented 3 years ago

It appears that we accidentally require mapper argument to be explicit, i.e. it must be build_detection_train_loader(cfg, mapper=mapper). We will revert this requirement.

wincle commented 3 years ago

It appears that we accidentally require mapper argument to be explicit, i.e. it must be build_detection_train_loader(cfg, mapper=mapper). We will revert this requirement.

Thx for your help, it worked, but I met another problem.

Traceback (most recent call last): File "tools/train_net.py", line 237, in launch( File "/root/anaconda3/lib/python3.8/site-packages/detectron2/engine/launch.py", line 62, in launch main_func(*args) File "tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "tools/train_net.py", line 69, in init super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given

I thought may be another version issue, how could I fix it?

ppwwyyxx commented 3 years ago

I can't see your code so I cannot answer this one. There is an issue template that asks for enough details.

wincle commented 3 years ago

I can't see your code so I cannot answer this one. There is an issue template that asks for enough details.

I'm using AdelaiDet training code, below link is the code I used. https://github.com/aim-uofa/AdelaiDet/blob/master/tools/train_net.py exception happened in line 69.

ppwwyyxx commented 3 years ago

Then please use https://github.com/aim-uofa/AdelaiDet/issues/235 instead.