Code Monkey home page Code Monkey logo

toolbox's Introduction

toolbox's People

Contributors

pdollar avatar una-dinosauria 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

toolbox's Issues

Unable to install toolbox

The following command doesn't work.

addpath(genpath('path/to/toolbox/')); savepath;
toolboxCompile;

Are there alternative ways of making the toolbox work or installing it?

Error while trying to use the acfTrain function

I am getting the error:
`
Error using cat
Dimensions of matrices being concatenated are not consistent.

Error in acfTrain>sampleWins (line 259)

Error in acfTrain (line 136)

Error in TrainAPI (line 29)

Dimension of matrices being concatenated are not consistent.
`

I thought at first that perhaps I was not properly specifying the dimensions of the model but after fixing that, I'm still getting this error. I could still be doing something though.

Is it work For Images with different affine and rotation?

Hi every body...
i have trained a model for license plate detection using a set of frontal images
where the plates are in acceptable conditions.
But now i want to test the model on plates with various types of skewness and rotation and sizes. taken with cameras form with different views and different zoom levels.

My idea was to transform my own current data to produce images similar to my test data. but it does not work for images with different zooms.
The problem is that the detected bounding boxes are small for many of the plates.

I am using ACFDetector toolbox version 3.50 on Matlab R2016a Windows 8.1;
objects are plates (cars in road , ground truth is of the size of plates and with padding car and road is in it too)
feature selection : Luv color, Gradient magnitude, Gradiant Histogram. (in one model I use Hog too)

  1. In ACFDetector the size of trained sliding-window object detector is in fixed size.
    Can I change the size of it in one image with fixed size before rescale it in pyramyd(Sth like what happen in Viola and Jones Detector and in ICFDetector).
  2. which parameter do you offer to set and change for this issue.
    3.What part of model training is more important(Classification, Feature Extraction, Size of GT, Train Date, Number of Train Data and ect.) for my problem.

thank you so much....

Training AdaBoost Error

Hello,

There is a potential bug in adaBoostTrain.

Certain parameter settings for the acfTrain function sometime result in error behavior in training, where the err is increasing until NaN, and the loss stops reducing under e-05. Below is an example of the output:

Training AdaBoost: nWeak=6000 nFtrs=2890 pos=531304 neg=500000
i= 16 alpha=1.000 err=0.436 loss=6.11e-01
.
.
.
i= 672 alpha=1.000 err=0.454 loss=2.20e-02
.
.
.
i=1792 alpha=1.000 err=0.477 loss=2.24e-04
i=1808 alpha=1.000 err=0.478 loss=2.17e-04
.
.
.
i=3136 alpha=1.000 err=0.493 loss=8.19e-05
i=3152 alpha=1.000 err=0.493 loss=8.15e-05
i=3168 alpha=1.000 err=0.494 loss=8.12e-05
i=3184 alpha=1.000 err=0.495 loss=8.08e-05
i=3200 alpha=1.000 err=0.494 loss=8.05e-05
.
.
.
i=5456 alpha=1.000 err=0.499 loss=6.70e-05
i=5472 alpha=1.000 err=0.499 loss=6.70e-05
i=5488 alpha=1.000 err=0.499 loss=6.69e-05
i=5504 alpha=1.000 err=0.499 loss=6.69e-05
i=5520 alpha=1.000 err=0.499 loss=6.69e-05
i=5536 alpha=1.000 err=NaN loss=6.69e-05

Parameters in acfTrain do not really impact this behavior, besides the model size. It seems like this occurs at certain sizes, but does not occur at others. Changing other parameters (random seed, etc.) still results in the same behavior.

Any ideas?

Thanks!

adding header files for size_t and calloc/malloc

Here looks like a bug in header file: wrappers.hpp

If you disable "MATLAB_MEX_FILE", when building imResamplexxx.cpp, which requires the header file "wrappers.hpp", there is an error:

wrappers.hpp:12:24: error: ‘wrCalloc’ declared as an ‘inline’ variable
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:24: error: ‘size_t’ was not declared in this scope
wrappers.hpp:12:36: error: ‘size_t’ was not declared in this scope
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:48: error: expression list treated as compound expression in initializer [-fpermissive]
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:50: error: expected ‘,’ or ‘;’ before ‘{’ token
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:13:24: error: ‘wrMalloc’ declared as an ‘inline’ variable
inline void* wrMalloc( size_t size ) { return malloc(size); }
^
wrappers.hpp:13:24: error: ‘size_t’ was not declared in this scope
wrappers.hpp:13:38: error: expected ‘,’ or ‘;’ before ‘{’ token
inline void* wrMalloc( size_t size ) { return malloc(size); }
^
wrappers.hpp: In function ‘void wrFree(void*)’:
wrappers.hpp:14:44: error: ‘free’ was not declared in this scope
inline void wrFree( void * ptr ) { free(ptr); }
^
wrappers.hpp: At global scope:
wrappers.hpp:17:17: error: ‘size_t’ was not declared in this scope
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:30: error: expected primary-expression before ‘int’
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:44: error: expression list treated as compound expression in initializer [-fpermissive]
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:46: error: expected ‘,’ or ‘;’ before ‘{’ token
void* alMalloc( size_t size, int alignment ) {

This error can be fixed by adding the two header files:
#include <stdio.h>
#include <stdlib.h>

Please help review and confirm.

Thanks,

Shuai Hua

help plz!!!! Memory error

Hi :)
i have a dataset of 100,000 images and wanna train an acf object detector model.
when i used the trainACFObjectDetector() function, the memory usage of my pc, worked 100% and finally i got out of memory error. it works by just 100 images, no more ...
The RAM size of my pc is 64G.
please help me

A Crash Bug(gradientMex function)

Hi, Piotr, I found that:
you run this script, the code will crash at the gradientMex.mexw64 LDu+000029.
May some big image will crash!!!!!!!!! because this problem.

   I= imread('peppers.png');
   sz1=[4083 6146];
   I = imresize(I,sz1); 
   I=rgbConvert(I,'luv'); 
   I1=I;
  [M,O]=gradientMag(I1,0,5,0.0050,0);
  H=gradientHist(M,O,2,6,1,0,0.2,0);

Extract haar-like feature with the toolbox

hi, piotr
I want to detect pedestrain with the traditional haar features. Could you tell me is there something about haar-like feature extraction in this toolbox. thanks!

Best regards,
xiao yu

Error using forestInds

Error using forestInds
Mismatch between data types.

Error in adaBoostApply_otf_trans (line 43)
ids = forestInds(X,model.thrs(:,i),model.fids(:,i),model.child(:,i),nt);

I dont know what is happening and how to solve this.
Do you have any solution? Thanks!

How to cast the output of adaBoostApply as a probability?

The comments say that the output of adaBoostApply hs is a log ratio (.5_log(p/(1-p)), so I can derive the probability as p = exp(2_hs)/(1+exp(2*hs))
But when I calculate p in this way, the output is kind of weird, so I doubt whether it is correct?

Cannot compile MATLAB 2019a

toolboxCompile fails for certain files. It cannot successfully compile due to this error:

Building with 'Xcode Clang++'.
-> COMPILE FAILURE: 'gradientMex.cpp' /Users//Library/Application Support/MathWorks/MATLAB Add-Ons/Collections/pdollar_toolbox/pdollar-toolbox-e873326/channels/private/gradientMex.cpp:329:20: error: no matching function for call to 'mxSetDimensions_730'
mxSetData(M,*I); mxSetDimensions(M,dims,3); return M;
^~~~~~~~~~~~~~~
/Applications/MATLAB_R2019a.app/extern/include/matrix.h:248:25: note: expanded from macro 'mxSetDimensions'
#define mxSetDimensions mxSetDimensions_730
^~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2019a.app/extern/include/matrix.h:1234:1: note: candidate function not viable: no known conversion from 'const int [3]' to 'const mwSize *' (aka 'const unsigned long *') for 2nd argument
mxSetDimensions(mxArray *pa, const mwSize *pdims, mwSize ndims);
^
/Applications/MATLAB_R2019a.app/extern/include/matrix.h:248:25: note: expanded from macro 'mxSetDimensions'
#define mxSetDimensions mxSetDimensions_730
^
/Users//Library/Application Support/MathWorks/MATLAB Add-Ons/Collections/pdollar_toolbox/pdollar-toolbox-e873326/channels/private/gradientMex.cpp:339:50: error: assigning to 'const int *' from incompatible type 'const mwSize *' (aka 'const unsigned long *')
nDims = mxGetNumberOfDimensions(pr[0]); dims = mxGetDimensions(pr[0]);
^~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2019a.app/extern/include/matrix.h:244:25: note: expanded from macro 'mxGetDimensions'
#define mxGetDimensions mxGetDimensions_730

HELP!!!!!!!!!!!!!!!!!!!

When I perform the test, how do I modify the parameters to reach 16.9% of MR, or do I need to modify some parameter training before testing?

possible bug in toolbox? crash in gradHist + proposed fix

Piotr,    

I have downloaded your very useful toolbox and after successfully applying the detector I examined the code, thinking of porting it to fully c++.

After adding some new-lines to gradHist() in CalcGradient.cpp, so I can read and hopefully also understand the code, I realized the following is used with a potential bug:


GH(H,ma,mb) H1=H; STRu(*H1,ADD(LDu(*H1),MUL(ma,mb)));


where STRu stores 4 values, although only 2 are really needed. one may argue no harm is done since the upper 2 values are not altered. However, it may occur that the code will try to update at the very end of the allocated memory, and thus will experience an exception when the two excessive values are out of the allowed address range, if the memory chunk is not committed. 


I suggests using:

GH(H,ma,mb) H1_64=(__m64*)(H); H1=H; STRlow(*H1_64,ADD(LDu(*H1),MUL(ma,mb)));


with:

RETf STRlow( __m64 &x, const __m128 y ) { _mm_storel_pi(&x,y); return y; }


Best Regards,

Shmulik

Undefined function or variable 'int2str2'

Thank you for sharing this great toolbox. There is something wrong when I try to use the tool box in my end.

I'm running the code on my Mac system. However, when I try to run seqIo.m with command
out = seqIo('/MY/PATH/TO/SEQ/FILENAME.seq','reader')
It ends up with error

Undefined function or variable 'int2str2'.

Error in seqReaderPlugin>readHeader (line 219)
fps = fread(fid,1,'float64'); codec=['imageFormat' int2str2(tmp(6),3)];

Error in seqReaderPlugin>open (line 96)
if(isempty(info)), info=readHeader(fid); else

Error in seqReaderPlugin (line 47)
[infos{h},fids(h),tNms{h}]=open(fName,info); return;

Error in seqIo>reader (line 113)
r=@seqReaderPlugin; s=r('open',int32(-1),fName);

Error in seqIo (line 64)
case {'reader','r'}, out = reader( fName, varargin{:} );

Error in untitled (line 1)
out = seqIo('/MY/PATH/TO/SEQ/FILENAME.seq','reader')

Is this a bug or I didn't correctly installed the code?

Any help would be appreciated.

problem with create seq file

what is the write format about create seq video file by seqIo.m ?
the comment did not described clearly about how to obtain a seq video with kind of code format example.
i need to make my own data to test the code, really need help.

The parallel pool is shut down suddenly

Hi,Dollar
I have modified the chnsCompute1 function in acftrain.m into
function chns = chnsCompute1( Is, opts ) if(isempty(Is)), chns=[]; return; end fprintf('Extracting features... '); start=clock; fs=opts.filters; pChns=opts.pPyramid.pChns; smooth=opts.pPyramid.smooth; dsTar=opts.modelDsPad/pChns.shrink; ds=size(Is); ds(1:end-1)=1; Is=squeeze(mat2cell2(Is,ds)); n=length(Is); chns=cell(1,n); parfor i=1:n C=chnsCompute(Is{i},pChns); C=convTri(cat(3,C.data{:}),smooth); if(~isempty(fs)), C=repmat(C,[1 1 39]); for j=1:size(C,3),C(:,:,j)=conv2(C(:,:,j),fs{floor((j+9)/10)},'same'); end; end shr=1; ds=size(C); cr=ds(1:2)-dsTar/shr; s=floor(cr/2)+1; e=ceil(cr/2); C=C(s(1):end-e(1),s(2):end-e(2),:); chns{i}=C; end; chns=cat(4,chns{:}); fprintf('done (time=%.0fs).\n',etime(clock,start)); end
The "fs"is a cell including 39 filter matrixs,then I run the acfdemocal.m,the parallel pool is shut down suddenly,and the matlab show:
error : acfTrain_CB>sampleWins (line 267)
parfor j=1:batch, ij=i+j;
The client lost connection to worker 3. This might be due to network problems, or the interactive communicating job might have errored.
Do you know how I can solve the problem?
look forward to your reply!

Crash at big images

Hi Piotr,
I trained an ACF face detector:
https://drive.google.com/file/d/0Bz-0GvSNbG8BLTFGOWNBcGJwX3M/view?usp=sharing

but it crashed at feature computation when the image is too big, here is an example image:
0347

The error I got from matlab is:
*** glibc detected *** /usr/lib/matlab-8.3/bin/glnxa64/MATLAB: munmap_chunk(): invalid pointer: 0x00007f027b2483ca ***

When I down-sampled the big image, it worked fine. So I guess there is something wrong with memory allocation. Do you have any clue about this problem? Your help would be greatly appreciated!

Best regards,
Shanshan

Error in Installation

hello

I have downloaded the toolbox and installed using toolboxCompile.m in
C:\Users\Adnan\Downloads\piotr_toolbox\toolbox\external

But when i run the Edge Box code from
C:\Users\Adnan\Downloads\edges-master\edges-master

It gives me an error of files which are in the toolbox.

Is it not installed? I have followed the same instructions

ERROR : error using imPadMex

Error using imPadMex
Requested 137438953888x512x7598263500303858035 (17179869184.0GB) array exceeds maximum array size
preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive. See array size limit or preference panel for more information.

Error in imPad (line 39)
J = imPadMex( I, pad, type );

Error in edgesDetect (line 52)
I = imPad(I,p,'symmetric');

Error in edgesDemo (line 25)
tic, E=edgesDetect(I,model); toc

imresamplemex.cpp unintialized variable bug

resample output has wild big value in some case, due to use uninitialized variable in imresamplemex.cpp:

for(; y<hn; y++) { B0[ybs[y]] += C[yas[y]] * ywts[y];

should initialize B0 before use:

for(int i = 0; i < hb; i++) B0[i] = 0;

help me to change detect object

Dear Piotr Dollar,

Hi,..I am a new comer and new in term of study about piotr toolbox. this is the first step to support my research. I already running the toolbox with human detection (pedestrian). Just for train and test using InriaPerson database. its okay. But I got failed when I used the object to detect some apples, running with acfDemoInria.m. Please help me to know which part of the toolbox must be changes or improves.
I tried to change a part of file nms.m in matlab but cannot exatly detect.
thank you for your enlightenment.

regards,
Nancy

ACF LDCF label in acfdetect function

Hello,
In the article from 4Nov 2014, Local Decorrelation for Improved Pedestrian Detection, the LDCF should be implemented.
As the acfdetect doc said, there should have a flag for using LDCF.

Where can I set the flag for using LDCFinstead of ACF in piotr toolbox ?

Thanks.

acfTest usage

Hi :)
please help me to use acfTest function. i didnt find an example to understand how inputs should be.
i dont know the structure of ground truth directory...

What is the purpose of the training stages?

Hi,

In acfTrain.m the classifier for the previous stage is rewritten by the classifier for the current stage.
detector.clf = adaBoostTrain(X0,X1,detector.opts.pBoost)
Are there any variables that are updated through the stages ? Or simply something that I'm missing ?

Thanks

possible bug in resample?

in resample():

if(ybd[0]>4) for(; y<hn; y++) { B0[ybs[y]] += C[yas[y]] * ywts[y]; }

This function yields unpredictable result if the output buffer(B) is not initialized (to zero);

savefig shadowing MATLAB >= 2013b built-in function

Hi,

as of MATLAB 2013b savefig was introduced as a built-in function. Now when adding the toolbox to the path, the function defined in

toolbox/external/other/savefig.m

shadows the MATLAB builtin function defined in

matlab/8.2/x86_64/toolbox/matlab/graphics/savefig.p 

such that the standard MATLAB command

saveas(handle, 'filename', 'fig')

tries to access the toolbox command instead of the 'new' built-in backend function for saving figures.
Since the function signatures differ, this results in the following error

Error using savefig (line 128)
No file name specified.

Error in saveasfig (line 7)
savefig(h, name);

Error in saveas (line 141)
    feval( ['saveas' format], h, name )

Error in evaluate_template_stage_1_debug (line 389)
        saveas(myPlot, 'filename', 'fig');

I think this is a compatibility issue, since everything works as expected on 2013a.
A temporary workaround for me is now to rename the savefig function in the toolbox to get rid of the shadowing, because as far as I know I am not using it from other toolbox functions. However, this would inevitably break some other functions in the toolbox, that depend on savefig.

Maybe renaming it in the toolbox and fixing the internal function calls is a permanent solution to that problem.

Cheers,
Phil

cropped positive windows for train

hello, when I try to used cropped positive windows ,i did not get a good result as used full positive images and ground truth. the detect result like this:
result

vbb and dbInfo problem

When I want to redo the Pedestrian Detection experiment with the ACF detector,I got failed in the "vbb" and "dbInfo" functions in the demo script. I can not find the functions. Please help me to solve the issues. Thanks.

how to convert Matlab model to xml

Hi, in C code, people are using xml to load trained model. The original model is trained in Matlab. How is it converted to xml?
Thanks a lot.

acf: c++ library (w/ opengl es 2.0)

I've found the ACF detection module in this toolbox to be incredibly useful for fast object detection on mobile platforms. Thanks! I've posted an initial (i.e., alpha) stand alone C++ library (no Matlab required) to run ACF object detection models trained with this toolbox here.

https://github.com/elucideye/acf

This may be useful for other toolbox users needing to run outside of Matlab. I'm assuming this port is better suited to a separate repo, but I'd be happy to push any of this upstream in the future. It has worked well for the configurations I've needed, but I'm sure there are some valid ACF parameter combinations that may require additional work. The API will likely be modified over the next month or so, but it should be functional enough.

  • uses OpenCV
  • optional OpenGL ES 2.0 ACF pyramid computation using a fork of ogles_gpgpu
  • uses the Hunter CMake package manager
  • load pertained *.mat models using a fork of cvmatio
  • supports light weight cereal portable binary archives
  • toolbox SIMD optimizations are made available on ARM NEON platforms via ARM_NEON_2_x86_SSE
  • pretrained face models @ 64x64 and 80x80 are provided (both LUV + NORM(MAG(GRAD)) + HOG(012345)).
  • BSD 3-clause LICENSE

TODO:

  • Documentation
  • Benchmarks (face detection runs in a few milliseconds on an iPhone 7 when using GPGPU ACF pyramids)
  • Halide?
  • OpenCV object detection interface

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.