Comments (10)
Hi inspirit,
I do not mind anybody using code of js-objectdetect, however there might be a licensing issue as js-objectdetect is currently released under GPLv3 (I could perhaps switch to MIT).
However, you should perhaps know that the code used in this library was initially created to serve as a "quick" reference implementation for a GPU based face detector (using WebGL). The code is only compatible to stump based HAAR cascades (https://github.com/foo123/HAAR.js supports all cascades) and has not been tested as thoroughly as it perhaps should have been.
Since canny pruning does not really seem to be effective / increase performance at all, I did not really care that much about further optimizing it. Perhaps your gaussian / canny methods might change that.
Concerning the grayscale conversion, I did some jsperf-tests (http://jsperf.com/convert-rgba-to-grayscale). Performing integer operations instead of floating point operations on the image-data seems to increase performance in all browsers except for IE. Adding more code to the body of the loop however does not change that much. Interestingly, the 8-bit shift integer-version decreased detection performance on the test images (http://mtschirs.github.com/js-objectdetect/examples/example_image.htm). This is because OpenCV (HAAR classifier training) uses 0.299_R + 0.587_G + 0.114_B for RGB to grayscale conversion while your 8-bit shift integer code uses approx. 0.301_R + 0.590_G + 0.109_B. Therefore I now use a 10 bit shift which more closely resembles the OpenCV conversion.
Best regards,
Martin
from js-objectdetect.
hey, thanx for the info. according to license, yes i use MIT for my code. how ever i put all the info about original author :) anyway i will look at another implementation u mentioned to get best of both worlds. personally i dont think that grayscale conversion coeefs will have any significant impact. i also tested different ways to convert to grayscale:
http://jsperf.com/math-vs-lut-grayscale
from js-objectdetect.
to replicate the same grayscale as presented in OpenCV:
var coeff_r = 4899, coeff_g = 9617, coeff_b = 1868;
var pix_gray = ((coeff_r*pix_r + coeff_g*pix_g + coeff_b*pix_b) + 8192) >> 14;
this is using fixed point math to convert float coeffs to integers and then scale back. the same OpenCV used in thei ColorConvert method
from js-objectdetect.
"personally i dont think that grayscale conversion coeefs will have any significant impact" - Well, they have. Using your 8-bit shift coefficients, performance is reduced by 33% in http://mtschirs.github.com/js-objectdetect/examples/example_image.htm. A 10 bit shift seems to have much lesser impact on detection performance there. The 14 bit shift you presented is of course even better, however large shift values also seem to reduce run time performance.
Thank you for all the interesting input though, a closer look at your code reveals some interesting js performance tricks.
from js-objectdetect.
well taking into account 160x120 image conversion time only about 1-3ms i think we should go 14 bit version to get best detection result. i've updated my grayscale method to this latest coeffs.
and if user wants to run detection on large/original image it wont be realtime in any case and grayscale time doesnt really matter.
from js-objectdetect.
yes, you are probably right. It also seems that a bigger shift value only slighly impacts performance on FF while there seems to be no difference for the other browsers.
from js-objectdetect.
btw i did first merge of your implementation:
http://inspirit.ru/jsfeat/haar/
seems to work quite nice.
i also implemented different detection algo (BBF) u can take a look here:
http://inspirit.ru/jsfeat/bbf/
from js-objectdetect.
Looks good!
from js-objectdetect.
MIT or Apache licenses would be ideal! I'd love to be able to use and contribute back to this project!
from js-objectdetect.
...just moved to the MIT license
from js-objectdetect.
Related Issues (20)
- Objectdetect not working at all
- Custom classifier not working. HOT 1
- License HOT 1
- objectdetect.mouth.js HOT 1
- neck detection HOT 1
- not working after custom style change HOT 1
- False positives HOT 1
- Face detection with Pre-recorded video stream HOT 1
- Measuring activity using js-objectdetect
- Mouth/smile detector not working? HOT 8
- hand gesture sdk HOT 2
- noise detections > real detections HOT 12
- hand detection - with rotated hand HOT 4
- [Enhancement] Add package.json
- Mismatch between gh-pages & master files
- Create a new classifier HOT 2
- Consider adding library size to performance comparison
- No Documentation of JSDoc found HOT 1
- Tracking slow in FireFox only
- WebRTC not available HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-objectdetect.