i think its the *.dat files on the root of the device
as seen when connecting in msc mode (you won’t see them in MTP mode)
sounds weird and i havn’t put that many pics on mine so i dunno what to suggest
other than what you already thought of (reset/delete the database)
good luck