I had a huge iPhoto library where all image titles were set by naming the files before import. None of these titles were migrated to Photos.
I solved the problem with a different approach. I dug into the database files of iPhoto and Photos. They have a relation called RKVersion which stores all information about images, including name, file name and UUID. In iPhoto, all versions have a name attribute, but after the Photos migration, only a few of my images had them. According to an Apple support article, https://support.apple.com/en-us/HT204478 , only user-defined titles are migrated. That information seems to be correct, since the very few titles that were migrated for me, were ones I had set in iPhoto instead of by naming the files. I tried to find any sort of "user-defined title" attribute in the iPhoto database, but without any luck. Maybe someone else can find it and if so, that attribute probably just needs to be set to True for all images before the iPhoto library is migrated and then all image titles will be migrated - including those that are equal to the file name.
Anyhow, I wrote a Python script that goes through the databases of the old and new libraries and tries to find matching UUIDs. Where it does, it copies over the image title from the old to the new. Unfortunately, many UUIDs are changed in the migration, so for me it only found matches for 37 % of the images. Therefore, I added a function to the script that sets all remaining titles in the new library based on file names. All file extensions are excluded and titles are only created if current titles are empty. The script also lets you run only one of the two functions if you want. The script took just a couple of seconds to add titles to 15 000 of my images.
The script makes a backup of both databases before running. I have tested it but not thoroughly, so proceed with caution. Feel free to expand it or improve it. And please respond if you find a way to mark titles as user-defined in the iPhoto database, since that would be the real solution instead of this workaround.
----------
PhotosTitleSetter
Migrates image titles from an iPhoto library to a Photos library. Can set titles based on file names if no old titles are found.
Instructions:
Make sure to quit both iPhoto and Photos
Download the PhotosTitleSetter.py script from: https://github.com/Rajje/PhotosTitleSetter
Open a new Terminal window
Type "python " including the space at the end
Drag the script to the Terminal window and then press the return or enter key
The script will run and display further instructions
ALWAYS have several backups of any important files. Make especially sure to back up both photo libraries before running this script. The author of this script takes no responsibility for any damage on any files or for any of the actions of this script.