How to convert image dataset folder to csv format for face recognition

how to convert image folders to csv format
the paths
image/john/1.jpg , 2.jpg , 3.jpg … 10.jpg
image/katy/1.jpg , 2.jpg , 3.jpg … 10.jpg
image/jim/1.jpg , 2.jpg , 3.jpg … 10.jpg
image/andrew/1.jpg , 2.jpg , 3.jpg … 10.jpg
and so on
i want to make image dataset for recognizing faces , i have 400 images , each 10 images identified one person (one label)

thanks
regards …

Use os.walk() to traverse your main folder, then write for each image 1 line containing the image path (you can choose absolute or relative, depending on your approach and preferences) followed by the target label.

Don’t forget the CSV header, so you can use Pandas for example to load the file directly in a practical database.