Imported from https://github.com/Feynman27/pytorch-detect-to-track