How to contribute to an AI open-source project?

Learn, build, share

Adrian Boguszewski
OpenVINO-toolkit
8 min readOct 24, 2022

--

Authors: Adrian Boguszewski, Zhuo Wu, and Raymond Lo — AI Software Evangelists, Intel

Nowadays, more and more open-source software is being developed and distributed around the world. Some well-known software like Linux, Git, Firefox, or Python is open source and has a strong community behind these efforts. OpenCV, an open-source computer vision and machine learning software library, has also gained significant traction in the computer vision and AI community. OpenCV was first publicly released in 2000 as part of the Intel software. It has successfully gone through more than 20 years of development, providing more than 2500 optimized algorithms to developers worldwide.

However, today if you would like to be part of the open-source community, how should you start? Also, what are the benefits of joining the open-source community if you may not get recognition or rewards for your hard work?

Why contributing to an open-source project is worth a thousand words

Open-source projects provide code to help developers solve their problems for free. Developers share improved solutions and make their contributions to open-source projects. Thus, both parties benefit a lot from each other and form a beneficent circle.

Now let’s look at some aspects that make contributions to a project profitable for anyone:

Advance by studying the source code (thinking) of others

In an open-source project, usually, you could download or clone the source. Therefore, it’s convenient for you to read the source code and learn how functions are defined for a specific tool, how a model training pipeline is set up, etc. In this way, you’ll learn how to use the features and tools provided by the open-source project, and you could use what you’ve learned by reading to advance to senior developer!

Gain some recognition for your work

You’re always welcome to submit your work to the project if you use open-source software and come up with better solutions than it currently has. After submission, your effort will be reviewed, and you’ll also get instructive feedback. Following several rounds of modification, your work could finally be approved and merged into the project. Then, your solution is officially accepted and used by others. It means you’re quite famous 😊

Build a good story

By contributing to an open-source project, you join a community with hundreds and thousands of like-minded developers. You’ll also have the opportunity to build connections and interact with the professionals developing and maintaining the open-source project by submitting your work and getting it reviewed. At the same time, you’ll create a good resume by demonstrating your skills publicly through the links of your work on the open-source platform. We hope it will help you skip the interview and get hired after 5-minute of conversation!

Where to look for “the best” open-source projects?

There are various platforms or channels through which you could contribute to an open-source initiative. Here are some examples where, in our opinion, you could find interesting projects and ways to make you an open-source developer.

First, GitHub or any other hosting service. Usually, an open-source project has a repository to store code and corresponding introduction documents. You can browse GitHub to find the project in which you are interested. Detailed information on how to make contributions to the repositories could normally be found in the so-called “CONTRIBUTING.md” files.

Also, there might be external programs (such as Google Summer of Code (GSoC) for full-time students or open-source beginners, etc.), challenges, or competitions organized by the project core developers and maintainers. By participating in those programs or events, you could make your contributions through channels specified by the organizers, and even win some bonus by the way.

Third, through the applications you currently use. As mentioned above, many of the applications commonly used today are free and open software. You probably use some applications that you really like, which may be open source. With this idea, you could go on to find platforms or repositories that maintain the development of these programs and then contribute to making them even better!

And now, we’re going to answer the most important question, “How?”.

Get started

This article is based on OpenVINO™ Toolkit — an open-source project from Intel for optimizing and deploying AI Inference. For other open-source projects, please connect to the community and read their detailed contribution guide.

Ok. So, you have decided to contribute to OpenVINO™. First, you should find the project website and codebase to learn more about project needs, code structure, and contribution rules. In this case, official documentation is here, and the codebase is hosted on GitHub. The best option to understand the project is to use it! If you’re unfamiliar with OpenVINO™, clone and run the OpenVINO Notebooks repository and run some of them to learn and have fun. We strongly recommend openvino-api to learn basic runtime features, tensorflow-to-openvino to learn how to convert the TensorFlow model, and object-detection-webcam to have fun 😊.

1. Fork

This project requires working on your own copy of the repo and creating pull requests to merge the code. It means you need to fork the main repository by clicking the “Fork” button when you’re ready to start your journey.

2. Clone

Now you have your remote copy. It’s time to clone it to your machine by running:

git clone git@github.com:<your_nickname>/openvino.git

If you see errors like those below, it may be related to problems with your SSH key. See these instructions or clone via https.

3. Compile

The next step is to set up your development environment, which includes cloning submodules, installing dependencies, and setting options. We recommend using Ubuntu 20.04. Please be aware that compiling code will take about 50GB of your disk space in debug mode. If you’re an experienced developer, you can specify different options to enable or disable some modules. See the guide here.

cd openvino/
git submodule update --init --recursive
./install_build_dependencies.sh
sudo apt install cython3 intel-opencl-icd
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_FUNCTIONAL_TESTS=ON -DENABLE_DEBUG_CAPS=ON -DENABLE_CPU_DEBUG_CAPS=ON -DENABLE_NCC_STYLE=ON ..

You’re ready for compilation. Run make in your command line and wait for the process to complete.

make --jobs=$(nproc --all)

Very rarely, there may be a situation where the OS kills your compilation. If you encounter such a situation (like below), please make again with fewer jobs concurrently.

If you want to learn more about the building process, please refer to this article or these instructions.

4. Run

To be sure everything was built correctly and OpenVINO™ is usable, you can run a sample application called hello_query_device, which prints all available compute devices.

cd ../bin/intel64/Debug
./hello_query_device

You should see all devices on which you can run OpenVINO™. There are CPU, GNA, and GPU in our case.

5. Choose an issue

You have built the code. Now you’re ready for real development. The good idea is to fix/implement something based on actual demand to make your work valuable and increase the probability of being merged. There is an Issues tab on Github, where you can find bugs and feature requests reported by the community.

It’s a great place to start looking for easy-to-fix issues until you get familiar with the code. They often have specific labels like “good first issue” or similar.

In the OpenVINO™ repository, there is one particular board where you can find all “good first issue” items, so it’s a good place to start.

As you decide what to fix/implement, it’s recommended to start a discussion with developers and the community to specify final requirements and assign yourself to the issue. When everything is known, you can start coding.

6. Implement

One more thing before you start. Please find and read the contribution guide. It’s very important to follow the rules and code style. Consistency is crucial in big projects. Then you can create a new branch (with a meaningful name) and switch to it.

git branch <meaningful_branch_name>
git checkout <meaningful_branch_name>

Open the code in any IDE you like or use a text editor like vim and start coding! Test your changes every once in a while to be sure it’s going in the right direction.

If you encounter any bug while implementing your feature, please report it by creating an issue.

7. Test

If you implement a new feature or fix a bug, you should provide unit and functional tests for it (if feasible). For example, if your changes relate to Python API (src/bindings/python/src), it’s a good idea to add unit tests in the same module (src/bindings/python/tests). When your changes affect the Inference Engine (src/inference/src), you should add new tests to the respective directory (src/ tests/unit/inference_engine). Then compile OpenVINO™ once again, run your tests along with the others and check if everything passes.

cd ~/openvino/bin/intel64/Debug
./ieUnitTests

8. Commit, push, and create a pull request

When OpenVINO™ compiles and tests pass, you can push your branch to the remote repository.

git push -u origin <meaningful_branch_name>

It’s necessary to be able to create a PR that pulls your changes to the main repo. You can do it in the Pull requests tab.

Remember to add details of your changes and appropriate labels, e.g., Python API

9. Update

Then, please wait for the evaluation from the primary development team and when it’s ready, please answer questions, ease doubts, and improve your code according to the review. At the same time, you need to ensure all CI tests are passing. If not, find the issues and fix them.

10. Merge

And you’re merged, finally!

We encourage you to stay with us for the long term :) Take the next issue and remember to sync your main branch from time to time!

And OpenVINO™ Toolkit is a part of Google Summer of Code! This is probably one of the best ways to start your open-source journey. Follow the news and look forward to the next GSoC!

--

--