0

Code snippet giving the error:

for i in range(masks.shape[0]):
    imsave(os.path.join(PATH_TO_SAVE, f"prediction_{(i+1):04d}"), masks[i])

Error message:

"ValueError: Could not find a backend to open `my_path` with iomode `wi`"
Phantom
  • 71
  • 4

1 Answers1

0

In the filename of the imsave argument, you have to mention the image type, for example, bmp or tiff

Corrected code snippet:

for i in range(masks.shape[0]):
    imsave(os.path.join(PATH_TO_SAVE, f"prediction_{(i+1):04d}.bmp"), masks[i])enter code here
Phantom
  • 71
  • 4
  • 1
    ImageIO needs to know the format you want to save in, as there are many potential candidates. One way to provide this info is to give your output file a common extension (e.g. `some_file.bmp`). Another (in v3) is to pass `extension=".bmp"` kwarg. – FirefoxMetzger Feb 21 '23 at 17:37