How to Run Mask R-CNN with Pytorch using the GPU on the Ubuntu

How to Run Mask R-CNN with Pytorch using the GPU on the Ubuntu

In this tutorial we are going to see how to run the Mask R-CNN algorythm using the GPU on the Ubuntu os system.

System requirements:
  • OS Linux Ubuntu 18.04 (it might work with earlier versions as well, but I don’t guarantee that)

  • Nvidia GPU with CUDA support.
    Click here to see the list with all the GPUs which support cuda.

What is Mask R-CNN?

Mask R-CNN is a Convolutional Neural Network used in Computer vision which is able to perform Object Detection and Istance segmentation.

To describe in simple words how this algorythm works, we can divide it into three stages:

  • On the 1st stage there is a RPN (Region Proposal Network) which proposes the Regions where objects could be. This method is really useful to discard some areas and so to reduce the computetional requirements later on for the object detection.

  • On the 2nd stage these regions are passed through a Convolutional Neural Network which detects to what category the object belongs.

  • On the 3rd stage for each Object detected, is also created a Mask which exactly identifies the location of the object, so that we can have clear boundaries of the objects (not simple boxes).

How to Run Mask R-CNN on Ubuntu

Let’s now see the instructions about how to run this algorythm on Ubuntu. Let me clarify first that there is not only one way to do that, but there are many ways.

The Mask R-CNN algorythm to run needs a deep learning framework. At the moment the most common deep learning frameworks are: tensorflow, pytorch and keras. For each of them there is an implementation of the algorythm.

I choosed for this article to run it on the Pytorch framework.
For a different framework, you need of course a different implementation of the algorythm.

This is the github repository of the code we’re going to use: https://github.com/facebookresearch/maskrcnn-benchmark

Let’s now proceed with the installation.

1. Install Anaconda

1 - Get the download link of the lastest version of Anaconda here: https://www.anaconda.com/distribution/
2 - Then on the terminal type:

wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh


(You have to change the link with your link for the lastest version).
Then after the download is finish you can proceed with the installation.

sudo bash Anaconda3-2019.10-Linux-x86_64.sh


3 - Press enter until you see the “License agreement”, then you press the spacebar until you see the question: “Do you accept the license terms?”

yes


and press enter.

4 - Press enter again to confirm the default location where you want to install anaconda.

5 - “Do you wish the installer to inizialize Anaconda3 by running conda init?

Yes


and press enter.

6 - Give administrator permissions to use Anaconda and create virtual environments:

sudo chown -R $USER anaconda3
sudo chwon -R $USER sudo chown R ~/.conda

2. Install Libraries

Once we have anaconda installed we can install all the libraries necesary to run Mask R-CNN

Create an environment:

conda create --name maskrcnn_benchmark -y

conda activate maskrcnn_benchmark 

Pytorch:

pip install torch==1.3.0

pip install torchvision==0.4.1


Cuda Toolkit:

conda install cudatoolkit=10.0


Install Apex:

cd $INSTALL_DIR
git clone https://github.com/NVIDIA/apex.git
cd apex


python setup.py install


Install pycocotools:


cd $INSTALL_DIR
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install

Install cityscapesScripts:


cd $INSTALL_DIR
git clone https://github.com/mcordts/cityscapesScripts.git
cd cityscapesScripts/
python setup.py build_ext install

Install Maskrcnn-benchmark:


cd $INSTALL_DIR
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
python setup.py build develop

3. Run Mask R-CNN

Once we are still inside the conda environment and the folder maskrcnn-benchmark we can run the algorythm with simply two lines of code:

cd demo
python webcam.py

Top Python Development Companies | Hire Python Developers

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When you look for the developer in hurry you may forget to take note of review and ratings of the company's aspects, but we at TopDevelopers have done a clear analysis of these top reviewed Python development companies listed here and have picked the best ones for you.

List of Best Python Web Development Companies & Expert Python Programmers.

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Description
Learn Hands-On Python Programming By Creating Projects, GUIs and Graphics

Python is a dynamic modern object -oriented programming language
It is easy to learn and can be used to do a lot of things both big and small
Python is what is referred to as a high level language
Python is used in the industry for things like embedded software, web development, desktop applications, and even mobile apps!
SQL-Lite allows your applications to become even more powerful by storing, retrieving, and filtering through large data sets easily
If you want to learn to code, Python GUIs are the best way to start!

I designed this programming course to be easily understood by absolute beginners and young people. We start with basic Python programming concepts. Reinforce the same by developing Project and GUIs.

Why Python?

The Python coding language integrates well with other platforms – and runs on virtually all modern devices. If you’re new to coding, you can easily learn the basics in this fast and powerful coding environment. If you have experience with other computer languages, you’ll find Python simple and straightforward. This OSI-approved open-source language allows free use and distribution – even commercial distribution.

When and how do I start a career as a Python programmer?

In an independent third party survey, it has been revealed that the Python programming language is currently the most popular language for data scientists worldwide. This claim is substantiated by the Institute of Electrical and Electronic Engineers, which tracks programming languages by popularity. According to them, Python is the second most popular programming language this year for development on the web after Java.

Python Job Profiles
Software Engineer
Research Analyst
Data Analyst
Data Scientist
Software Developer
Python Salary

The median total pay for Python jobs in California, United States is $74,410, for a professional with one year of experience
Below are graphs depicting average Python salary by city
The first chart depicts average salary for a Python professional with one year of experience and the second chart depicts the average salaries by years of experience
Who Uses Python?

This course gives you a solid set of skills in one of today’s top programming languages. Today’s biggest companies (and smartest startups) use Python, including Google, Facebook, Instagram, Amazon, IBM, and NASA. Python is increasingly being used for scientific computations and data analysis
Take this course today and learn the skills you need to rub shoulders with today’s tech industry giants. Have fun, create and control intriguing and interactive Python GUIs, and enjoy a bright future! Best of Luck
Who is the target audience?

Anyone who wants to learn to code
For Complete Programming Beginners
For People New to Python
This course was designed for students with little to no programming experience
People interested in building Projects
Anyone looking to start with Python GUI development
Basic knowledge
Access to a computer
Download Python (FREE)
Should have an interest in programming
Interest in learning Python programming
Install Python 3.6 on your computer
What will you learn
Build Python Graphical User Interfaces(GUI) with Tkinter
Be able to use the in-built Python modules for their own projects
Use programming fundamentals to build a calculator
Use advanced Python concepts to code
Build Your GUI in Python programming
Use programming fundamentals to build a Project
Signup Login & Registration Programs
Quizzes
Assignments
Job Interview Preparation Questions
& Much More

Guide to Python Programming Language

Guide to Python Programming Language

Guide to Python Programming Language

Description
The course will lead you from beginning level to advance in Python Programming Language. You do not need any prior knowledge on Python or any programming language or even programming to join the course and become an expert on the topic.

The course is begin continuously developing by adding lectures regularly.

Please see the Promo and free sample video to get to know more.

Hope you will enjoy it.

Basic knowledge
An Enthusiast Mind
A Computer
Basic Knowledge To Use Computer
Internet Connection
What will you learn
Will Be Expert On Python Programming Language
Build Application On Python Programming Language