JuliaImages / Images.jl

An image library for Julia
http://juliaimages.org/
Other
533 stars 141 forks source link

JuliaImages 1.0 and beyond — a two year roadmap #977

Open johnnychen94 opened 3 years ago

johnnychen94 commented 3 years ago

For years I've been thinking what 1.0 means for JuliaImages and what I can do for it. I just started my third year in my Ph.D. career, and I expect to graduate in another two years. It's hard to know what will happen after graduation and whether I'll be able to further commit to JuliaImages, so I think, maybe, I should set a two-year target for JuliaImages and reach some healthy status and so that newcomers can become regular contributors, and regular contributors can become maintainers. This is why I drafted this roadmap.

The role of JuliaImages ecosystem

Sometimes the answer is simple, make JuliaImages another OpenCV. But it requires more than we can afford to achieve this goal. This is often less a priority here because we don't want to reinvent the wheel.

Eventually, I want to make JuliaImages a platform for research and education before I step away from being an active maintainer. JuliaImages will try to provide high-performance implementations, but won't commit to embedding systems because the Julia ecosystem isn't ready yet.

What problems can(should) JuliaImages solve

As a dynamic language, Julia makes prototyping even easier than Python/MATLAB, and as a compiled language, Julia runs as performant as C/C++. There are many cases in image processing where prototyping doesn't require much on performance, thus it doesn't make much difference whether the researchers doing the prototyping work in Julia, Python, or MATLAB. Thus if we want to distinguish JuliaImages from other image processing frameworks, we should target:

The key properties of JuliaImages and how we achieve these

Usability, Generality and Composability

The most satisfying point I enjoy about JuliaImages is its usability and its integration with the entire Julia ecosystem; when you learn JuliaImages you are also learning the language Julia. This makes JuliaImages a perfect platform for education.

The only secret here is to not blocking ourselves as an isolated ecosystem; if we can make generic implementation in an independent upstream package, we make it there. For example, to deal with padding we provide OffsetArrays and PaddedViews, to deal with the iteration of N-dimensional arrays we introduce CartesianIndices to upstream Julia, and to deal with patches and blocks we introduce TiledIterations. This definitely requires more effort than "fixing things right here as patches", but the gain is that the ecosystem is so easy to intuit and use while still as generic as it can be.

Performance

Image processing itself is a computationally intensive field and also has a long history. Many classic algorithms have been highly optimized in low-level languages (such as C/C++) or DSL languages (such as Halide) very well. Thus a key question for JuliaImages to solve is: how do we achieve competitive or even better performance than existing frameworks?

There are already many cases where JuliaImages excels compared to the competition. Where we do not, there are several possible solutions:

All of them are important, but I might want to emphasize more on the 3rd point here because this is where Julia can distinguish itself from other languages. And this requires JuliaImages to be a good platform for research and education.

JuliaImages target feature set:

This list is by no means complete and I can't make sure everything can be achieved, but I'd like to list it here so that people know what is under the scope of the JuliaImages ecosystem.

Image processing and computer vision is a complicated field with so many possible tools that no single person knows them all, e.g., filters, PDEs, variational methods, statistics, deep learning. And it is also an evolving field that new applications and methods are developed, e.g., image style transfer.

I can't foresee what JuliaImages will contain in the future, but I'd like to still give a simple criterion on whether an algorithm should live in JuliaImages:

For instance, bilateral filters, QR code support, MRI reconstruction are good candidates for JuliaImages.

We would also want to extend JuliaImages to support GPUs, AD, and deep learnings. But they might live in some bigger projects, e.g., the not-yet-existed CuImages.jl and/or DiffImages.jl.

I'm pretty sure that I still missed a lot of fields in the above list. If people have ideas and want to develop packages under JuliaImages, I'm glad to have them here so that maintainers here can help to watch them. A very nice recent example is DitherPunk.jl.

Code organization

Currently, there is one meta package Images.jl that provides an out-of-box experience for many users of JuliaImages. This is supported by Reexport.jl via e.g., @reexport using ImageCore. In the future, we might have CuImages.jl for CUDA.jl support, or DiffImages.jl for AD (e.g., Zygote.jl) support.

I'd like to also briefly introduce some of the packages in JuliaImages so that people know how we organize things:

All these packages are composed together as our meta package Images.jl using Reexport.jl.

Where one specific function lives is not fixed. It is possible that we first develop a field-specific implementation of the function in high-level packages, and then we polish and generalize it, and finally move to lower and smaller packages. For instance, forwarddiff was developed as a specific utils for Images.imROF(deprecated) and then we generalized and moved to ImageBase as fdiff. It is also possible that we first develop one algorithm in some package, and then we add more implementations and algorithms and making it an independent package. For instance, otsu_threshold (deprecated) once lived in Images.jl and then @zygmuntszpak added a lot of similar threshold operations and created HistogramThresholding.jl.

Packages are(will be) hosted either in the Images.jl repo as sub-dir packages, or hosted as independent packages (e.g., OffsetArrays.jl, Colors.jl)

Tests in the Images.jl repository consist of two parts:

Documentation:

There are two key issues that drive us to this scattered code organization:

Hopefully, when Julia has first-class conditional package loading, we don't need to make these tradeoffs.

JuliaImages roadmap

When writing down the roadmap, I'm thinking about the question: why are people duplicating the functionalities and basic utils outside JuliaImages? I get two answers:

I set the roadmap as it is here so that when people develop new functionalities whether inside or outside JuliaImages, they can reuse the infrastructure that JuliaImages provides without duplicating the codes.

1.0 roadmap

The main tasks of 1.0 roadmap is to revisit and clean our codebase, improve documentation, and eventually set a common "modern" ground for future improvement.

1.x features

Here I just list things that interest me most; things that I will eventually try to support given enough free time. As an open-source project without the full-time commitment, there are really no hard requirements or timelines here.

Tokazama commented 3 years ago

I'm probably going to register SpatioTemporalTraits.jl soon. It's far from perfect but it's at least a start if there is interest in gradually integrating it.

EDIT: just triggered registrator on this