If we plot the data it looks like the below
Encoder and Decoder is the common Convolution model for Image segmentation
Plot predictions vs truth
num_samples = 20
fig = plt.figure(figsize=(10, 2*num_samples))
for i in range(0, 4*num_samples, 4):
segment_pred = model.predict(np.array([X_test[i,...]]))
ax = fig.add_subplot(num_samples, 4, i+1, xticks=[], yticks=[])
segment_truth = y_test[i,:].reshape(im_size, im_size, 2)[:,:,1]
ax.imshow(X_test[i,:].reshape(im_size, im_size, 3), interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+2, xticks=[], yticks=[])
ax.imshow(segment_truth, interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+3, xticks=[], yticks=[])
ax.imshow(segment_pred.reshape(im_size, im_size, 2)[:,:,1], interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+4, xticks=[], yticks=[])
binary_pred = segment_pred.reshape(im_size, im_size, 2)[:,:,1] > 0.5
ax.imshow(binary_pred, interpolation='nearest')
binary_pred_flat = binary_pred.reshape(im_size* im_size)
segment_truth_flat = segment_truth.reshape(im_size* im_size)
intersection = np.sum((binary_pred_flat + segment_truth_flat == 2.0))
union = np.sum(np.clip((binary_pred_flat + segment_truth_flat), 0.0, 1.0))
iou = intersection/union
ax.set_title('IOU = {}'.format(iou))
plt.show()
1st column- Original flower
2nd column --Target/Ground truth
3rd column represents Our network predicted
4th column Threshold prediction with IOU
Reference link:
http://www.robots.ox.ac.uk/~vgg/data/flowers/17/
Encoder and Decoder is the common Convolution model for Image segmentation
How Do We Evaluate Semantic Segmentation Models?
- Intersection Over Union (IOU)
- IOU is a robust measure of segmentation accuracy
Plot predictions vs truth
num_samples = 20
fig = plt.figure(figsize=(10, 2*num_samples))
for i in range(0, 4*num_samples, 4):
segment_pred = model.predict(np.array([X_test[i,...]]))
ax = fig.add_subplot(num_samples, 4, i+1, xticks=[], yticks=[])
segment_truth = y_test[i,:].reshape(im_size, im_size, 2)[:,:,1]
ax.imshow(X_test[i,:].reshape(im_size, im_size, 3), interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+2, xticks=[], yticks=[])
ax.imshow(segment_truth, interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+3, xticks=[], yticks=[])
ax.imshow(segment_pred.reshape(im_size, im_size, 2)[:,:,1], interpolation='nearest')
ax = fig.add_subplot(num_samples, 4, i+4, xticks=[], yticks=[])
binary_pred = segment_pred.reshape(im_size, im_size, 2)[:,:,1] > 0.5
ax.imshow(binary_pred, interpolation='nearest')
binary_pred_flat = binary_pred.reshape(im_size* im_size)
segment_truth_flat = segment_truth.reshape(im_size* im_size)
intersection = np.sum((binary_pred_flat + segment_truth_flat == 2.0))
union = np.sum(np.clip((binary_pred_flat + segment_truth_flat), 0.0, 1.0))
iou = intersection/union
ax.set_title('IOU = {}'.format(iou))
plt.show()
1st column- Original flower
2nd column --Target/Ground truth
3rd column represents Our network predicted
4th column Threshold prediction with IOU
Reference link:
http://www.robots.ox.ac.uk/~vgg/data/flowers/17/
No comments:
Post a Comment