JosephKJ/OWOD

Task1 test: "AttributeError: Cannot find field 'logits' in the given Instances!"

CtCCtV opened this issue · 2 comments

When I run test of task1, with using the model_final.pth, it comes out "AttributeError: Cannot find field 'logits' in the given Instances!" The whole error log are as follows:
[09/12 01:27:41 d2.data.dataset_mapper]: [DatasetMapper] Augmentations used in inference: [ResizeShortestEdge(short_edge_length=(800, 800), max_size=1333, sample_style='choice')]
[09/12 01:27:41 d2.data.common]: Serializing 2381 elements to byte tensors and concatenating them all ...
[09/12 01:27:41 d2.data.common]: Serialized dataset takes 1.08 MiB
[09/12 01:27:41 d2.evaluation.evaluator]: Start inference on 1191 batches
/root/data/ore0910/detectron2/detectron2/modeling/roi_heads/fast_rcnn.py:154: UserWarning: This overload of nonzero is deprecated:
nonzero()
Consider using one of the following signatures instead:
nonzero(, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1603728993639/work/torch/csrc/utils/python_arg_parser.cpp:882.)
filter_inds = filter_mask.nonzero()
/root/data/ore0910/detectron2/detectron2/modeling/roi_heads/fast_rcnn.py:154: UserWarning: This overload of nonzero is deprecated:
nonzero()
Consider using one of the following signatures instead:
nonzero(
, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1603728993639/work/torch/csrc/utils/python_arg_parser.cpp:882.)
filter_inds = filter_mask.nonzero()
Traceback (most recent call last):
File "tools/voc_train.py", line 227, in
args=(args,),
File "/root/data/ore0910/detectron2/detectron2/engine/launch.py", line 79, in launch
daemon=False,
File "/opt/conda/envs/ore/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 199, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/opt/conda/envs/ore/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 157, in start_processes
while not context.join():
File "/opt/conda/envs/ore/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 118, in join
raise Exception(msg)
Exception:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "/opt/conda/envs/ore/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap
fn(i, *args)
File "/root/data/ore0910/detectron2/detectron2/engine/launch.py", line 126, in _distributed_worker
main_func(*args)
File "/root/data/ore0910/tools/voc_train.py", line 197, in main
res = Trainer.test(cfg, model)
File "/root/data/ore0910/detectron2/detectron2/engine/defaults.py", line 607, in test
results_i = inference_on_dataset(model, data_loader, evaluator)
File "/root/data/ore0910/detectron2/detectron2/evaluation/evaluator.py", line 164, in inference_on_dataset
evaluator.process(inputs, outputs)
File "/root/data/ore0910/detectron2/detectron2/evaluation/pascal_voc_evaluation.py", line 121, in process
logits = instances.logits
File "/root/data/ore0910/detectron2/detectron2/structures/instances.py", line 65, in getattr
raise AttributeError("Cannot find field '{}' in the given Instances!".format(name))
AttributeError: Cannot find field 'logits' in the given Instances!

Looking forward your reply! Thank you!

Never faced this issue, have you build the detectron2 packaged with this repo? If not, please read this. Kindly check the versions of the dependencies too. This is what I had used: https://github.com/JosephKJ/OWOD/blob/master/requirement.txt

@CtCCtV I also had the same problem, please how did you solve it