def do_training(solver, step_size, nb_step=0):
solver.step(step_size)
heat_map = solver.test_nets[0].blobs["score-final"].data[0,:,:,:].transpose(1,2,0)
heat_map_normalize = normalize_heatmap(heat_map)
# heat_map_normalize = heat_map
minimum = np.min(heat_map[:,:,0])
nb_subplot = 4
plt.figure(figsize=(10,10))
image_test = solver.test_nets[0].blobs["data"].data[0,0,:,:]
image_test_label = solver.test_nets[0].blobs["label"].data[0,0,:,:]
plt.subplot(1,nb_subplot,1)
plt.imshow(image_test)
plt.title("image test")
plt.subplot(1,nb_subplot,2)
plt.imshow(image_test_label)
plt.title("Label of the test image")
plt.subplot(1,nb_subplot,3)
plt.imshow(np.append(heat_map_normalize, np.zeros((heat_map_normalize.shape[0], heat_map_normalize.shape[1],1)), 2))
plt.title("Heat map")
# plt.subplot(1,nb_subplot,4)
# plt.imshow(np.append(heat_map_normalize, np.zeros(heat_map_normalize.shape[0], heat_map_normalize.shape[1],1), 3))
# plt.title("score")
plt.subplot(1,nb_subplot,4)
plt.imshow(solver.test_nets[0].blobs["score-final"].data[0,:,:,:].transpose(1,2,0).argmax(2), vmin=0, vmax=1)
plt.title("After : " + str(nb_step+step_size) + " itterations")
display.display(plt.gcf())
display.clear_output(wait=True)
time.sleep(1)
###
# save_image : place where to save the image
###
utils_dataRV.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录