For inference, I’d like to grab the nth image from a folder (say the first image), but when I do this:
images = path/"images"
#images.ls()
nth_image = images[0]
#img = PILImage.create(nth_image)
#learn.predict(img)
I get the following error:
TypeError: 'PosixPath' object does not support indexing
Is there a quick and easy way to effectively ‘index’ into this path (without literally indexing as it appears to be unsupported)?
UPDATE:
The solution (for anybody else searching for the same thing) is to use the get_image_files
function like so:
images = path/"images"
items = get_image_files(images)
img = items[0]
img = PILImage.create(img)
learn.predict(img)