Recent Releases of pico_tree

pico_tree - v0.8.3

Added support for class template argument deduction (CTAD). This means that the space type can now be deduced from the argument given to the constructor of the KdTree:

```C++ std::sizet maxleaf_size = 10; std::vector> points{{0.0, 1.0}, {2.0, 3.0}};

// Deduces to: // picotree::KdTree<std::referencewrapper>>> picotree::KdTree tree(std::ref(points), maxleaf_size); ```

Using the previous deduction method, we still have to specify the space type when we want to change any of the other template arguments of the KdTree, such as the metric type. In this case we can use the new pico_tree::MakeKdTree<> function to make life a bit easier.

```C++ std::sizet maxleaf_size = 10; std::vector> points{{0.0, 1.0}, {2.0, 3.0}};

auto tree = picotree::MakeKdTree<picotree::LInf>(std::ref(points), maxleafsize); ```

- C++
Published by Jaybro over 2 years ago

pico_tree - v0.8.2

This release consolidates various small improvements:

  • Fix: added a missing include for std::reference_wrapper<>.
  • Reworked the mnist example into the kd_forest example.
    • Fix: the example now checks the correct filename for the existence of a ground truth file.
    • The example adds the use of the SIFT dataset on top of the MNIST dataset.

- C++
Published by Jaybro over 2 years ago

pico_tree - v0.8.1

The biggest change introduced by this release moves the responsibility of filtering points from the KdTree to the search visitor. Previously, the KdTree would use a visitor's max() method to filter both the nodes of the tree as well as the points residing in the non-filtered nodes. Moving this responsibility makes it possible for the visitor to inspect all the points of the non-filtered nodes instead of just a sub-set, giving the visitor more control and information during a query. This allows, for example, the implementation of the following features:

  • An approximate radius search. This was impossible with an older version (equal to setting a smaller search radius).
  • Knowing the exact amount of points encountered during a query (see kd_tree_custom_search_visitor.cpp).

Filtering in the visitor also improved the existing approximate k nearest neighbor query. Of all the points that are visited during a query, it will now be guaranteed to return k the nearest.

WARNING! To those who implemented a custom search visitor: Make sure to add extra filtering to avoid having the best nearest neighbor candidate being overwritten by a worse candidate!

Other changes:

  • The LInf metric has been added for both C++ and Python.
  • Updated the search_box interface for Python to obtain a small performance improvement.
  • Removed an unsupported SpaceMap constructor.
  • Interfacing with an Eigen::Map of const Eigen::Matrix added. There was only support for non-const matrices.
  • Added the approximate version of SearchNn (C++), SearchRadius (C++), and search_radius (Python).
  • Updated various examples and added KdTree serialization and MNIST examples.

- C++
Published by Jaybro almost 3 years ago

pico_tree - v0.8.0

This release introduces an improved and simplified interface while at the same time cleaning up some of the internals. The main motivation for changing the interface was to reduce work related to creating traits while at the same time reducing and cleaning up their responsibilities. A traits class like StdTraits or EigenTraits was responsible for three things:

  1. Interfacing with a space (point set).
  2. Interfacing with a point.
  3. Specifying the index type stored in the KdTree.

A point interface was also available through StdPointTraits and often times a class like StdTraits simply used StdPointTraits, essentially showing that an implementer had to do duplicate work. It was also somewhat unclear if the interface should just support the point type stored by its respective space or if it should support other point types as well. This issue has been resolved by splitting up the "main" traits class into both SpaceTraits and PointTraits (the latter previously StdPointTraits). And well, if the interface gets broken anyway, we may as well change a bunch of other things 🥳

Interface changes:

  • The "main" traits classes have been split-up into SpaceTraits and PointTraits plus the index type has been moved to the KdTree.
  • Renamed StdPointTraits to PointTraits.
  • Removed the KdTree Dim template argument.
  • KdTree Splitter argument changed from a template class to an enum value: kLongestMedian, kMidpoint and kSlidingMidpoint.
  • kDynamicDim renamed to kDynamicSize to be more generic and its type changed from int to pico_tree::Size.
  • Metrics:
    • Metrics now use iterators instead of points.
    • Eigen metrics removed.
  • CvMatRow replaced by PointMap.
  • Updated Aknn functions to be overloads of the Knn functions for both the C++ and Python interface.
  • The KdTree now takes a Space as the first a template argument instead of a Traits. This makes setting the argument a bit more simple.
  • More consistent interface between points, spaces and their traits.
  • Google Code Guide update for output function arguments (from pointers to references).
  • Traits related header files renamed.
  • Minimum required C++ standard updated from C++11 to C++17.

Additional features:

  • Added the SpaceMap and PointMap classes to support interfacing with raw pointers.
  • Added the Midpoint splitting rule.
  • Added the SE2Squared metric.
  • Added a default SpaceTraits<> overload for std::reference_wrapper<SpaceType>. This means that any supported space can be wrapped in an std::reference_wrapper<SpaceType>.
  • Added support to interface with fixed size arrays and std::array<>.

- C++
Published by Jaybro almost 3 years ago

pico_tree - v0.7.5

This release consolidates various quality of life improvements.

Changes: * Updates to the build algorithm, data management and memory management. * These updates resulted in small changes in the binary format of the KdTree and the Splitter interface, plus a small speedup of the build algorithm. * Improvements to the GitHub workflows.

- C++
Published by Jaybro over 3 years ago

pico_tree - v0.7.4

The KdTree components that handled box utilization and mapping of raw pointers have been refactored, resulting in various performance improvements.

Changes: * Performance for KdTrees having a dynamic spatial dimension improved: * Builds are about 10% faster. * Range queries (using SearchBox) are now more than 10 times faster. * The build and query algorithms of the Python KdTree have become a bit faster. * Fixed a bug for KdTrees with a dynamic spatial dimension that would incorrectly Load and Save its contents.

- C++
Published by Jaybro almost 5 years ago

pico_tree - v0.7.3

Added support for topological spaces with identifications. This allows KdTree searches to support manifolds such as circles or cylinders that "wrap around" near points that can be expressed with different sets of coordinate values. Also improved query times at the price of increased build times. The overall performance of the KdTree is improved.

Changes: * Metrics now require a SpaceTag. It identifies which type of space is supported and it changes the behavior of the SearchNearest algorithms. * Metrics belonging to topological spaces have a slightly different interface compared to ones of Euclidean spaces (see SO2 metric). * Added the SO2 metric that can be used to search for points on a circle. * Updated the KdTree references to include background information on the changes of this release.

- C++
Published by Jaybro about 5 years ago

pico_tree - v0.7.2

While working on a technique to speed up nearest neighbor queries, it became clear that the benchmarks were not representative for showing what the performance would be when matching between two different point clouds. Instead, they showed the performance of queries when the same point cloud was used for both building a tree and querying it. A benchmark using two different clouds is more indicative of tree performance and PicoTree was not the fastest in this scenario. This release addresses the issues with both the benchmarks and query performance.

Changes: * Improved query speed for both the C++ and Python libraries at the price of reduced metric support. * Removed L2 and EigenL2 metric support. The KdTree now only supports distance functions that don't apply a final exponent when determining the length of a vector (e.g. ^(1/2) for the L2 metric). * All benchmarks now test matching performance using two different point clouds.

- C++
Published by Jaybro about 5 years ago

pico_tree - v0.7.1

Changes: * OpenCV related code is now part of the test-and-build workflow. * OpenCV interfacing code moved from the examples to the main library.

- C++
Published by Jaybro about 5 years ago

pico_tree - v0.7.0

The desire to introduce some general API improvements led to dropping the adaptor interface in favor of a traits interface: * Reducing template argument duplication. * Removing awkward constructor requirement for metrics. * Improving interfacing with individual points. E.g.: An OpenCV point required wrapping in v0.6.0.

Changes: * Updated metrics. * Renamed all C++ metrics. Most notable: MetricL2 changed to L2Squared. * Python enum entry L2 renamed to L2Squared. * Added the L2 metric for C++. * Metrics should now be default constructible instead of having a constructor that takes run-time dimensions. * KdTree construction speed improved by about 5-10% depending on the input size. * Added picounderstory. It contains a pre-alpha version of an implementation of the cover tree. It won't be added to picotree. * Renamed picocommon to picotoolshed. * Adaptor interface requirements for point sets and points replaced by a single traits interface. * Added support for working with an std::vector<Point>. * Added support for working with an std::reference_wrapper<std::vector<Point>>. * Eigen adapter interface updated to a traits interface. * Eigen support for std::vector<Eigen::Matrix<>> and std::vector<Eigen::Map<>> added. * Eigen support for std::reference_wrapper<Eigen::Matrix<>> added. * Split the benchmark into multiple benchmarks. * Split various pico_tree internals into separate files. * Added an OpenCV interfacing demo.

- C++
Published by Jaybro about 5 years ago

pico_tree - v0.6.0

PicoTree v0.6.0 changes:

  • Replaced std::pair<> with pico_tree::Neighbor<>.
    • Better readability of the type itself and its variables (first, second vs. index, distance).
    • std::pair<> is not a POD type or trivially copyable. This practically means it can't easily be mapped to memory (such as with pybind11).
  • Added various typedefs (usings) to the public interface of the KdTree: IndexType, ScalarType, PointsType, etc. Updated the examples to follow the same typedef style.
  • Replaced the std::deque based dynamic memory manager with a custom ListPool one.
    • At the time of writing, the performance of using an std::deque can vary quite a bit across implementations of the C++ standard. This is because (at least in part) the internal chunk sizes differ across those implementations.
    • Benchmarking on the Würzburg marketplace dataset shows that the new ListPool gives a small overall performance improvement of about 2-3%.
  • Renamed the custom visitor version of SearchNn to SearchNearest to disambiguate it from the SearchNn that looks for a single nearest neighbor.
  • The EigenAdaptor has received some updates.
    • C++11 compliant.
    • The Eigen example will now be build when the workflow is triggered.
    • Added unit tests.
  • Added PicoTree Python bindings using pybind11.
    • Supports all KdTree query types.
    • Added examples, unit tests and a GitHub workflow for the bindings.
    • Performed a mini benchmark to compare vs. the KdTrees of SciPy and Scikit-learn.

- C++
Published by Jaybro over 5 years ago

pico_tree - v0.5.2

PicoTree v0.5.2 changes:

  • SearchKnn and SearchAknn performance increased. A priority queue is now maintained using an Insertion Sort instead of a Max Heap. The sorted queue resulting from Insertion Sort performs faster than the unsorted Max Heap in practice.
  • Sort option removed from SearchKnn and SearchAknn. The output is now always sorted.
  • EigenAdaptor now explicitly disallows fixed size matrices.
  • Updated the Eigen example.

- C++
Published by Jaybro over 5 years ago

pico_tree - v0.5.1

PicoTree v0.5.1 changes:

  • EigenAdaptor compiles with Clang.
  • KdTree.SearchKnn and SearchAknn now also accept random access iterators as output arguments. This adds flexibility to how the results can be stored in memory. E.g., storing the results of different searches in aligned memory.

- C++
Published by Jaybro over 5 years ago

pico_tree - v0.5.0

PicoTree v0.5.0 changes:

  • Input handling of the KdTree has been improved (see the examples for possible implementations):
    • Test and query points are no longer expected to provide their coordinates through a single adaptor or point set interface. This has been split.
    • The input interface for adaptors or point sets has been simplified and is expected to provide points (instead of point coordinates).
    • Query points and test points should implement the parenthesis operator for providing coordinates.
    • It is now possible to store the test point set as part of the KdTree.
    • EigenAdaptor has been updated to support all the previously mentioned bullets.
  • The interface for Metric classes has been improved:
    • Reduced the amount of template arguments.
    • The point to point distance function now expects two points instead of a test index and a query point.
    • Added EigenMetricL1 and EigenMetricL2.
  • Added support for approximate nearest neighbor searches.

- C++
Published by Jaybro over 5 years ago

pico_tree - v0.4.0

PicoTree v0.4.0 is the first release of this repository. It provides:

  • C++11 compliant KdTree template class:
    • Nearest neighbors, radius, and box searches.
    • Customizable nearest neighbor searches, metrics and tree splitting techniques.
    • Compile time and run time known dimensions.
    • Static tree builds.
    • Thread safe queries.
  • CMake based build and installation.
  • Doxygen generated documentation.
  • Examples showing how to use the KdTree.
  • Comparison benchmark with respect to Nanoflann.

- C++
Published by Jaybro over 5 years ago