SHI-Labs / OneFormer

OneFormer: One Transformer to Rule Universal Image Segmentation, arxiv 2022 / CVPR 2023
https://praeclarumjj3.github.io/oneformer
MIT License
1.41k stars 128 forks source link

no images found in image directory! #34

Closed sahityabonumaddi closed 1 year ago

sahityabonumaddi commented 1 year ago

Greetings, I have followed your installation steps, dataset preparation steps as it is. I have an issue that it is showing images are not in the directory even though images are in it. Any help would be great. Thanks in advance.

03/20 15:44:27 oneformer.data.dataset_mappers.oneformer_unified_dataset_mapper]: [OneFormerUnifiedDatasetMapper] Augmentations used in training: [ResizeShortestEdge(short_edge_length=..., max_size=2560, sample_style='choice'), RandomCrop_CategoryAreaConstraint(crop_type='absolute', crop_size=[640, 640], single_category_max_area=1.0, ignored_category=255), <detectron2.projects.point_rend.color_augmentation.ColorAugSSDTransform object at 0x7f05844cbca0>, RandomFlip()] Traceback (most recent call last): File "train_net.py", line 435, in launch( File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch main_func(args) File "train_net.py", line 423, in main trainer = Trainer(cfg) File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 378, in init data_loader = self.build_train_loader(cfg) File "train_net.py", line 162, in build_train_loader return build_detection_train_loader(cfg, mapper=mapper) File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/config/config.py", line 207, in wrapped explicit_args = _get_args_from_config(from_config, args, *kwargs) File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/config/config.py", line 245, in _get_args_from_config ret = from_config_func(args, **kwargs) File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/data/build.py", line 337, in _train_loader_from_config dataset = get_detection_dataset_dicts( File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/data/build.py", line 240, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/data/build.py", line 240, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/home/iit29/anaconda3/envs/oneformer/lib/python3.8/site-packages/detectron2/data/catalog.py", line 58, in get return f() File "/home/iit29/Desktop/OneFormer/oneformer/data/datasets/register_ade20k_panoptic.py", line 295, in lambda: load_ade20k_panoptic_json( File "/home/iit29/Desktop/OneFormer/oneformer/data/datasets/register_ade20k_panoptic.py", line 267, in load_ade20k_panoptic_json assert len(ret), f"No images found in {image_dir}!" AssertionError: No images found in /home/iit29/Desktop/OneFormer/datasets/ADEChallengeData2016/ADEChallengeData2016/images/training! wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing. wandb:

Any help would be great, thanks in advance!

praeclarumjj3 commented 1 year ago

Hi @sahityabonumaddi, thanks for your interest in our work.

What value did you set for the DETECTRON2_DATASETS attribute?

AssertionError: No images found in /home/iit29/Desktop/OneFormer/datasets/ADEChallengeData2016/ADEChallengeData2016/images/training!

From the error log, it seems to me that you ran export DETECTRON2_DATASETS=datasets/ADEChallengeData2016. You need to run export DETECTRON2_DATASETS=datasets/.

sahityabonumaddi commented 1 year ago

iit29@iit29-System-Product-Name:~$ export DETECTRON2_DATASETS=/home/iit29/Desktop/OneFormer/datasets/

iit29@iit29-System-Product-Name:~$ echo $DETECTRON2_DATASETS /home/iit29/Desktop/OneFormer/datasets/

assert len(ret), f"No images found in {image_dir}!" AssertionError: No images found in /home/iit29/Desktop/OneFormer/datasets/ADEChallengeData2016/images/training! wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing. wandb:
wandb: Synced ade20k_swin_large_oneformer_swin_large_bs16_160k.yaml: https://wandb.ai/saisahitya/OneFormer/runs/2dnlnyd0 wandb: Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s) wandb: Find logs at: ./wandb/run-20230320_193332-2dnlnyd0/logs

(oneformer) iit29@iit29-System-Product-Name:~/Desktop/OneFormer$ echo $DETECTRON2_DATASETS /home/iit29/Desktop/OneFormer/datasets/

Thanks for the reply , I have set the path as per instructions, still, error persists, Any help will be appreciated.

praeclarumjj3 commented 1 year ago

Could you try navigating to the images folder? If the folder doesn't exist, you must have missed a dataset preparation step. cd /home/iit29/Desktop/OneFormer/datasets/ADEChallengeData2016/images/training

You did follow the dataset preparation instructions for ADE20K, right?

sahityabonumaddi commented 1 year ago

(oneformer) iit29@iit29-System-Product-Name:~/Desktop/OneFormer/datasets/ADEChallengeData2016/images/training$

The path exists and images in the specified folder also exists. yes I followed https://github.com/SHI-Labs/OneFormer/tree/main/datasets#expected-dataset-structure-for-ade20k right. I have no idea why I'm getting this error, any help would be appreciated!

praeclarumjj3 commented 1 year ago

Hi @sahityabonumaddi, this is very strange. I am not sure what could be wrong other than the dataset structure. Could you see if there's something wrong with the loop while registering the dataset? The JSON file ADEChallengeData2016/ade20k_panoptic_train.json should have annotations. From your error, it seems the loop is not being executed.

https://github.com/SHI-Labs/OneFormer/blob/761189909f392a110a4ead574d85ed3a17fbc8a7/oneformer/data/datasets/register_ade20k_panoptic.py#L245-L268

sahityabonumaddi commented 1 year ago

You are absolutely right, I have re-downloaded dataset and followed your steps again, now it is reading images. Many thanks!