facebookresearch / unbiased-teacher

PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection
https://arxiv.org/abs/2102.09480
MIT License
412 stars 82 forks source link

TypeError: 'NoneType' object is not iterable #24

Closed xiaohui0225 closed 3 years ago

xiaohui0225 commented 3 years ago

Dear author, hello. What does the code shown below mean? Why is there "instances" and what does it mean? thanks!

    if "instances" in batched_inputs[0]:
        gt_instances = [x["instances"].to(self.device) for x in batched_inputs]
    else:
        gt_instances = None

TypeError: 'NoneType' object is not iterable

ycliu93 commented 3 years ago

Why is there "instances" and what does it mean? A: Each element of batch_inputs contains an image and a label (ground-truth label for labeled data or pseudo-label for unlabeled data).

What causes the error you encountered? A: It seems that your batched_inputs is None, and this makes the batched_inputs not iterable (batched_inputs[0] causes the error.)