SRA-VJTI/Pixels_Seminar

Transcoding from Python to Industry standard C++

Closed this issue ยท 24 comments

The aim of the pixels seminar is to introduce the juniors with the basic concepts of image processing and computer vision. We started with python to keep it as simple as possible. But I feel the need to move from python to C++. C++ is complicated but is an industry standard.
If juniors were to introduce to C++ in this seminar than python, then they might be more willing to go through large c++ codebase in GSoC or any other programs or competitions. With the inclusion of C++, we can also introduce build systems (which honestly is the need of an hour).
This repository can also act as basic template for CV people getting started with C++.

@meshtag @amanchhaparia @SAtacker kindly share your opinion on this.

Also keep in account that at SRA, we advocate progress, regardless of how challenging or difficult it may seem at first.

In short: Yes, we can make it difficult.
Better answer:
Last year I tried doing SMORT in C++ with OpenCV C++. It felt similar to doing in python, with no major advantage (even though I was an SY/TY back then). I understand what you are trying to do and the reasons behind it. But we should find a better reason to do it in C++.
For example, everything in C++ is the only remaining way. From reading image formats to compressing images, efficient data structures and algorithms for image transformations seems like the only good enough reason to do so.
What I am essentially saying is to implement another suboptimal and minimal OpenCV for the sake of learning as well as teaching.

If the above reason doesn't make much sense to CV people (@SravanChittupalli) then there's no point in doing it.

@gautam-dev-maker , although I understand and support the argument for doing it in c++, we are risking less (potentially 0) exposure to python by doing so. We should decide if we are fine with this possible effect of our decision.

I completely disagree with @SAtacker 's idea of creating a miniature OpenCV from scratch in c++, my reason for doing so is that such an attempt will surely be a non-trivial task and has a very high risk of corrupting the effort's main purpose i.e. introduction to computer vision for beginners.
P.S. : If someone wishes to learn/explore how developing an IP library (solely in c++) actually feels like, they are always more than welcome to explore Boost GIL.

@gautam-dev-maker , although I understand and support the argument for doing it in c++, we are risking less (potentially 0) exposure to python by doing so. We should decide if we are fine with this possible effect of our decision.

I completely disagree with @SAtacker 's idea of creating a miniature OpenCV from scratch in c++, my reason for doing so is that such an attempt will surely be a non-trivial task and has a very high risk of corrupting the effort's main purpose i.e. introduction to computer vision for beginners.
P.S. : If someone wishes to learn/explore how developing an IP library (solely in c++) actually feels like, they are always more than welcome to explore Boost GIL.

There are two perspectives one can look at:

  1. Learning the same things the hard way (which isn't much favorable to juniors that aren't able to learn through the steep curve).
  2. Sticking to CV concepts only through python.

@SAtacker we can all agree that if a person doesn't do any assignments given then there is no meaning to his/her attendance during this seminar. So if we just increase the level(of seminar) and give them basic exposure to c++ and image processing algorithms with assignments then at least they will know what to refer if they wish to explore c++ in other domains as well.

Also we should consider another perspective, that is of the person who will teach. Imagine how much he/she will learn while preparing for any concepts. Like in Wall-E , we learnt many concepts while we were assigned those concepts to teach to our juniors. (@SAtacker PWM ka demo yaad hai na :-))

Python is a language that can be learned at any moment, but learning C++ first will undoubtedly improve the caliber of SRA peep.

Might as well make a pros cons list

Pros C++ Cons C++
Better caliber same concepts
build system introduction python not learned
better knowledge of seminar mentors lesser risk of students quitting due to python
Pros C++ Cons C++
Better caliber same concepts
build system introduction python not learned
better knowledge of seminar mentors lesser risk of students quitting seminar in between due to python
familiarity with build errors familiarity with jupyter notebook
develop debugging skills no serious debuggine skills but faster learning
Will give the confidence to look at larger codebase Might reduce their confidence with c++ and build systems
Pros C++ and CV Cons C++ and CV or Pros Python and CV
Better caliber same concepts
build system introduction python not learned
better knowledge of seminar mentors lesser risk of students quitting seminar in between due to python
familiarity with build errors familiarity with jupyter notebook
develop debugging skills no serious debuggine skills but faster learning
Will give the confidence to look at larger codebase Might reduce their confidence with c++ and build systems

From the cons section mentioned by @SAtacker , python not learned can be compensated by giving basic exposure in other workshop/seminar like MARIO(but that is another point of discussion irrelevant here). Overall I feel the Pros section is having more weight which will be better for the juniors as well as in terms of growth prospect of SRA.
We can take a reference from the below course and its homework section which are completely in C.
Ancient Secrets of Computer Vision
We can discuss the feasibility and difficulty level of the seminar based on the above assignments. Would like to have your opinions @SAtacker @meshtag @gautam-dev-maker

Seems like a nice idea! @amanchhaparia

@meshtag I agree that this topic requires a thorough discussion, specially on future implications. This move may even sound radical given that this repo has not even completed 2 years of existence. Radical changes often put great impacts.

Not to offend any so called python developer, but c++ users can easily do the current pixels_seminar level python if they put 1 day of effort. So I don't completely agree with "0 python exposure". Infact industry has promoted python so much that it has become part of peer pressure :).
Also as @amanchhaparia specified minimum required python exposure can be given at other workshops/seminars as well.

Kindly don't make the discussion here c vs c++ from c++ vs python. We don't want civil war at our hand ๐Ÿ˜‚.

@meshtag I agree that this topic requires a thorough discussion, specially on future implications. This move may even sound radical given that this repo has not even completed 2 years of existence. Radical changes often put great impacts.

Not to offend any so called python developer, but c++ users can easily do the current pixels_seminar level python if they put 1 day of effort. So I don't completely agree with "0 python exposure". Infact industry has promoted has python so much that it has become part of peer pressure :). Also as @amanchhaparia specified minimum required python exposure can be given at other workshops/seminars as well.

Also adding to it, a person with only python having his/her primary language develops certain resistance to code in c/c++ in later stages, but converse is not true.

If we all agree to port to c++, then we can proceed the discussion to the level of difficulty or specifically what changes we want to introduce wrt codebase and concepts.

If you agree to proceed the discussion in the direction on how to switch to c++, then acknowledge (๐Ÿ‘) this comment.

Let's start with

  1. What C++ concepts needs to be taught.

    • Use of pointer is quite confusing for some people at start.
  2. How much of build system need to be taught

    • CMakefile is short , but to explain the terminal commands to compile cmake will require us to teach them makefile
    • or We can keep Makefile a blackbox in the above scenario

Ancient Secrets of Computer Vision after seeing the repository , I think there is a need to add a part about how image rastor data is stored in a image file and how it is interpreted. (Although this might be too much).

  1. How much of build system need to be taught

FYI, we can chose to proceed without touching build systems as well, manually linking required stuff and compiling each .cpp file individually from command line.

Content to be ported to C++:

Make different section of the topics along with following appropriate coding standards. Each Topic will have a detailed Readme.md file explaining its contents which will be replacement for the jupyter notebook's notes.
Topics can be divided such as:

  • Image Representation.
  • Colour Spaces and Color Conversion.
  • Playing with Image Coordinates.
  • Convolution and filtering.
  • Masking.
  • Morphological Transformation.
  • Blob detection.
  • Assignments.

Content can be added:

  • Important Concepts of C++ like pointers etc.
  • Exploring the cv Mat container which will be used as a replacement for numpy ndarray. Ref
  • Concept of interpolation.
  • Build Systems.
  • Introduction on Image storing formats.

Content to be removed:

  • Python
  • Numpy

Note: Scope of the content is up for discussion and is not yet finalised.

The main draw of Pixels was the ease and intuiteveness of learning from the jupyter notebooks, of both the assignemnts and the seminar material, with the concise instructions and examples in each step.

We can try to emulate the same by giving template C++ code files(possibly with main functions already written) where they only have to fill in the IP functions, also giving ellaborate build instructions and maybe even test scripts.

A layer of complexity will also be added by abandoning NumPy. This means using vectors or just general cpp arrays as our main data containers. Some of the later numpy assignments prove tough for newcomers even with the help of the vast numpy methods.
Trying to emulate the same using cpp vectors or arrays might be tough.

@Jash-Shah I think instead of using cpp vectors or arrays we can use the Mat class from opencv . To store images . This will make it way easier than vanilla c++ vectors or arrays .

Should we fork the repo for transcoding it? Currently, this repo is complete by itself as a Python implementation of the concepts. Transcoding to another language can be done in a fork of this repo, this will leave the original repository for future reference as well.

Should we fork the repo for transcoding it? Currently, this repo is complete by itself as a Python implementation of the concepts. Transcoding to another language can be done in a fork of this repo, this will leave the original repository for future reference as well.

No we will create a release for the Python version(which can be used for reference) and will continue to change and port the contents in the original repository itself.

resolved with the #101.