JPMAX: Learning to Recognize Moving Objects as a Model-fitting Problem