If you use macOS, you can use Apple Photos (with its client-side image recognition) without using iCloud for storage. Just put your Photo Library bundle-directory on a NAS instead, and then either sync it to your local machine, or work with it over SMB.
(Or, for optimal performance, the hybrid solution: put the library in a sparsebundle disk image, put that on the NAS, and then mount the disk image over SMB. This is what Time Machine does under the covers, because it vastly improves the overhead of filesystem operations over directly manipulating the files in SMB.)