ScaleLSD, converted for line-detection

The ScaleLSD line segment detector (Ke, Tan, Zheng, Shen, Wu, Xue: ScaleLSD: Scalable Deep Line Segment Detection Streamlined, CVPR 2025), converted for the line-detection Rust crate: MLX (Apple silicon GPU) and ONNX Runtime (CPU, elsewhere). The network is unchanged; only its form is.

Source: cherubicxn/scalelsd at revision f0a119fb3d4a12c53c317a8746db80d267fb2a0f (scalelsd-vitbase-v1-train-sa1b.pt, scalelsd-vitbase-v2-train-sa1b.pt), Apache-2.0, by the paper's authors. Code: ant-research/scalelsd (MIT).

File Bytes SHA-256
scalelsd-v2.mlx.safetensors 491584356 7b2c5d543497c32c6b335cb42579f2bce665adf03ff88a4552d4ad6f1d94cb87
scalelsd-v2.onnx 487250428 fd03cdd5e1ca708ea2a92bfd7be5feddfdfb8a75f5b9729bad0980fba7df3d70
scalelsd-v1.mlx.safetensors 491584356 fd334a8feabc617c459e3f197170388ad08e6a755fbca659473f68afa7aba828
scalelsd-v1.onnx 487180278 318a234dfeb71e2b078da4f6a130b285c54356560d6c10fba35a6995906a1425

The authors recommend v2 (LayerScale, AdamW).

What the files are

Both take a 512x512 grey image in 0..1 and give the network's 9 output maps at 256x256 (logits: 3 line-direction channels, distance, residual, 2 junction-class, 2 junction-offset). Decoding them into line segments and junctions is left to the caller (the crate does it, as ScaleLSD's own forward_test does).

  • *.mlx.safetensors: inference-ready weights for a fixed 512x512 input: the ResNet stem's weight standardisation applied, batch norm folded into the convolutions, position embeddings resized to the 32x32 token grid, the ImageNet classifier dropped, convolutions in MLX's layout (out, kh, kw, in).
  • *.onnx: the same network, input image 1x1x512x512, output maps 1x9x256x256, opset 18.

convert.py made them: the checkpoints loaded with torch.load(weights_only=True); a plain restatement of the network built from the converted weights alone reproduces the original (max |diff| 4e-4 on logits up to 29), and the ONNX export does too (1e-3).

Licence

The weights are the authors', under Apache-2.0 (as the source repository states); this conversion is distributed under the same licence. ScaleLSD's code is MIT, copyright 2023 Nan Xue.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support