Development
Introduction
In recent years, the explosive development of radiance field technology has led to the emergence of numerous outstanding academic works in this field. However, due to the competitive academic environment and the prevalent focus on publishing papers over engineering practices, many works lack well-maintained open-source code implementations, making them difficult to read and extend. This hinders subsequent research based on these works.
Researchers, aware of this issue, have developed powerful and well-structured code libraries, such as nerfstudio, aiming to establish a unified code framework. This approach not only allows different technologies to be implemented based on a common framework, facilitating mutual extension and reducing the cognitive load for learners, but also significantly lowers the engineering difficulty of implementing new technologies, enabling researchers to focus more on theoretical methods themselves.
However, as these code libraries grow in size, they almost inevitably develop certain issues, such as extremely complex inheritance structures and over-abstraction brought by object-oriented programming. These problems often result in a steep learning curve for beginners when reading and learning from the code library, and a significant lack of flexibility when implementing new methods.
The author of this code library has suffered from these issues and is determined to develop a code library that is clean, has a smooth learning curve, and is easy to extend and maintain. The goal is to achieve the best balance among simplicity, flexibility, and functionality in this challenging trade-off.
Overview
Therefore, this tutorial aims to provide a step-by-step learning guide, starting from basic to advanced concepts. It will revolve around the design philosophy of the code library, initially explaining how to achieve a balance among simplicity, flexibility, and functionality from a macro perspective. The tutorial will then gradually introduce the key components or language features that the code library relies on, including type hints, data structures, and code architecture. Subsequently, the tutorial will provide detailed guidance on method implementation and dataset implementation, offering examples on how to extend the code library.
Type Hints
It is well known that Python is not a statically typed language, and much of its convenience comes from the feature that explicit type specification for variables is not required in Python code. However, with the proposal and adoption of the 2014 draft PEP 484, type annotations were officially introduced as a built-in feature in Python 3.5.
Type annotations offer many benefits, one of the most favored being their ability to enhance static type checking, thereby catching potential errors before runtime, much like other statically typed languages. However, our code library adopts type annotations for another important reason: they not only allow code readers to understand the code in a decomposed manner, avoiding excessive cognitive load, but also enable modern code editors to perform better analysis and provide more accurate suggestions.
For a detailed tutorial on this part, please refer to Type Hints.