def save_goal_image(self, traj):
rounded = np.around(traj.score, decimals=2)
best_score = np.min(rounded)
for i in range(traj.score.shape[0]):
if rounded[i] == best_score:
first_best_index = i
break
print 'best_score', best_score
print 'allscores', traj.score
print 'goal index: ', first_best_index
goalimage = traj._sample_images[first_best_index]
# goalstate = traj.X_Xdot_full[i]
img = Image.fromarray(goalimage)
cPickle.dump([], open(self._hyperparams['save_goal_image'] + '.pkl', 'wb'))
img.save(self._hyperparams['save_goal_image'] + '.png',)
评论列表
文章目录