Well, so the logic of these function might have problem. The preprocess_image function is used to deal with a specific image, but you introduced some vm related code in it, which breaks the independence of preprocess_image and preprocess_vm.