├── 71.jpeg ├── output.png ├── README.md └── tester.py /71.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noman55/ImageSegmentation_AI/HEAD/71.jpeg -------------------------------------------------------------------------------- /output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noman55/ImageSegmentation_AI/HEAD/output.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutonomousCar 2 | 3 | Here we are trying to use the famous technique called Semantic Segmentation. I have alredy trained the model using Fully Conneted 4 | Convolution Network on Pascal VOC dataset which you can download from cityscapes official website. 5 | 6 | Here is the input image given to modal 7 | 8 | ![](71.jpeg) 9 | 10 | and here is the result 11 | 12 | ![](output.png) 13 | 14 | since the size of the trained model is >100MB i have not uploaded. 15 | 16 | -------------------------------------------------------------------------------- /tester.py: -------------------------------------------------------------------------------- 1 | 2 | import mxnet as mx 3 | from mxnet import image 4 | from mxnet.gluon.data.vision import transforms 5 | import gluoncv 6 | import cv2 7 | # using cpu 8 | ctx = mx.cpu(0) 9 | 10 | filename= '71.jpeg' 11 | # load the image 12 | img = image.imread(filename) 13 | 14 | from matplotlib import pyplot as plt 15 | #plt.imshow(img.asnumpy()) 16 | #plt.show() 17 | from gluoncv.data.transforms.presets.segmentation import test_transform 18 | img = test_transform(img, ctx) 19 | # get pre-trained model 20 | model = gluoncv.model_zoo.get_model('fcn_resnet101_voc', pretrained=True) 21 | output = model.predict(img) 22 | predict = mx.nd.squeeze(mx.nd.argmax(output, 1)).asnumpy() 23 | from gluoncv.utils.viz import get_color_pallete 24 | import matplotlib.image as mpimg 25 | mask = get_color_pallete(predict, 'pascal_voc') 26 | mask.save('output.png') 27 | --------------------------------------------------------------------------------