I could do that but I have already trained a model on a custom dataset using Detecto, so I wanted to use that model. Anyway, thanks Thomas for clearing this out. Next time, I will just use an existing pytorch model to avoid this kind of problem.