def plot_overlay(image_id):
img = load_image(image_id)
fig, ax = plt.subplots()
xmax = grid_sizes.loc[image_id, 'xmax']
ymin = grid_sizes.loc[image_id, 'ymin']
ax.imshow(np.rollaxis(img, 0, 3))
# plotting, color by class type
for cls in xrange(10):
multi_poly = shapely.wkt.loads(train_wkt.loc[(train_wkt['cls'] == cls + 1) & (train_wkt['image_id'] == image_id), 'multi_poly_wkt'].values[0])
for poly in multi_poly:
coords = convert_geo_coords_to_raster(np.array(poly.exterior), img.shape[1:], (xmax, ymin))
ax.add_patch(Polygon(coords, color=cls_colors[cls], lw=1.0, alpha=cls_alphas[cls]))
plt.title(image_id)
plt.show()
plot-train.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录