PeizeSun / SparseR-CNN

[CVPR2021, PAMI2023] End-to-End Object Detection with Learnable Proposal
MIT License
1.32k stars 187 forks source link

"Dataset 'CrowdHuman_train' is not registered #107

Open Aliweka2020 opened 2 years ago

Aliweka2020 commented 2 years ago

Can't train on CrowdHuman dataset? Is CrowdHuman still not available on detectron 2 ...?

image

Aliweka2020 commented 2 years ago

when I adopted the CrowdHuman evaluator file from NOH-NMS project https://github.com/TencentYoutuResearch/PedestrianDetection-NohNMS

I got this error

Converting dataset dicts into COCO format 4370it [01:39, 43.94it/s] outside num: 1976, clip num: 0 json dump falied in crowdhuman convert processing. Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:00) [MSC v.1929 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

Yamahhh commented 2 years ago

I tried the same work,I used "register_crowdhuman_instances" in train_net.py, that func from ./detectron2/data/datasets/crowdhuman.py .But I got this error

Traceback (most recent call last): File "/home/cyl/.conda/envs/sparse/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap fn(i, args) File "/data/cyl/SparseR-CNN-main/detectron2/engine/launch.py", line 95, in _distributed_worker main_func(args) File "/data/cyl/SparseR-CNN-main/projects/SparseRCNN/train_net.py", line 171, in main trainer = Trainer(cfg) File "/data/cyl/SparseR-CNN-main/detectron2/engine/defaults.py", line 284, in init data_loader = self.build_train_loader(cfg) File "/data/cyl/SparseR-CNN-main/projects/SparseRCNN/train_net.py", line 54, in build_train_loader return build_detection_train_loader(cfg, mapper=mapper) File "/data/cyl/SparseR-CNN-main/detectron2/config/config.py", line 201, in wrapped explicit_args = _get_args_from_config(from_config, *args, *kwargs) File "/data/cyl/SparseR-CNN-main/detectron2/config/config.py", line 236, in _get_args_from_config ret = from_config_func(args, kwargs) File "/data/cyl/SparseR-CNN-main/detectron2/data/build.py", line 309, in _train_loader_from_config proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/data/cyl/SparseR-CNN-main/detectron2/data/build.py", line 222, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/data/cyl/SparseR-CNN-main/detectron2/data/build.py", line 222, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/data/cyl/SparseR-CNN-main/detectron2/data/catalog.py", line 58, in get return f() File "/data/cyl/SparseR-CNN-main/detectron2/data/datasets/crowdhuman.py", line 221, in DatasetCatalog.register(name, lambda: load_crowdhuman_json(json_file, image_root, name)) File "/data/cyl/SparseR-CNN-main/detectron2/data/datasets/crowdhuman.py", line 58, in load_crowdhuman_json coco_api = COCO(json_file) File "/home/cyl/.conda/envs/sparse/lib/python3.6/site-packages/pycocotools/coco.py", line 82, in init dataset = json.load(f) File "/home/cyl/.conda/envs/sparse/lib/python3.6/json/init.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, kw) File "/home/cyl/.conda/envs/sparse/lib/python3.6/json/init.py", line 354, in loads return _default_decoder.decode(s) File "/home/cyl/.conda/envs/sparse/lib/python3.6/json/decoder.py", line 342, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1379)

I tried use json.loads(f) instead of json.load(f), but it doesn't seem to work

Czs99 commented 1 year ago

@Yamahhh May I ask where the tutorial mentioned the position to add codes: """from detectron2.data.datasets import register_coco_instances register_coco_instances("my_dataset", {}, "json_annotation.json", "path/to/image/dir")""" ? I found it's the train_net.py file when I saw your reply and solve my custom coco format data set unregistered error,thanks a lot!