vendredi 20 janvier 2023

Opening Five Random Images From a File - Python

I am coding a Convolutional Neural Network that identifies Brown Tail Moth nests in trees. For the first part of my program, I want to import the image file with all of the pictures of the trees and pick five random images from that folder (just to see if it actually has the right folder with the images). However, when I click "run", it shows an error:

Traceback (most recent call last): File "C:\Users\eumel\AppData\Roaming\JetBrains\PyCharmCE2021.2\scratches\Final.py", line 20, in image = random.choice(os.listdir(test_folder)) NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\Users\eumel\Downloads\Photos-001 (4).zip'

I'm not sure if I have the code right for this, but I don't know how to fix it and have it show the images.

Can anyone help?




Aucun commentaire:

Enregistrer un commentaire