mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
## Motivation While customizing the number of samples using `ann_file` for Cityscapes, I noticed that when the `ann_file` name is incorrect, it will silently resort to loading the dataset from the directory. I think when the user intends to load using `ann_file`, it should not silently fail, but give some sort of error message or warning. ## Modification I added assertion to check whether the `ann_file` exists instead of silently resorting to loading from the directory. Since `ann_file` is set to `''` by default and joined with `self.data_root`, I used `osp.isdir` to first check if `self.ann_dir` is a directory or text file. ## BC-breaking (Optional) Not that I am aware of. ## Use cases (Optional) If this PR introduces a new feature, it is better to list some use cases here, and update the documentation. --------- Co-authored-by: 谢昕辰 <xiexinch@outlook.com> Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>