Вот мой текущий код:
Код: Выделить всё
full_list = []
temp = []
recon_temp = np.zeros_like(test_image_padded)
x=520
y=210
region = (slice(x-10, x+20), slice(y-10, y+20))
recon_temp[x, y] = 2
plt.imshow(test_image_padded[region], cmap = "gray", alpha=0.5)
plt.imshow(recon_temp[region], alpha=0.5)
#plt.imshow(recon_temp[x-1:x+1, y-1:y+1])
#plt.imshow(test_image_padded[region], cmap = "gray", alpha=0.5)
plt.axis("off")
plt.show()
for i in range(0,6):#(len(all_indices)):
test_ind = all_indices[i]
#test_ind = runn_cent[i]
test_pred = all_pred[i]
for j in range(len(test_ind)):
x = test_ind[j][0].item()
y = test_ind[j][1].item()
if recon_temp[x,y] == 0:
recon_temp[x, y] = 1
full_list.append(recon_temp)
plt.imshow(test_image_padded[region], cmap = "gray")
plt.imshow(recon_temp[region] , alpha=0.5)
#plt.axis("off")
plt.show()
#plt.savefig(f"rl{i}")
recon_temp[recon_temp>0]=2
Подробнее здесь: https://stackoverflow.com/questions/783 ... -in-python