Code
From Computer Vision at Waterloo
The following code libraries are freely available for research purposes only.
Check each download for documentation, usage requirements (what to cite), and licensing information.
Volumetric Loss for Weakly-supervised Semantic Segmentation
This GitHub repository implements the volumetric loss for training weakly-supervised semantic segmentation. The weak supervision is in the form of size targets representing the relative size of classes in the input image. The algorithm can also be integrated with other forms of supervision like scribble/seeds. The volumetric loss and size target approach are general and can be used with any segmentation architecture. The library is based on PyTorch and DeepLabV3+. The code was implemented by Xingye Fan (former Master student).
Downloads:
- Source code: target-size-main.zip – July 20th, 2024
- Relevant paper: (submitted to NeurIPS 2024)
Soft Self-labeling for Potts Relaxations
This github repository implements the self-labeling algorithm using soft pseudo-labels for training the weakly-supervised semantic segmentation with different Potts relaxations. Our approach can be applicable to any segmentation network architectures, and can outperform the full-supervision in some cases. The code is based on PyTorch. The code was implemented by Rex Zhang (former PhD student).
Downloads:
- Source code: WeaklySegmentationQuadraticCRF-master.zip – July 18th, 2024
- Relevant paper: (submitted to NeurIPS 2024)
EM Algorithm for Collision Cross Entropy
This library implements the EM algorithm for optimizing the soft pseudo-labels in the approximate surrogate loss of standard entropy-based clustering loss, which uses the collision cross entropy. The code is based on Numpy and Numba. The code was implemented by Rex Zhang (former PhD student).
Downloads:
- Source code: EM_CCE.zip – July 16th, 2024
- Relevant paper: Collision Cross-entropy for Soft Class Labels and Deep Clustering (submitted to NeurIPS 2024).
Vascular Tree Reconstruction
Github:
- Link: https://github.com/MenelauseZzw/Vascular-Tree-Reconstruction – March 25th, 2021
Regularized Losses for CNN Segmentation
This github repository implements the Regularized Lossesfor training weakly-supervised semantic segmentation. The weak-supervision are in the form of scribbles. Our weakly supervised approach achieves segmentation almost as accurate as that with full-supervision. The regularized losses are applicable to any CNN for segmentation. The library is based on Caffe and DeepLabV2. The code was implemented by Meng Tang.
Downloads:
- Source code: https://github.com/meng-tang/rloss/archive/master.zip – September 1st, 2018
- Relevant paper: ECCV2018+CVPR2018.
Convexity Shape Prior
This library implements the TR_Convexity algorithm for binary image segmentation with convexity shape prior and L1 color separation term (see OneCut below). The library includes matlab files, C++ code/executable for maxflow/mincut and user interface for scribbles. The code was implemented by Lena Gorelick.
Downloads:
- Source code: TR_convexity_v1.05.zip – May 27, 2016
- Relevant paper: ECCV2014.
LSA-TR
The LSA_TR library is a general optimization algorithm for arbitrary binary pairwise energies. It implements the LSA-TR algorithm. The library includes matlab files along with C++ code for maxflow/mincut. The code was implemented by Lena Gorelick.
Downloads:
- Source code: LSA_TR_v2.03.zip – June 16, 2016
- Relevant paper: CVPR2014.
OneCut with Seeds
The OneCutWithSeeds library is an interactive figure/background segmentation tool. It implements the OneCut algorithm. The library includes C++ code, executable and user interface for scribbles. The code was implemented by Lena Gorelick.
Downloads:
- Source code: OneCutWithSeeds_v1.03.zip – September 21, 2015
- Relevant papers: ICCV2013.
Max-flow/min-cut
The maxflow-v3.01 library computes max-flow/min-cut on arbitrary graphs. It implements the Boykov-Kolmogorov algorithm, which tends to be is fast for computer vision problems. The B-K algorithm and its first implementation were developed while the authors were at Siemens Corporate Research, but we cannot distribute the original version. The code here was independently re-implemented by Vladimir Kolmogorov based on published materials.
Downloads:
- Source code: maxflow-v3.01.zip – January 26, 2010
- Matlab Wrapper by Andrew Delong: BK_matlab.zip – June 9, 2014
- Relevant papers: PAMI2004.
Planar Graph Cut
The PlanarCut-v1.0.2 library computes max-flow/min-s-t-cut on planar graphs. It implements an efficient algorithm, which has almost linear running time. The library also provides for several easy-to-use interfaces in order to define planar graphs that are common in computer vision applications. The code was implemented by Eno Töppe and Frank R. Schmidt
Note: This code only works for planar graphs (including the terminal nodes). For more general problems, please use maxflow or gco (see below).
Downloads:
- Source code: PlanarCut-v1.0.2.zip – January 9, 2013 (LGPL)
- Relevant paper: CVPR2009.
Multi-label optimization
The gco-v3.0 library is for optimizing multi-label energies via the α-expansion and α-β-swap algorithms. It supports energies with any combination of unary, pairwise, and label cost terms. Written in C++, it comes bundled with a MATLAB wrapper. The code was developed by Olga Veksler and Andrew Delong. Andreas Mueller (U. Bonn) has written a Python wrapper for gco.
New in version 3.0 – older versions here
- Label cost support in α-expansion, including costs on subsets of labels ("category costs").
- Sparse data cost support, for when each label is feasible for only a small fraction of sites; a fast special case!
- Adaptive cycles for α-expansion are used by default; often faster, but sometimes slower, so try both.
Downloads:
- Source code: gco-v3.0.zip – Apr 28 2010 – patched Oct 14, 2014 to allow float/double energy terms
- Relevant papers: PAMI2001, PAMI2004a, PAMI2004b, and (if using label costs) IJCV2012.
Requirements:
- Visual C++ 2005 (VC8); GCC 4.03 (warning: not well-tested with GCC)
- MATLAB 7.4 (R2007a) for 32-bit wrapper; MATLAB 7.6 (R2008) for 64-bit wrapper
Max-flow/min-cut for massive grids
The regionpushrelabel-v1.08 library computes max-flow/min-cut on huge N-dimensional grid-graphs in graphics, vision, and medical imaging. The C++ implementation is designed specifically for multi-core systems and graphs larger than available memory. Besides nearest-neighbour graphs, the library also supports more complex regular structures to speed up things like QPBO, cell complexes, and Ishikawa-like constructions. The public implementation was developed by Sameh Khamis who is now at the University of Maryland.
Downloads:
- Source code: regionpushrelabel-v1.08.zip – March 25, 2011 – updated June 25, 2012
- Relevant papers: CVPR2008
Requirements:
- Visual C++ 2008 (VC9) or GCC 4.4.1
- Boost C++ libraries version 1.39 or later
Max-flow/min-cut for shape fitting
The TouchExpand library efficiently computes globally optimal max-flow on a special type of graph. The touch-expand algorithm relies on sparse unary terms (source/sink arcs) to solve max-flow in a memory-efficient manner. Such sparse unary terms arise, for example, in shape-from-points problems. The algorithm works within a narrow band, growing it in an on-demand fashion, until a global optimum of the full problem is guaranteed. The code is by Victor Lempitsky and is based on the maxflow-v3.0 library.
Downloads:
- Source code: TouchExpand.zip
- Relevant papers: CVPR2007 + TECHREPORT.