After applying [`r.thin`](https://grass.osgeo.org/grass77/manuals/r.thin.html) and then [`r.to.vect`](https://grass.osgeo.org/grass77/manuals/r.to.vect.html) to a raster image the resulting vector layer contains hundreds of small *"branches"* that are not supposed to be there:

[![Vector layer showing unwanted branches](https://i.stack.imgur.com/IjtMx.jpg)](https://i.stack.imgur.com/IjtMx.jpg)

I've tried selecting and deleting these mini branches using a `$length` field in the layer's attribute table but that also deleted short segments in the main contours I want to keep.

A solution would be to identify all short paths where `nodes_to_points = 2` and `number of intersecting vertices = 1` as this would leave out the paths that are part of the contour (and therefore have 2 intersecting vertices). 

Does anybody know how to write this as an expression in the Field Calculator or can think of a better way to remove my unwanted artefacts?