i += 1 #saving model torch.save(cn.state_dict(), model_save_path) print('обучение закончено') cn = ConvNet(num_classes) cn.load_state_dict(torch.load(model_save_path)) batch = next(iter(signsValidationLoader)) predictions = cn(batch['image']) y_test = batch['label'] #print(predictions, y_test) _, predictions = torch.max(predictions, 1) plt.imshow(PIL.ToPIL(batch['image'][0])) print('Gound-true:', dataset.labels[batch['label'][0]]) print('Prediction:', dataset.labels[predictions[0]]) #####Кривые обучения def smooth_curve(points, factor=0.9): smoothed_points = [] for point in points: if smoothed_points: previous = smoothed_points[-1] smoothed_points.append(previous * factor + point * (1 - factor)) else: smoothed_points.append(point) return smoothed_points