Diagnostic stroke imaging with C-arm cone-beam computed tomography (CBCT)enables reduction of time-to-therapy for endovascular procedures. However, theprolonged acquisition time compared to helical CT increases the likelihood ofrigid patient motion. Rigid motion corrupts the geometry alignment assumedduring reconstruction, resulting in image blurring or streaking artifacts. Toreestablish the geometry, we estimate the motion trajectory by an autofocusmethod guided by a neural network, which was trained to regress thereprojection error, based on the image information of a reconstructed slice.The network was trained with CBCT scans from 19 patients and evaluated using anadditional test patient. It adapts well to unseen motion amplitudes andachieves superior results in a motion estimation benchmark compared to thecommonly used entropy-based method.