Giter VIP home page Giter VIP logo

symisc / sod Goto Github PK

View Code? Open in Web Editor NEW
1.7K 89.0 209.0 3.5 MB

An Embedded Computer Vision & Machine Learning Library (CPU Optimized & IoT Capable)

Home Page: https://sod.pixlab.io

License: Other

C 99.47% Makefile 0.04% HTML 0.50%
computer-vision library deep-learning image-processing object-detection c cpu real-time convolutional-neural-networks face-detection facial-landmarks machine-learning-algorithms image-recognition image-analysis vision-framework embedded detection iot-device iot webassembly

sod's Introduction

SOD

An Embedded Computer Vision & Machine Learning Library
sod.pixlab.io

API documentation dependency Getting Started license Forum Tiny Dreal

Output

SOD Embedded

Release 1.1.9 (July 2023) | Changelog | Downloads

SOD is an embedded, modern cross-platform computer vision and machine learning software library that exposes a set of APIs for deep-learning, advanced media analysis & processing including real-time, multi-class object detection and model training on embedded systems with limited computational resource and IoT devices.

SOD was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in open source as well commercial products.

Designed for computational efficiency and with a strong focus on real-time applications. SOD includes a comprehensive set of both classic and state-of-the-art deep-neural networks with their pre-trained models. Built with SOD:

Multi-class object detection

Cross platform, dependency free, amalgamated (single C file) and heavily optimized. Real world use cases includes:

  • Detect & recognize objects (faces included) at Real-time.
  • License plate extraction.
  • Intrusion detection.
  • Mimic Snapchat filters.
  • Classify human actions.
  • Object identification.
  • Eye & Pupil tracking.
  • Facial & Body shape extraction.
  • Image/Frame segmentation.

Notable SOD features

  • Built for real world and real-time applications.
  • State-of-the-art, CPU optimized deep-neural networks including the brand new, exclusive RealNets architecture.
  • Patent-free, advanced computer vision algorithms.
  • Support major image format.
  • Simple, clean and easy to use API.
  • Brings deep learning on limited computational resource, embedded systems and IoT devices.
  • Easy interpolatable with OpenCV or any other proprietary API.
  • Pre-trained models available for most architectures.
  • CPU capable, RealNets model training.
  • Production ready, cross-platform, high quality source code.
  • SOD is dependency free, written in C, compile and run unmodified on virtually any platform & architecture with a decent C compiler.
  • Amalgamated - All SOD source files are combined into a single C file (sod.c) for easy deployment.
  • Open-source, actively developed & maintained product.
  • Developer friendly support channels.

Programming Interfaces

The documentation works both as an API reference and a programming tutorial. It describes the internal structure of the library and guides one in creating applications with a few lines of code. Note that SOD is straightforward to learn, even for new programmer.

Resources Description
SOD in 5 minutes or less A quick introduction to programming with the SOD Embedded C/C++ API with real-world code samples implemented in C.
C/C++ API Reference Guide This document describes each API function in details. This is the reference document you should rely on.
C/C++ Code Samples Real world code samples on how to embed, load models and start experimenting with SOD.
License Plate Detection Learn how to detect vehicles license plates without heavy Machine Learning techniques, just standard image processing routines already implemented in SOD.
Porting our Face Detector to WebAssembly Learn how we ported the SOD Realnets face detector into WebAssembly to achieve Real-time performance in the browser.

Other useful links

Resources Description
Downloads Get a copy of the last public release of SOD, pre-trained models, extensions and more. Start embedding and enjoy programming with.
Copyright/Licensing SOD is an open-source, dual-licensed product. Find out more about the licensing situation there.
Online Support Channels Having some trouble integrating SOD? Take a look at our numerous support channels.

face detection using RealNets

sod's People

Contributors

symisc avatar szsam avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sod's Issues

Invalid read of size 4

Memory checking a program with valgrind returns an invalid read of size 4 in at line 10533 of sod.c.

Minimal example code :

#include <stdlib.h>
#include <math.h>
#include "sod.h"

int main(int argc, char *argv[]) {
	const char *zInput = argv[1];
	sod_img imgIn = sod_img_load_grayscale(zInput);
	sod_img cannyImg = sod_canny_edge_image(imgIn, 0);
	sod_free_image(cannyImg);
	return 0;
}

Valgrind output after compilation in Ubuntu 18.04 amd 64 :

==17492== Invalid read of size 4
==17492==    at 0x1286F8: canny_non_max_suppression (sod.c:10533)
==17492==    by 0x129D0E: sod_canny_edge_image (sod.c:10832)
==17492==    by 0x10B534: main (minimal.c:8)
==17492==  Address 0x4d57f00 is 0 bytes after a block of size 473,600 alloc'd
==17492==    at 0x483AB35: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==17492==    by 0x1234A3: sod_make_image (sod.c:9190)
==17492==    by 0x129C67: sod_canny_edge_image (sod.c:10827)
==17492==    by 0x10B534: main (minimal.c:8)
==17492== 

realnet_train_model

Parsing done. Processing network layers now..

Processing layer: 'paths'..

Processing layer: 'detector'..

Collecting positive samples..

Entering directory: 'pedestrian_dataset/positives'..

Over 300 positive samples were collected so far..

Over 600 positive samples were collected so far..

Over 900 positive samples were collected so far..

Over 1200 positive samples were collected so far..

Over 1500 positive samples were collected so far..

Over 1800 positive samples were collected so far..

Over 2100 positive samples were collected so far..

Over 2400 positive samples were collected so far..

Over 2700 positive samples were collected so far..

2908 positive samples were collected on directory: 'pedestrian_dataset/positives'

Collecting negative samples..

IO error while entering directory: 'pedestrian_dataset/background'

The function of the training model has a BUG

I set up the positive sample and negative sample path and add the training file in two directories, the first positive sample load is no problem, but the second negative sample load appears "IO error while entering directory" error, I try to adjust the code in sod.c, "detector_layer_exec" in "DetectorCollec". TSamples (pDet, pPath->sPosPath.zString, SOD_TR_SAMPLE_POS, pPath->recurse, 0) "and" DetectorCollectSamples (pDet, pPath->sNegPath.zString, SOD_TR_SAMPLE_NEG, pPath->recurse, 0) "position,The final result is that the negative sample is loaded successfully, but the positive sample loading fails, prompting the error of "IO error while entering directory", and this is not a heap overflow problem caused by "FindFirstFileW".

About pre-trained modules

I just failed to access the download page of pre-trained modules (url like pixlab.io/download), anybody could help me ?

How to work with video?

Does sod support video input and output? OpenCV doesn't support Iplimage anymore and I don't know how to convert from Iplimage to sod_img

Target HW

Hello everyone,

Firstly great thanks for work. And second,

What exactly sod is?

Not an issue

How should we convert an AVFrame (ffmpeg decoding result in RGB format) to sod_img ?

Python bindings

Thank you for the great framework. s there any python bindings?

Does this library help in drawing the bounding boxes ?

Hi,
Ive a set of bounding box coordinates of objects inside a 1 minute video file.
I would like to draw these bounding boxes and display them over video file smoothly.
My hardware is RaspberryPi4.
Will SOD work for drawing bounding boxes ? And is it faster ?
Also is there any example of SOD for basic video processing ?

Possible to use RealNets for object detection?

Is it possible to use RealNets for object detection as sod_cnn interfaces do?

for example:
Train a model like "tiny20.sod" using sod_trainning interfaces.

And the model is used in sod_realnet_detect for 20-class object detection & classification.

About disable SSE2

Hi,
I'm working on the project that is going to integrate the sod as a benchmark. Unfortunately, we are blocked at the compilation stage, our environment set up let us we can't support SSE2. We have plenty of error regarding:
for example:
always_inline function '_mm_load_si128' requires target feature 'sse2', but would be inlined into function 'stbi__idct_simd' that is compiled without support for 'sse2'
is that possible there is some alternative function as _mm_load_si128 _mm_set1_epi32 _mm_set1_epi16, etc. It is inside the sod_img_reader.h.

how to train realnet face detection

I want to train realnet face detection I have downloaded genki4k data set want to train the model and test the accuracy but this pedestrian detector is looking as object classification not object detection for face detection its object detection so how can i train objection on real net
what I mean is I have trained many object detection and everyone requires object coordinates (means bounding box, lable image) but on this tutorial there is nothing like this.

Adding benchmarks?

It would be interesting to see benchmarks (esp. on embedded devices like the RbP3 / RbP3+) of both the accuracy and the performance of the detectors (personally I am especially interested in the RealNets face detector/extractor) - this would also hopefully help guide people towards your product :)

The problem of training samples

What are the requirements of the SOD training model for samples? How do we deal with the positive and negative samples? Are there any restrictions on the size and so on?

CNN Face Detector Accuracy

Hi,

Before buying the model i just want to check the accuracy on my own dataset.

Q1. Does it work on linux ?
Q2. If you can share an .exe with a parameter as path of the video file i will check the accuracy.

Thanks.

Application/User Information

I think some more work is needed on the user/application information for different platforms to help get this great library into embedded systems . The information provided says its only required to add 4 c-files to a project but this is not the case since these files reference many .h files that are not included in many toolchains for example GNU eabi toolchain used with STM32CubeIDE. Thank you

Single channel/Gray scale depth not working

Hi,

I am trying out some processing with grayscale and black and white images, I find some problems with channel depth in some functions.

I am using Windows 7 and the GNU compiler with Codeblocks as IDE.

When using sod_img_blob_save_as_bmp() with channels set to 1, the output still contains 3 channels. Below is some code I used to test this.

`
sod_img imgIn = sod_img_load_from_file(zInput,SOD_IMG_GRAYSCALE); //

/* Perform canny edge detection. */
sod_img imgOut = sod_canny_edge_image(imgIn, 0 );

    /* Finally save our processed image to the specified path */
/* first make it a blob so we can use bmp saving)
unsigned char *zPng = sod_image_to_blob(imgOut);
sod_img_blob_save_as_bmp(zOut, zPng, 240, 240, 1  );

`

SOD Model unable to open

Getting error when running Face detection.

"Cannot open SOD model"

It is not described what this error means and how to solve it. Would be great to know.


`CC = clang
CFLAGS = -lm -Ofast -march=native -Wall -std=c99

sod: sod.c
	$(CC) sod.c samples/cnn_face_detection.c -o sod_face_detect -I. $(CFLAGS)`

Memory allocating

I was trying to use SOD for plate detection.
At the code, you are using malloc for allocating memory, but not carry about "value" that is "filled" at the allocated space. For example, in sod.c:10828(sod_canny_edge_image) you allocate memory for variable "dir" and then using it in some functions. At sod.c:10521 you are using this variable "dir" with comparing of elements, contained at "dir" with 0, 1, 2 and 3-int values at the switch/case construction. It's not correct, because at the allocated memory can be garbage with different values.
When I was using VisualStudio program was working OK, but not for MinGW: MinGW set allocated memory to "0"-values and I catch a SEGFAULT signal.
So if I paste after allocating memory
memset(dir, INT_MIN, im.w * im.h * sizeof(int));
All is working OK at the different compilers. So my suggestion is to use memset always after allocating memory.
Additional info:
OS Windows 10, Compiler - g++ (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 7.2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.