C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library

Related tags

Machine Learning ccv

Build Status

  • Travis CI VM: Build Status on Travis CI VM
  • Linux x64: Build Status on Linux
  • Raspberry Pi 3: Build Status on Raspberry Pi 3
  • Jetson TX2: Build Status on Jetson TX2


I set to build ccv with a minimalism inspiration. That was back in 2010, out of the frustration with the computer vision library then I was using, ccv was meant to be a much easier to deploy, simpler organized code with a bit caution with dependency hygiene. The simplicity and minimalistic nature at then, made it much easier to integrate into any server-side deployment environments.

Portable and Embeddable

Fast forward to now, the world is quite different from then, but ccv adapts pretty well in this new, mobile-first environment. It now runs on Mac OSX, Linux, FreeBSD, Windows*, iPhone, iPad, Android, Raspberry Pi. In fact, anything that has a proper C compiler probably can run ccv. The majority (with notable exception of convolutional networks, which requires a BLAS library) of ccv will just work with no compilation flags or dependencies.

Modern Computer Vision Algorithms

One core concept of ccv development is application driven. Thus, ccv ends up implementing a handful state-of-art algorithms. It includes a close to state-of-the-art image classifier, a state-of-the-art frontal face detector, reasonable collection of object detectors for pedestrians and cars, a useful text detection algorithm, a long-term general object tracking algorithm, and the long-standing feature point extraction algorithm.

Clean Interface with Cached Image Preprocessing

Many computer vision tasks nowadays consist of quite a few preprocessing layers: image pyramid generation, color space conversion etc. These potentially redundant operations cannot be easily eliminated within a mature API. ccv provides a built-in cache mechanism that, while maintains a clean function interface, effectively does transparent cache for you.

For computer vision community, there is no shortage of good algorithms, good implementation is what it lacks of. After years, we stuck in between either the high-performance, battle-tested but old algorithm implementations, or the new, shining but Matlab algorithms. ccv is my take on this problem, hope you enjoy it.

Deep Learning



ccv source code is distributed under BSD 3-clause License.

ccv's data models and documentations are distributed under Creative Commons Attribution 4.0 International License.

  • face detection

    face detection

    Acf feature based method of piotr dollar's toolbox get excellent performance for face detection and pedestrian detection. I appreciate you can implement this in your ccv (replace icf feature).

    opened by james-zhangyk 15
  • Unable to duplicate BBF test accuracy

    Unable to duplicate BBF test accuracy

    I'm new to ccv, so I thought I'd start by building latest stable (and unstable), and at least see if I could duplicate the bbfdetect face detection accuracy score from https://github.com/liuliu/ccv/blob/stable/doc/bbf.md

    Unfortunately, I don't seem to be able to do so; I only get a score of "53.82% (30)" when I follow the steps; far worse than the quoted "82.97% (12)". I get the same result for stable and unstable branches.

    I'm running on OSX 10.8.3 with the following lib/config.mk:

    XCODE_SDK := macosx10.8
    ARCH := x86_64
    CC := clang
    AR := ar
    CFLAGS := -I/usr/local/include -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -msse2 -D HAVE_SSE2 -D HAVE_LIBJPEG -D HAVE_LIBPNG -I/usr/X11/include -D HAVE_FFTW3 -D HAVE_LIBLINEAR -D HAVE_ACCELERATE_FRAMEWORK
    LDFLAGS := -L/usr/local/lib -lm -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -ljpeg -lpng -lz -L/usr/X11/lib -lfftw3f -lfftw3 -llinear -framework Accelerate

    I have local installs in /usr/local of libpng(1.5.14), libjpeg(v9), fftw(3.3.3), and linear(1.93). I also tried gsl(1.15), with same results. I have XCode(4.6.1) with up-to-date command line tools etc.

    I converted the CMU gif files to png as per your example, using ImageMagick (6.8.3-10, darwin 12.3.0).

    My generated CMU filelist.txt has 130 entries, and truth.txt has 511 entries. After running bbfdetect on filelist.txt, the generated result.txt has 305 entries.

    Do you have any thoughts or suggestions as to how I might be able debug this further, so that I can match your results from the bbf.md doc?


    opened by fsomers 12
  • provide a detector model for icf pedestrian detection

    provide a detector model for icf pedestrian detection

    It is great that ccv will add icf based algorithm for pedestrian detection. Hope to provide a detection model and brief usages (just like BBF, DPM, etc) to use it.

    opened by james-zhangyk 11
  • libccv cifar-10.c

    libccv cifar-10.c

    Hey I am training cifar-10.c using the cifar dataset. I want to inform the maker that I think there is an error in the backpropagate function in the ccv_convnet.c file. Plz someone help. Its urgent

    opened by nirwandogra 10
  • ccv_sobel() speed improvements

    ccv_sobel() speed improvements

    While profiling some of the different built in functions I noticed that ccv_sobel() appears to consume a significant amount of time particularly on iOS devices. I would assume the best way to attempt to improve the performance would be to use SIMD instructions, like NEON for ARM or MMX for Intel. However given the way the current function is implemented it seems like it could become messy and a non-trivial task. Is this as good as it gets or is there a way to get performance up cleanly?

    opened by mledford 10
  • 64 bit on osx bin files won't compile.

    64 bit on osx bin files won't compile.

    I am using OSX lion( 10.7.4) on a i7 quad core. When I go to the lib directory and ./configure and make (choosing clang) I am able to successfully compile from that make file. However when I move into the bin directory to compile the c files in that directory this is what follows:

    ➜ bin git:(unstable) make make -C ../lib


    make[2]: Nothing to be done for `all'. clang bbffmt.c -o bbffmt.o -c -O3 -Wall -I../lib -D HAVE_LIBJPEG clang -o bbffmt bbffmt.o -L../lib -lccv -ljpeg -lm Undefined symbols for architecture x86_64: "_isnanf", referenced from: _ccv_any_nan in libccv.a(ccv_util.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [bbffmt] Error 1 ➜ bin git:(unstable)

    I feel like this is just a simple flag issue in the makefile. how do i get it to recognize 64bit ness or will i have to pass a i386 flag?

    opened by Sophrinix 8
  • Channel parallelization

    Channel parallelization

    Good morning, Liu Liu. I am a student and researcher of University of Campinas (UNICAMP) in campinas, Brazil.

    In my latest project we worked with you ccv lib. The main purpose of the project was accelerating the execution time. In the study our main 'weapon' was the usage of parallel routines provided by open mp.

    With that said, we found 2 hotspots for optimizing your code, they are: 1 - Parallelize the execution of ccv_swt (called in ccv_detect_words) for each channel (dark_to_bright and bright_to_dark). This reasulted in a good speedup! 2 - The second optimization was based on canny filter. We noticed that ccv_canny was called inside ccv_swt and that ccv_canny called ccv_sobel inside it. But ccv_sobel was also calculated in ccv_swt! So we moved the calculation of ccv_sobel in ccv_swt to before ccv_canny and created a new function based on ccv_canny called ccv_canny_no_sobel which is the same as ccv_canny but receives as input the result of a sobbel execution and don't calculate it again inside it! This also generated a good speedup!

    This 2 optimizations can be found on a fork that I did of your branch. It can be found on https://github.com/krautz/ccv

    If you like our research project, please feel free to let me send you a merge request with this optimizations!

    Thank you! Caio Krauthamer

    opened by krautz 7
  • Memory corruption / undefined behaviour in SWT

    Memory corruption / undefined behaviour in SWT


    I've discovered some serious problems in SWT implementation. Looks like it corrupts memory.
    Here I've some added code to reproduce the problem, full description how to run it is in Readme.

    As I can see, there are problems with canny implementation and caching code. Help is required to fix it.

    One of the errors (valgrind output): ==6025== Invalid write of size 4 ==6025== at 0x5C2E09: ccv_canny (in /home/xxx/src/repo/libccv_fork/ccv/test/testapp/Debug/testapp) ==6025== by 0x40835E: ccv_swt (in /home/xxx/src/repo/libccv_fork/ccv/test/testapp/Debug/testapp) ==6025== by 0x4399CF: ccv_swt_detect_words (in /home/xxx/src/repo/libccv_fork/ccv/test/testapp/Debug/testapp) ==6025== by 0x4032E6: detectTextOnImage(ccv_dense_matrix_t*, ccv_swt_param_t const&, bool) (main.cpp:35) ==6025== by 0x403296: main (main.cpp:29) ==6025== Address 0x69cc790 is 560 bytes inside an unallocated block of size 162,768 in arena "client"

    launch-blocking next-bugfix-version 
    opened by MrEsp 7
  • No CUDA training error

    No CUDA training error

    I'm trying to run training on a mac and tried two different computers, both fail here:

    - at epoch 001 / 100 => going through 1 / 2 for testsAssertion failed: (CCV_GET_CHANNEL((*a)->type) == convnet->channels), function ccv_convnet_encode, file ccv_convnet.c, line 647. Abort trap: 6

    I'm wondering if you could shed some light on how to fix this.


    opened by billychasen 7
  • ccv bin/cuda compile error

    ccv bin/cuda compile error

    Hey, I compile ccv without any issues (Ubuntu 14.04 64-bit with CUDA 6.0 SDK).

    However, when I try compiling the files bin/cuda to do benchmarking, I get the following errors. I checked the paths, and they look fine, and the files in lib/cuda are getting included properly, so I'm not sure why it's not able to see the static functions.

    Any insights? Or can you successfully compile the binaries in bin/cuda without any issues?

    make[1]: Leaving directory `/home/fatbox/code/convnet-benchmarks/ccv/ccv/lib'
    clang cwc-bench.c -o cwc-bench.o -c -O3 -Wall -I"../../lib" -msse2 -D HAVE_LIBPNG -D HAVE_LIBJPEG -D HAVE_FFTW3 -D HAVE_CBLAS -D HAVE_AVCODEC -D HAVE_AVFORMAT -D HAVE_SWSCALE -D HAVE_SSE2 -D HAVE_CUDA
    nvcc cwc-bench-runtime.cu -o cwc-bench-runtime.o -c -O3 -I"../../lib" -lineinfo --use_fast_math -arch=sm_30 -D HAVE_LIBPNG -D HAVE_LIBJPEG -D HAVE_FFTW3 -D HAVE_CBLAS -D HAVE_AVCODEC -D HAVE_AVFORMAT -D HAVE_SWSCALE -D HAVE_SSE2 -D HAVE_CUDA
    cwc-bench-runtime.cu(18): error: identifier "_cwc_convnet_batch_formation" is undefined
    cwc-bench-runtime.cu(111): error: identifier "_cwc_convnet_convolutional_backward_propagate" is undefined
    cwc-bench-runtime.cu(119): error: identifier "_cwc_convnet_full_connect_backward_propagate" is undefined
    cwc-bench-runtime.cu(123): error: identifier "_cwc_convnet_rnorm_backward_propagate" is undefined
    cwc-bench-runtime.cu(127): error: identifier "_cwc_convnet_max_pool_backward_propagate" is undefined
    cwc-bench-runtime.cu(131): error: identifier "_cwc_convnet_average_pool_backward_propagate" is undefined
    6 errors detected in the compilation of "/tmp/tmpxft_00002dd2_00000000-6_cwc-bench-runtime.cpp1.ii".
    make: *** [cwc-bench-runtime.o] Error 2
    opened by soumith 7
  • Nan and -inf when calling ./dpmcreate

    Nan and -inf when calling ./dpmcreate

    I am currently trying to use dpmcreate to train a single component, no parts, HOG detector baseline, using INRIA training data.

    Training seems to go wrong since it reports

     - collecting negative examples -- (100%)             
     - tune model 1 constant for -inf
     - collecting negative examples -- (100%) 
     - tune model 1 constant for nan

    Which I suspect to be very wrong.

    Full outputs as follows

     ./dpmcreate --positive-list ~/datasets/inria_positives_annotations_fullpath_x_y_width_height.txt --background-list ~/datasets/inria_negatives.txt --negative-count 5000 --model-component 1 --model-part 0 --working-dir ./dpm_cache --symmetric 0
    with 1237 positive examples and 5000 negative examples
    negative examples are are going to be collected from 1218 background images
    use symmetric property? no
    use color? yes
    negative examples cache size : 2000
    1 components and 0 parts
    expected 20 root relabels, 10 relabels, 50 data minings and 1000 iterations
    include overlap : 0.700000
    alpha : 0.010000
    alpha decreasing ratio : 0.995000
    C : 0.002000
    balance ratio : 1.500000
    global mean: 0.339597, & variance: 0.000022
    interclass mean(variance): 0.339597(0.000022)
    computing root mixture model dimensions: 5x15
    root mixture model initialization corrupted, reboot
     - generating positive examples for model 0 : 1237 / 1237
     - generating negative examples for all models : 5000 / 5000
    initializing root mixture model for model 1(1)
     - creating initial model 1 at 5x15
     - converting examples to liblinear format: 6236 / 6237     
     - generated 6236 examples with 2326 dimensions each
     - running liblinear for initial linear SVM model (L2-regularized, L1-loss)
    optimization finished, #iter = 11
    Objective value = -2.434024
    nSV = 1686
     - model->label[0]: 1, model->nr_class: 2, model->nr_feature: 2325
    components == 1, skipped coordinate-descent to optimize root mixture model
    initializing part filters
     - initializing part filters for model 1(1)
    optimizing root filter & part filters with stochastic gradient descent
     - collecting responses from positive examples : 100%  
     - positive examples divided by components : 1192
     - collecting negative examples -- (100%)             
     - tune model 1 constant for -inf
     - collecting negative examples -- (100%) 
     - tune model 1 constant for nan

    I stopped the training since -inf and nan indicate that something is very wrong.

    Using model-part bigger than 0 generates a segfault.

    I am using the stable release of libccv liuliu-ccv-70f8126.

    Any idea of what is going on ?

    opened by rodrigob 7
  • Awesome!


    Very happy to see this ported to Metal. Now that I've given up on S4TF, it would be interesting to learn of a Swift framework (s4nnc) that runs deep learning on Metal. Regardless, I'll probably use MPSGraph directly in my future work instead of a high-level API.

    I haven't seen the nnc directory of this repo get changes, but will that be ported to Metal soon? I also haven't seen Metal shader files yet, while there are custom CUDA shaders. Don't be afraid to use MSL for operations not supported by MPSGraph.

    Screenshot 2022-11-25 at 10 41 27 PM
    opened by philipturner 1
  • How read /dev/video0 with ffmpeg in c++?

    How read /dev/video0 with ffmpeg in c++?


    using ccv with TLD, I want to read pictures from /dev/video0 with an usb cam.

    I will to using ffmpeg like this : ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.avi I have try to follow your example on get starting like :

    #include <ccv.h>
    int main(int argc, char** argv)
            ccv_dense_matrix_t* image = 0;
           ccv_read(argv[1], &image, CCV_IO_RGB_COLOR | CCV_IO_ANY_FILE);

    But seem not clear to me... May I have other possibilities to do that more easily? How can I do this? thank's for help. Laurent.

    opened by LaurentDelaon 0
  • Build on Windows

    Build on Windows

    Hello, Is there a guide/tutorial to build ccv on Windows 10? I tried to make the library in the bin folder and it did not seem to work. Can anyone point to any specific resources?

    Any help is appreciated. Thanks!

    opened by deven-gqc 0
  • Performance regressions with cudnn 8

    Performance regressions with cudnn 8

    Per: https://docs.nvidia.com/deeplearning/sdk/cudnn-release-notes/rel_8.html

    Significant performance regressions observed for cudnn 8 on 2080 Ti (resnet50 from 1400fps down to 300fps with 4x2080Ti).

    opened by liuliu 0
  • Build error

    Build error

    When building the library, the compiler gets stuck on ccv_resample.c and eventually runs out of memory and dies. I have 8GB of RAM and 2GB of swap. I'm using gcc 7.4.0 on ubuntu 18.03. Does this have anything to do with the preprocessor and the "for_block" macros in the code?

    opened by pfeatherstone 5
Open Source Computer Vision Library

OpenCV: Open Source Computer Vision Library Resources Homepage: https://opencv.org Courses: https://opencv.org/courses Docs: https://docs.opencv.org/m

OpenCV 64.9k Nov 19, 2022
An open library of computer vision algorithms

VLFeat -- Vision Lab Features Library Version 0.9.21 The VLFeat open source library implements popular computer vision algorithms specialising in imag

VLFeat.org 1.5k Nov 15, 2022
Frog is an integration of memory-based natural language processing (NLP) modules developed for Dutch. All NLP modules are based on Timbl, the Tilburg memory-based learning software package.

Frog - A Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch Copyright 2006-2020 Ko van der Sloot, Maarten van Gompel, Antal van den

Language Machines 70 Aug 24, 2022
A Modern C++ Data Sciences Toolkit

MeTA: ModErn Text Analysis Please visit our web page for information and tutorials about MeTA! Build Status (by branch) master: develop: Outline Intro

null 658 Nov 22, 2022
RP-VIO: Robust Plane-based Visual-Inertial Odometry for Dynamic Environments (Code & Dataset)

RP-VIO: Robust Plane-based Visual-Inertial Odometry for Dynamic Environments RP-VIO is a monocular visual-inertial odometry (VIO) system that uses onl

Karnik Ram 166 Nov 22, 2022
An SDL2-based implementation of OpenAL in a single C file.

MojoAL MojoAL is a full OpenAL 1.1 implementation, written in C, in a single source file. It uses Simple Directmedia Layer (SDL) 2.0 to handle much of

Ryan C. Gordon 94 Nov 18, 2022
This robot lcoalisation package for lidar-map based localisation using multi-sensor state estimation.

A ROS-based NDT localizer with multi-sensor state estimation This repo is a ROS based multi-sensor robot localisation. An NDT localizer is loosely-cou

null 47 Nov 28, 2022
A Modular Framework for LiDAR-based Lifelong Mapping

LT-mapper News July 2021 A preprint manuscript is available (download the preprint). LT-SLAM module is released.

Giseop Kim 296 Nov 28, 2022
Ingescape - Model-based framework for broker-free distributed software environments

Ingescape - Model-based framework for broker-free distributed software environments Overview Scope and Goals Ownership and License Dependencies with o

The ZeroMQ project 30 Nov 15, 2022
Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference

Edge ML Library (EMLL) offers optimized basic routines like general matrix multiplications (GEMM) and quantizations, to speed up machine learning (ML) inference on ARM-based devices. EMLL supports fp32, fp16 and int8 data types. EMLL accelerates on-device NMT, ASR and OCR engines of Youdao, Inc.

NetEase Youdao 178 Nov 16, 2022
A lightweight C++ machine learning library for embedded electronics and robotics.

Fido Fido is an lightweight, highly modular C++ machine learning library for embedded electronics and robotics. Fido is especially suited for robotic

The Fido Project 412 Sep 19, 2022
A C++ standalone library for machine learning

Flashlight: Fast, Flexible Machine Learning in C++ Quickstart | Installation | Documentation Flashlight is a fast, flexible machine learning library w

Facebook Research 4.6k Nov 25, 2022
libsvm websitelibsvm - A simple, easy-to-use, efficient library for Support Vector Machines. [BSD-3-Clause] website

Libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression. It solves C-SVM classification, nu-SVM classification,

Chih-Jen Lin 4.2k Nov 24, 2022
mlpack: a scalable C++ machine learning library --

a fast, flexible machine learning library Home | Documentation | Doxygen | Community | Help | IRC Chat Download: current stable version (3.4.2) mlpack

mlpack 4.2k Nov 27, 2022
oneAPI Data Analytics Library (oneDAL)

Intel® oneAPI Data Analytics Library Installation | Documentation | Support | Examples | Samples | How to Contribute Intel® oneAPI Data Analytics Libr

oneAPI-SRC 529 Nov 29, 2022
A C library for product recommendations/suggestions using collaborative filtering (CF)

Recommender A C library for product recommendations/suggestions using collaborative filtering (CF). Recommender analyzes the feedback of some users (i

Ghassen Hamrouni 251 Nov 17, 2022
RNNLIB is a recurrent neural network library for sequence learning problems. Forked from Alex Graves work http://sourceforge.net/projects/rnnl/

Origin The original RNNLIB is hosted at http://sourceforge.net/projects/rnnl while this "fork" is created to repeat results for the online handwriting

Sergey Zyrianov 880 Nov 10, 2022
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 23.5k Nov 27, 2022
FoLiA library for C++

Libfolia: FoLiA Library for C++ Libfolia (c) CLS/ILK 2010 - 2021 Centre for Language Studies, Radboud University Nijmegen Induction of Linguistic Know

Language Machines 14 Dec 31, 2021