You are currently viewing Mask-RCNN Tutorial for Object Detection on Image and Video
Mask-RCNN Tutorial for Object Detection on Image and Video

Mask-RCNN Tutorial for Object Detection on Image and Video

Loading

To understand Mask-RCNN clearly, we will need to understand its background, evolution and its importance. Also as a developer, I know value of time so I will not like to go through very details of its background and all that. We will cover only main points so that in very less time you will be able to understand that “What is Mask-RCNN and how to run it”.

In this article series we will discuss on these point’s of Mask RCNN.

1. What is Image Segmantation
2. Introduction of Mask RCNN
3. Run pre-trained Mask RCNN on Image
4. Run pre-trained Mask RCNN on Video
5. Train Mask RCNN model on Custom dataset
6. Test custom trained Mask RCNN model

We will discuss 1 to 4 points on this article and next two points will be discussed on next linked tutorial. Lets start without wasting of time.

1. What is Image Segmentation:

Firstly we will understand what is Segmentation. Segmentation is a process to separate meaningful individual object from a given View, Image, Frame etc. In same manner Image Segmentation is a process of Computer Vision in which we make separation of each object from given image. We got individual label and exact position of each object with the help of image segmentation. Due to this process, it became easy to analyze the characteristic and behavior of image.

In technical terms, we provide label to a set of pixels having same type of behaviour. In this fast AI era, analysis over image became very important part. And in same manner image segmentation provide us a solution to analyse the image more clearly.

There are many applications of image segmentation, some of them are listed below:

– Content based image retrieval
– Object detection
– Object localisation
– Object Recognition
– E-surveillance
– Medical diagnosis and surgery planning/Simulation and many more.

In sort, we can say that in computer vision for pattern classification we can use it very frequently but it also depend upon requirement of use-cases.

2. Introduction of Mask-RCNN:

Mask-RCNN is an approach of computer vision for object detection as well as instance segmentation with providing masked and box co-ordinate. This is extend version of Faster-RCNN which provide pixel-to-pixel classification. It provides masked segmentation parallel to bounding box recognition like Faster-RCNN.

Drawback of Mask-RCCN:

Also due to adding mask on Faster-RCNN, it become slow to make prediction. It run at most 5FPS which is very slow for real-time object processing but according to use case and image pre-processing you can increase its speed.

Also there are many CNN model so it make a little bit confusing to understand. So in sort i will mention all CNN model evolution.

Evolution of CNN models:

A) CNN (Convolution Neural Network)
B) R-CNN (Region Convolution Neural Network)
C) Fast R-CNN (Fast Region Convolution Neural Network)
D) Faster R-CNN (Faster Region Convolution Neural Network)
E) Mask R-CNN (Masked Region Convolution Neural Network)

3. Run pre-trained Mask-RCNN on Image

In this part we will run predefined Mask-RCNN model and test on image. Please follow these steps to run this model on image.

Steps:

1. Download Mask-RCNN GitHub repository by typing command in terminal.
<pre>git clone https://github.com/matterport/Mask_RCNN.git</pre>

2. Create virtual environment if you want to make separate environment. If you have not go through previous article then click here to get steps to create virtual environment.

3. Goto Mask-RCNN directory by
<pre>cd <Mask RCNN directory></pre>

4. Install all dependencies of Mask-RCNN
<pre>pip3 install -r requirements.txt</pre>

5. Install Mask RCNN
<pre>sudo python3 setup.py install</pre>

6. Download Mask-RCNN model from here

7. Install pycocotools from this GitHub directory
https://github.com/waleedka/coco

8. Run Jupyter notebook
<pre>jupyter notebook</pre>

9. open sample/demo.ipynb for image object prediction and run it.

4. Run pre-trained Mask-RCNN on Video

To run Mask-RCNN on video, get this file and change the path video file at line number

run this from <Mask Rcnn Directiry>/sample
python3 DemoVideo.py

In next Article we will learn to train custom Mask-RCNN Model from Scratch.

Also Read:

Tensorflow Object detection API Tutorial using Python

This Post Has 2 Comments

  1. cnn us video

    Howdy! I simply wish to give an enormous thumbs up for the great info you will have right here on this post. I can be coming again to your blog for more soon.

    1. AISangam

      Thanks, We will try to provide the latest technology update.

Leave a Reply