lkeab / BCNet

Deep Occlusion-Aware Instance Segmentation with Overlapping BiLayers [CVPR 2021]
https://arxiv.org/abs/2103.12340
MIT License
529 stars 74 forks source link

TypeError: 'NoneType' object is not iterable #103

Closed guangxuwang closed 2 years ago

guangxuwang commented 2 years ago

When i use the dataset created by myself, my dataset contains only one type

[04/30 21:47:18 d2.data.datasets.coco]: Loaded 80 images in COCO format from datasets/cocococo/annotations/instances_train_2017.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 48, in launch daemon=False, File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn while not spawn_context.join(): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join raise Exception(msg) Exception:

-- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/wangguangxu/BCNet-main/tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/catalog.py", line 62, in get return f() File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

wmrenr commented 2 years ago

I think you should chang the mask name corresponding to occluded objects and occluded objects on lines 326 and 328 in the /wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py file.

wmrenr commented 2 years ago

When i use the dataset created by myself, my dataset contains only one type

[04/30 21:47:18 d2.data.datasets.coco]: Loaded 80 images in COCO format from datasets/cocococo/annotations/instances_train_2017.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 48, in launch daemon=False, File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn while not spawn_context.join(): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join raise Exception(msg) Exception:

-- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/wangguangxu/BCNet-main/tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/catalog.py", line 62, in get return f() File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Have you solved this problem?

zhang-pan commented 2 years ago

Have you try this code in COCO2017 dataset successfully?

wmrenr commented 2 years ago

yeh,I am training on the COCO2017 dataset.

zhang-pan commented 2 years ago

yeh,I am training on the COCO2017 dataset. 您在基于COCO2017数据集进行训练的时候是怎么设置的?我们按照给定的教程跑的时候总是报各种错误,程序中好像还要读取OCC数据集,你当时怎么避开这些坑的?

wmrenr commented 2 years ago

You can give the errors for debugging.

zhang-pan commented 2 years ago

You can give the errors for debugging.

按照教程中的步骤,我们发现读不到图片路劲,我们在config中将图片路径改成了绝对路径,在coco.py文件中将segm = anno.get("segmentation", None)# bo_segm = anno.get("segmentation", None) #bgobject,其中尝试将bg_object_segmentation改成和segmentation一致,能跑通一点了,但是报出 -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/zhangpan/BCNet-main/tools/train_net.py", line 149, in main return trainer.train() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/defaults.py", line 373, in train super().train(self.start_iter, self.max_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 131, in train self.run_step() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 205, in run_step data = next(self._data_loader_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 139, in iter for d in self.dataset: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 40, in getitem data = self._map_func(self._dataset[cur_idx]) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/dataset_mapper.py", line 76, in call image = utils.read_image(dataset_dict["file_name"], format=self.img_format) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/detection_utils.py", line 53, in read_image with PathManager.open(file_name, "rb") as f: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 1012, in open bret = handler._open(path, mode, buffering=buffering, **kwargs) # type: ignore File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 612, in _open opener=opener, FileNotFoundError: [Errno 2] No such file or directory: '000000109450.jpg'

wmrenr commented 2 years ago

Let me see how your data files are placed, I feel like that's the problem here.

zhang-pan commented 2 years ago

Let me see how your data files are placed, I feel like that's the problem here.

After I download the coco2017 dataset, the path is set as follows: / wwwroot / zhangpan / bcnet main / datasets / coco /. Among them, there are annotations, train2017, val2017, test2017 under the coco folder. image

wmrenr commented 2 years ago

what's in your annotations folder?

zhang-pan commented 2 years ago

what's in your annotations folder?

image image

wmrenr commented 2 years ago

you can try to leave the fllowing two jsonfiles only in annotations file. instance_val2017.json instance_train_2017_transform_slight_correct.json

发自我的iPhone

------------------ Original ------------------ From: zhang-pan @.> Date: Tue,May 3,2022 10:47 AM To: lkeab/BCNet @.> Cc: wangxueping78 @.>, Comment @.> Subject: Re: [lkeab/BCNet] TypeError: 'NoneType' object is not iterable (Issue #103)

what's in your annotations folder?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

wmrenr commented 2 years ago

@zhang-pan Have you executed it successfully?

zhang-pan commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

wmrenr commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it.

zhang-pan commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it. image you can download this dataset by the link "https://blog.csdn.net/qq_33287871/article/details/107099931?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7EPayColumn-1.pc_relevant_antiscanv2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7EPayColumn-1.pc_relevant_antiscanv2&utm_relevant_index=1" I hope it is helpful for you.

zhang-pan commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it. I just tried to download it, but I can't seem to open it. It may not be available for download in China at present. I asked my foreign classmates to try again.

zhang-pan commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it. I just tried to download it, but I can't seem to open it. It may not be available for download in China at present. I asked my foreign classmates to try again.

http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d this link can find the dataset, but can not download in China

wmrenr commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it. I just tried to download it, but I can't seem to open it. It may not be available for download in China at present. I asked my foreign classmates to try again.

http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d this link can find the dataset, but can not download in China

Oh thanks.I will try it .You can contact me for qq(934466043).

zhang-pan commented 2 years ago

@zhang-pan Have you executed it successfully?

Thank you very much for your help, because our computer server is now being used by others and the GPU memory is insufficient. I will try it as soon as the server is idle and inform you of the results.

Ok, have you downloaded KINS datasets?I can't find it. I just tried to download it, but I can't seem to open it. It may not be available for download in China at present. I asked my foreign classmates to try again.

http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d this link can find the dataset, but can not download in China

Oh thanks.I will try it .You can contact me for qq(934466043).

OK

SuperLuu7 commented 1 year ago

I met the same problem...This is the problem whether it is my training coco dataset or the dataset I registered myself. The return log is as follows: (solution at the end)

[04/24 16:08:31 d2.data.datasets.coco]: Loading datasets/coco/annotations/instances_train_2017_transform_slight_correct.json takes 24.22 seconds. [04/24 16:08:34 d2.data.datasets.coco]: Loaded 118287 images in COCO format from datasets/coco/annotations/instances_train_2017_transform_slight_correct.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/media/data/usr/BCNet/detectron2/engine/launch.py", line 51, in launch main_func(*args) File "tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/media/data/usr/BCNet/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/media/data/usr/BCNet/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/media/data/usr/BCNet/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/media/data/usr/BCNet/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/media/data/usr/BCNet/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/media/data/usr/BCNet/detectron2/data/catalog.py", line 61, in get return f() File "/media/data/usr/BCNet/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/media/data/usr/BCNet/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Solve this problem by modifying the code(BCNet/detectron2/data/datasets/coco.py", line 332): bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] to bo_segm = [poly for poly in bo_segm or [] if len(poly) % 2 == 0 and len(poly) >= 6]

tsnxxx commented 10 months ago

When i use the dataset created by myself, my dataset contains only one type [04/30 21:47:18 d2.data.datasets.coco]: Loaded 80 images in COCO format from datasets/cocococo/annotations/instances_train_2017.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 48, in launch daemon=False, File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn while not spawn_context.join(): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join raise Exception(msg) Exception: -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/wangguangxu/BCNet-main/tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/catalog.py", line 62, in get return f() File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Have you solved this problem?

Have you solved this problem?

tsnxxx commented 10 months ago

I met the same problem...This is the problem whether it is my training coco dataset or the dataset I registered myself. The return log is as follows: (solution at the end)

[04/24 16:08:31 d2.data.datasets.coco]: Loading datasets/coco/annotations/instances_train_2017_transform_slight_correct.json takes 24.22 seconds. [04/24 16:08:34 d2.data.datasets.coco]: Loaded 118287 images in COCO format from datasets/coco/annotations/instances_train_2017_transform_slight_correct.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/media/data/usr/BCNet/detectron2/engine/launch.py", line 51, in launch main_func(*args) File "tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/media/data/usr/BCNet/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/media/data/usr/BCNet/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/media/data/usr/BCNet/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/media/data/usr/BCNet/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/media/data/usr/BCNet/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/media/data/usr/BCNet/detectron2/data/catalog.py", line 61, in get return f() File "/media/data/usr/BCNet/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/media/data/usr/BCNet/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Solve this problem by modifying the code(BCNet/detectron2/data/datasets/coco.py", line 332): bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] to bo_segm = [poly for poly in bo_segm or [] if len(poly) % 2 == 0 and len(poly) >= 6]

Have you solved this problem?

SuperLuu7 commented 10 months ago

@tsnxxx

When i use the dataset created by myself, my dataset contains only one type [04/30 21:47:18 d2.data.datasets.coco]: Loaded 80 images in COCO format from datasets/cocococo/annotations/instances_train_2017.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 48, in launch daemon=False, File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn while not spawn_context.join(): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join raise Exception(msg) Exception: -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/wangguangxu/BCNet-main/tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/catalog.py", line 62, in get return f() File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Have you solved this problem?

Have you solved this problem?

Solve this problem by modifying the code(BCNet/detectron2/data/datasets/coco.py", line 332): bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] to bo_segm = [poly for poly in bo_segm or [] if len(poly) % 2 == 0 and len(poly) >= 6]

tsnxxx commented 10 months ago

@tsnxxx

When i use the dataset created by myself, my dataset contains only one type [04/30 21:47:18 d2.data.datasets.coco]: Loaded 80 images in COCO format from datasets/cocococo/annotations/instances_train_2017.json Traceback (most recent call last): File "tools/train_net.py", line 161, in args=(args,), File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 48, in launch daemon=False, File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 171, in spawn while not spawn_context.join(): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 118, in join raise Exception(msg) Exception: -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/wangguangxu/anaconda3/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/wangguangxu/BCNet-main/tools/train_net.py", line 143, in main trainer = Trainer(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 246, in init data_loader = self.build_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/engine/defaults.py", line 420, in build_train_loader return build_detection_train_loader(cfg) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 306, in build_detection_train_loader proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/build.py", line 226, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/catalog.py", line 62, in get return f() File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/register_coco.py", line 33, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/wwwroot/wangguangxu/BCNet-main/detectron2/data/datasets/coco.py", line 332, in load_coco_json bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] TypeError: 'NoneType' object is not iterable

Have you solved this problem?

Have you solved this problem?

Solve this problem by modifying the code(BCNet/detectron2/data/datasets/coco.py", line 332): bo_segm = [poly for poly in bo_segm if len(poly) % 2 == 0 and len(poly) >= 6] to bo_segm = [poly for poly in bo_segm or [] if len(poly) % 2 == 0 and len(poly) >= 6]

Thank you for your reply, but I still have a few questions. If it is convenient, can you tell me your email, and I would like to consult further.

tsnxxx commented 10 months ago

You can give the errors for debugging.

按照教程中的步骤,我们发现读不到图片路劲,我们在config中将图片路径改成了绝对路径,在coco.py文件中将segm = anno.get("segmentation", None)# bo_segm = anno.get("segmentation", None) #bgobject,其中尝试将bg_object_segmentation改成和segmentation一致,能跑通一点了,但是报出 -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/zhangpan/BCNet-main/tools/train_net.py", line 149, in main return trainer.train() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/defaults.py", line 373, in train super().train(self.start_iter, self.max_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 131, in train self.run_step() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 205, in run_step data = next(self._data_loader_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 139, in iter for d in self.dataset: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 40, in getitem data = self._map_func(self._dataset[cur_idx]) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/dataset_mapper.py", line 76, in call image = utils.read_image(dataset_dict["file_name"], format=self.img_format) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/detection_utils.py", line 53, in read_image with PathManager.open(file_name, "rb") as f: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 1012, in open bret = handler._open(path, mode, buffering=buffering, **kwargs) # type: ignore File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 612, in _open opener=opener, FileNotFoundError: [Errno 2] No such file or directory: '000000109450.jpg'

Have you solved this problem?

SuperLuu7 commented 10 months ago

You can give the errors for debugging.

按照教程中的步骤,我们发现读不到图片路劲,我们在config中将图片路径改成了绝对路径,在coco.py文件中将segm = anno.get("segmentation", None)# bo_segm = anno.get("segmentation", None) #bgobject,其中尝试将bg_object_segmentation改成和segmentation一致,能跑通一点了,但是报出 -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/zhangpan/BCNet-main/tools/train_net.py", line 149, in main return trainer.train() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/defaults.py", line 373, in train super().train(self.start_iter, self.max_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 131, in train self.run_step() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 205, in run_step data = next(self._data_loader_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 139, in iter for d in self.dataset: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 40, in getitem data = self._map_func(self._dataset[cur_idx]) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/dataset_mapper.py", line 76, in call image = utils.read_image(dataset_dict["file_name"], format=self.img_format) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/detection_utils.py", line 53, in read_image with PathManager.open(file_name, "rb") as f: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 1012, in open bret = handler._open(path, mode, buffering=buffering, **kwargs) # type: ignore File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 612, in _open opener=opener, FileNotFoundError: [Errno 2] No such file or directory: '000000109450.jpg'

Have you solved this problem?

You can double-check the path of the changed and the name of the image.

tsnxxx commented 10 months ago

You can give the errors for debugging.

按照教程中的步骤,我们发现读不到图片路劲,我们在config中将图片路径改成了绝对路径,在coco.py文件中将segm = anno.get("segmentation", None)# bo_segm = anno.get("segmentation", None) #bgobject,其中尝试将bg_object_segmentation改成和segmentation一致,能跑通一点了,但是报出 -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, args) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/launch.py", line 83, in _distributed_worker main_func(args) File "/wwwroot/zhangpan/BCNet-main/tools/train_net.py", line 149, in main return trainer.train() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/defaults.py", line 373, in train super().train(self.start_iter, self.max_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 131, in train self.run_step() File "/wwwroot/zhangpan/BCNet-main/detectron2/engine/train_loop.py", line 205, in run_step data = next(self._data_loader_iter) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 139, in iter for d in self.dataset: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/wwwroot/zhangpan/BCNet-main/detectron2/data/common.py", line 40, in getitem data = self._map_func(self._dataset[cur_idx]) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/dataset_mapper.py", line 76, in call image = utils.read_image(dataset_dict["file_name"], format=self.img_format) File "/wwwroot/zhangpan/BCNet-main/detectron2/data/detection_utils.py", line 53, in read_image with PathManager.open(file_name, "rb") as f: File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 1012, in open bret = handler._open(path, mode, buffering=buffering, **kwargs) # type: ignore File "/home/zhangpan/.conda/envs/bcnet/lib/python3.7/site-packages/iopath-0.1.9-py3.7.egg/iopath/common/file_io.py", line 612, in _open opener=opener, FileNotFoundError: [Errno 2] No such file or directory: '000000109450.jpg'

Have you solved this problem?

You can double-check the path of the changed and the name of the image.

I want to know whether the json file that the training reads in is instances_train2017.json or instances_train_2017_transform_slight_correct.json.