workflow to group ai-gen images into 'people'

hi i only started running models yesterday so forgive me if i'm asking stupid questions.

i'm making a videogame mod, and used stable-diffusion to create images of non-existent people.

often there are loads of images which could plausibly be the same person - i want to gather these together using another ml workflow.

ie i feed a folder full of images in, and i get a number of folders back, each containing images of a single 'person'.

i'd like to choose between 1) defining how many distinct people there are, and 2) set a 'similarity' threshold and let the machine decide how many people there are.

i think this is a relatively simple task, but don't know how to proceed. so far all i've really done is use python to access some chatAPIs, and SwarmUI to run some diffusion models, i have no idea about more advance workflows. i saw comfyUI but honestly it looked like a complicated platform to learn, although possibly suited to this task?

thanks for any help!

PS windows update bricked my laptop into some weird can't reinstall OS state. got annoyed trying to sort it out and gave up and installed ubuntu. im relatively comfortable with linux, and i have a desktop running windows, but am i going to hit ml brick walls with linux or (i suspect) is it actually better?