PosixPath error when trying to create an ObjectCategoryList from_folder

I’m trying to import some data for detecting features. I’ve written a function called get_bbox to convert filenames to ImageBBoxs and it seems to be working well. When I try to import all the data I get the error TypeError: 'PosixPath' object does not support indexing. The lines of code in the error all seem to point to parts of the fast AI library.

data = (ObjectCategoryList.from_folder(path)
    .filter_by_folder('images')
    .split_by_rand_pct(0.2)
    .label_from_func(get_bbox)
    .transform(get_transforms(), tfm_y=True)
    .databunch().normalize(imagenet_stats)
   )

Things I’ve tried:

  • Rewriting get_bbox to not use posix paths at all
  • Shortcircuiting get_bbox so it isn’t called
  • reading through the fastai library code to try to understand what is going on.

Does anyone have any other ideas?