A method is for training a convolutional neural network of a compensation unit. The method includes: provisioning a machine learning device, the machine learning device being designed for training the convolutional neural network; provisioning a start compensation unit, including an untrained convolutional neural network, on or at the machine learning device; provisioning a training image dataset including a plurality of medical training input images and at least one training output image, wherein a reference object is shown essentially without motion artifacts in the at least one training output image and the reference object concerned is contained in the plurality of medical training input images with different motion artifacts; and training the convolutional neural network of the compensation unit in accordance with a principle of machine learning, using the training image dataset. A compensation unit, a machine learning device, a control device for controlling a medical imaging system are also disclosed.