Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Prevent passed
ann_file
from silently failing to load (#2966
) ## 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: 谢昕辰 <[email protected]> Co-authored-by: CSH <[email protected]>
- Loading branch information