This article first discusses own source reading experience, then gives several cases to interpret, the choice example is relatively simple. Heavy in the description of the point I am thinking of the source reading method of the line. I am not a professional architect, from the perspective of a deep learning algorithm engineer to talk about, not professional places please PAT.
Often read someone else's code, and then change someone else's code, and then realize their own ideas, I think this is what we coder often do. Look at people looking at code, code like people. His code is very clean and concise, indicating that his thinking is clear, the structure of the code is how reasonable, modular cohesion, whether low-coupling, reaction to his macro-control ability. A software system you can think of him as a simple enterprise, how each functional departments play their role, the equivalent of each software module how to organize the smooth, a complex and chaotic code and a management confusion of the company, the scissors constantly disorderly, simply overturn again.
Let's talk about my experience of reading the source code. Hope to become a stepping stone for everyone, we can fly higher on the basis of my, go more stable.
SOURCE read my own pondering the experience is: Point-line-surface three-dimensional depth-by-layer.
Point: Point has two levels of meaning, first you have to find the breakthrough point, such as the entrance of the program main function, or a relatively easy to cut points, many times the main function is written under a very concise, a few lines of code to walk a main process, or call multiple processes, you can hardly see the logic inside, It's a tricky thing to find a starting point. Find a pointcut in order to get from the point to the line, start to understand what's inside.
Another aspect of the point is that when the main line is found through the pointcut, some other points, such as functional function utils, some functional modules, are connected by strings. These things you withered to see not too much fun, you may not understand what it is doing, there is a string of words, you can debug, you will quickly figure out the function inside.
Lines: lines have mainline and side lines. Deep learning I think is a process-oriented, because it is actually an equation, a function, the process-oriented programming idea is to give a input, in your software system to walk through, get some output. The mainline is the line that connects the inputs and outputs. A side line is some branch of the main line. Given an input, you can follow this line step-by-step, and print out some key variables each, so you can basically understand what's going on at each step.
The side line is some branch, from the main line to separate an input, and then call a functional module, get a result, and then go to the main line of the process. This call functional module is a side line, only the side of the line to understand, you can build a knowledge tree, you can three-dimensional to a system in-depth understanding.
Face: Line and line staggered, line to string up, organized into a net, is a face. The main level of the speech is to hope that everyone has a global awareness. System Designers design The system should be the first to think of is a face, is a three-dimensional things, and then the wire stripping code code. Which file to put into which module, which function to put in which file more appropriate, should be very clear, so that there is a sense of the whole, the level of clear, logical. Just like network engineers to take the cable, some master set up the network cable has a layered sense, a touch to know that the line is connected with which switch.
Haphazard
There is a logical code structure.
LABELIMG Case:
To tell the truth, I used to use LABELIMG to tag, but never read the source code. As a result of the development of a semi-automated labeling system on this basis, this week I also began to grope from 0. It took three days to figure it out.
Labelimg was written in PYQT. Let's say it's an object-oriented programming framework. His main function is simple. The main logic is all in the MainWindow class.
This MainWindow class is too many things, can not find a breakthrough. Originally on this Get click information and then execute some action programming paradigm is not very familiar, groping for a long time, only to find a breakthrough, that is, after the frame, he will pop up a dialog box, is this OK or cancel box.
It is chosen as a breakthrough, because 1, the following list of data is read from the TXT file back to show, according to this line, you can find out how to get the data you want to display to the dialog box; 2 He is the picture on the frame after the Automatic popup dialog box, which helps you to understand how he gets the mouse click Interactive, Gets how the dialog box opens after the click Interaction. You get this figured out and you catch the main line.
Through groping, found this dialog box is written below Libs, the code is as follows:
And then went to find some points: 1, in the main MainWindow is how to call this class, 2, txt in the data is how to read and then give to Labeldialog. 3, these qwidget, qlistwidget are all dry what. Do you think it's particularly easy? Don't laugh, I've been thinking about these things for three days, huh? Elder brother is more stupid than you, but elder brother than you action.
This series has a head start, and you might think that these are all engineering things that algorithmic engineers waste time doing. In fact, the originator Hinton once warned us: "To read less paper, do not stop programming." Powerful engineering capabilities are the cornerstone of the algorithm, and how data is collected (including tagging) and how to define problems and modeling is the cornerstone of the algorithm's Landing. If you have any sympathy, please buckle 1.
Source reading experience Talk-slim,darknet,labelimg,caffe (1)