I am kind of new to Pavlovia as well, so mine is only a suggestion:
For images there is the way to change units. for example from pixel to something else, try to play around with that. Check this topic: Psychojs reference questions: Units, TextStim clarity, and element visibility
Concerning “trainFile”, probably you need to tell us how you are calling that variable. What is your code?