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


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
  • Need help in creating libccv.so

    Need help in creating libccv.so


    I am using ccvwrapper from https://zablo.net/blog/post/stroke-width-transform-swt-python/index.html. When i tried clang to make .so file on ccvwrapper it is missing required symbols. I tried using steps mentioned https://pypi.org/project/ccv/ , but the patching is not working. Can anyone assist me creating wrapper on ccv .

    Thanks, Arun.

    opened by nannuarun 0
  • 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
The PULP Ara is a 64-bit Vector Unit, compatible with the RISC-V Vector Extension Version 0.9, working as a coprocessor to CORE-V's CVA6 core

Ara Ara is a vector unit working as a coprocessor for the CVA6 core. It supports the RISC-V Vector Extension, version 0.9. Dependencies Check DEPENDEN

null 185 Dec 24, 2022
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 65.7k Jan 4, 2023
open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.

OpenMVG (open Multiple View Geometry) License Documentation Continuous Integration (Linux/MacOs/Windows) Build Code Quality Chat Wiki local/docker bui

openMVG 4.6k Jan 8, 2023
Implementations of Multiple View Geometry in Computer Vision and some extended algorithms.

MVGPlus Implementations of Multiple View Geometry in Computer Vision and some extended algorithms. Implementations Template-based RANSAC 2D Line estim

Chenyu 6 Apr 7, 2022
Mobile Robot Programming Toolkit (MRPT) provides C++ libraries aimed at researchers in mobile robotics and computer vision

The MRPT project 1. Introduction Mobile Robot Programming Toolkit (MRPT) provides C++ libraries aimed at researchers in mobile robotics and computer v

MRPT 1.6k Dec 24, 2022
Open source modules to interface Metavision Intelligence Suite with event-based vision hardware equipment

Metavision: installation from source This page describes how to compile and install the OpenEB codebase. For more information, refer to our online doc

PROPHESEE 106 Dec 27, 2022
Episodic Transformer (E.T.) is a novel attention-based architecture for vision-and-language navigation.

Episodic Transformer (E.T.) is a novel attention-based architecture for vision-and-language navigation. E.T. is based on a multimodal transformer that encodes language inputs and the full episode history of visual observations and actions.

Alex Pashevich 61 Nov 17, 2022
ROS wrapper for real-time incremental event-based vision motion estimation by dispersion minimisation

event_emin_ros ROS wrapper for real-time incremental event-based vision motion estimation by dispersion minimisation (EventEMin). This code was used t

Imperial College London 2 Jan 10, 2022
Code and Data for our CVPR 2021 paper "Structured Scene Memory for Vision-Language Navigation"

SSM-VLN Code and Data for our CVPR 2021 paper "Structured Scene Memory for Vision-Language Navigation". Environment Installation Download Room-to-Room

hanqing 35 Dec 3, 2022
deep learning vision detector/estimator

libopenvision deep learning visualization C library Prerequest ncnn Install openmp vulkan(optional) Build git submodule update --init --recursuve cd b

Prof Syd Xu 3 Sep 17, 2022
Homework of RoboWalker Vision team of USTC for DJI Robomaster competition.

USTC RoboWalker战队 视觉组2022练习作业 “极限犹可突破,至臻亦不可止。” 作业列表 0. 编程基础教程 Hello World 针对没有学过C++/Python、没有太多相关编程经验的新同学的C++ & Python编程入门教程。 0. Git基础教程 Hello Git 学习世

Zhehao Li 4 Feb 20, 2022
VNOpenAI 31 Dec 26, 2022
The core engine forked from NVidia's Q2RTX. Heavily modified and extended to allow for a nicer experience all-round.

Nail & Crescent - Development Branch Scratchpad - Things to do or not forget: Items are obviously broken. Physics.cpp needs more work, revising. Proba

PalmliX Studio 21 Dec 22, 2022
A program developed using MPI for distributed computation of Histogram for large data and their performance anaysis on multi-core systems

mpi-histo A program developed using MPI for distributed computation of Histogram for large data and their performance anaysis on multi-core systems. T

Raj Shrestha 2 Dec 21, 2021
A fast and modern voxel based raytracing engine

CubiCAD A fast and modern voxel based raytracing engine Currently in heavy development and unusable at its current state. This reposity will hold the

RedNicStone 14 Sep 6, 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 Dec 14, 2022
Computer Science Bridge Program at NYU Tandon School of Engineering

NYU Tandon Bridge 2021 (24 Week) Personal notes, resources, and exercises for the Computer Science Bridge Program at NYU Tandon School of Engineering.

Sarah Tahir 42 Dec 22, 2022
The code for C programming 2021, Department of Computer Science, National Taiwan University.

C2021 .c for sousce code, .in for input file, and .out for correct output. The numbers are the problem indices in the judge system. "make number" to m

Pangfeng Liu 6 Jan 10, 2022
Computer Networks, [email protected], taught by Hong Xu

CSCI4430, Computer Networks (Spring 2022) Administrivia Schedule Lectures: Mon 12:30pm -- 2:15pm, ERB LT (Zoom link) Tue 4:30pm -- 5:15pm, ERB LT (Zoo

Hong Xu 15 Dec 15, 2022