update training and testing codes