Using an error function like np.sum((a-b)**2). Where you sum up the squares of the differences. You can compare images, a resp b. Since in digital form they are represented by a matrix a, b with color values between 0 to 255 for each red, green or blue pixel.
So if we make it simple. Just turn the images into gray scale and resize all images to copies of some small enough shape. Then you can just make a for loop with the error function and you get a number from 0 to large. Zero then represents perfect copy and large a different image.
One idea is to make such a program on the smart phone using termux for android and installing python, numpy and ski-image for resize. The reason would be to group together images that look the same into separate group folders. Since you like me probably take images of the same object many times.
Be sure to backup your images. Or better yet. Perform the action on them on your computer. You can copy the photos with some wifi transfer program.