我对分割主题中不同批次的绘图输出有疑问和疑问。
下面的代码片段绘制了每个类的概率和预测输出。
我确信概率图正在绘制一批,但不确定当我得到 torch.argmax(outputs, 1) 时的预测。我是否绘制了一批的 argmax,而网络的输出大小为 [10,4,256,256]。
另外,我想知道如何在批量大小为 10 时绘制所有批次的预测。
outputs = model(t_image)
fig, (ax1, ax2, ax3, ax4, ax5) = plt.subplots(nrows=1, ncols=5, sharex=True, sharey=True, figsize=(6,6))
img1 = ax1.imshow(torch.exp(outputs[0,0,:,:]).detach().cpu(), cmap = 'jet')
ax1.set_title("prob class 0")
img2 = ax2.imshow(torch.exp(outputs[0,1,:,:]).detach().cpu(), cmap = 'jet')
ax2.set_title("prob class 1")
img3 = ax3.imshow(torch.exp(outputs[0,2,:,:]).detach().cpu(), cmap = 'jet')
ax3.set_title("prob class 2")
img4 = ax4.imshow(torch.exp(outputs[0,3,:,:]).detach().cpu(), cmap = 'jet')
ax4.set_title("prob class 3")
img5 = ax5.imshow(torch.argmax(outputs, 1).detach().cpu().squeeze(), cmap = 'jet')
ax5.set_title("predicted")