infer_group_from_folder

Function infer_group_from_folder 

Source
pub fn infer_group_from_folder(image_path: &str) -> Option<String>
Expand description

Infer the group name from an image folder path.

Extracts the group from folder names like “train2017”, “val2017”, “test2017”. Strips trailing year numbers to get the group name.

§Examples

  • train2017/000000001.jpg → “train”
  • val2017/000000002.jpg → “val”
  • test2017/000000003.jpg → “test”
  • custom_split/image.jpg → “custom_split”

§Arguments

  • image_path - Relative path to the image (e.g., “train2017/000000001.jpg”)

§Returns

Inferred group name, or None if no folder component is found.