Code Monkey home page Code Monkey logo

Comments (5)

headupinclouds avatar headupinclouds commented on July 16, 2024

https://github.com/pdollar/toolbox/blob/1a3c9869033548abb0c7a3c2aa6a7902c36f39c2/channels/chnsCompute.m#L119-L136

% get default parameters pChns
if(nargin==2), pChns=varargin{1}; else pChns=[]; end
if( ~isfield(pChns,'complete') || pChns.complete~=1 || isempty(I) )
  p=struct('enabled',{},'name',{},'hFunc',{},'pFunc',{},'padWith',{});
  pChns = getPrmDflt(varargin,{'shrink',4,'pColor',{},'pGradMag',{},...
    'pGradHist',{},'pCustom',p,'complete',1},1);
  pChns.pColor = getPrmDflt( pChns.pColor, {'enabled',1,...
    'smooth',1, 'colorSpace','luv'}, 1 );
  pChns.pGradMag = getPrmDflt( pChns.pGradMag, {'enabled',1,...
    'colorChn',0,'normRad',5,'normConst',.005,'full',0}, 1 );
  pChns.pGradHist = getPrmDflt( pChns.pGradHist, {'enabled',1,...
    'binSize',[],'nOrients',6,'softBin',0,'useHog',0,'clipHog',.2}, 1 );
  nc=length(pChns.pCustom); pc=cell(1,nc);
  for i=1:nc, pc{i} = getPrmDflt( pChns.pCustom(i), {'enabled',1,...
      'name','REQ','hFunc','REQ','pFunc',{},'padWith',0}, 1 ); end
  if( nc>0 ), pChns.pCustom=[pc{:}]; end
end
if(nargin==0), chns=pChns; return; end

I believe isInit should be the C++ equivalent of the matlab condition that trigger the final line above if(nargin==0), chns=pChns; return; end.

That's probably what should happen here:

//std::cout << pChns << std::endl;
// TODO

    if (!pChnsIn.complete.has || (pChnsIn.complete.get() != 1) || IIn.empty())
    {
        // Create default structures and merge:
        {
            // top level
            Options::Pyramid::Chns dfs;
            dfs.shrink = { "shrink", 4 };
            dfs.complete = { "complete", 1 };
            pChns.merge(dfs, 1);
        }

         // <SNIP>

        //std::cout << pChns << std::endl;
        // TODO
    }

Ah. TODO :)

This lib was created as part of an effort to get a few trained models running on a phone, so only some subset of the functionality has been tested. I'm not too surprised there are a number of use case gaps. Thanks for reporting. If you have a fix, feel free to send it. Otherwise, I can take a look later. We can add some GTests to cover some of this behavior as the issues come up.

The tests are here:

TEST_F(ACFTest, ACFChannelsCPU)
{
auto detector = getDetector();
ASSERT_NE(detector, nullptr);
MatP Ich;
detector->setIsTranspose(true);
detector->computeChannels(m_IpT, Ich);
#if ACF_TEST_DISPLAY_OUTPUT
cv::Mat canvas = Ich.base().t();
WaitKey waitKey;
cv::imshow("acf_channel_cpu", canvas);
#endif
// TODO: comparison for channels:
// load cereal pba cv::Mat, compare precision, etc
ASSERT_EQ(Ich.base().empty(), false);
}

TEST_F(ACFTest, ACFchnsCompute_isInit)
{
    // some test for expected default values with isInit here
}

from acf.

JN-Jones avatar JN-Jones commented on July 16, 2024

Don't have any proper fix as I'm handling the options on my own for now. There's a similar construct in chnsPyramid though which seems to work:
https://github.com/elucideye/acf/blob/master/src/lib/acf/chnsPyramid.cpp#L179-L183

from acf.

headupinclouds avatar headupinclouds commented on July 16, 2024

To be true to the reference implementation I suppose we should aim for the following:

>> result = chnsCompute

result = 

       shrink: 4
       pColor: [1x1 struct]
     pGradMag: [1x1 struct]
    pGradHist: [1x1 struct]
      pCustom: [0x0 struct]
     complete: 1

>> result.pColor

ans = 

       enabled: 1
        smooth: 1
    colorSpace: 'luv'

>> result.pGradMag

ans = 

      enabled: 1
     colorChn: 0
      normRad: 5
    normConst: 0.0050
         full: 0

>> result.pGradHist

ans = 

     enabled: 1
     binSize: []
    nOrients: 6
     softBin: 0
      useHog: 0
     clipHog: 0.2000

>> result.pCustom is empty

>> result.complete

ans =

     1

from acf.

headupinclouds avatar headupinclouds commented on July 16, 2024

>> result = chnsPyramid

result = 
       pChns: [1x1 struct]
     nPerOct: 8
      nOctUp: 0
     nApprox: 7
     lambdas: []
         pad: [0 0]
       minDs: [16 16]
      smooth: 1
      concat: 1
    complete: 1

w/ >> result.pChns same as above

from acf.

headupinclouds avatar headupinclouds commented on July 16, 2024

This should be consistent with the Matlab toolbox code now (after PR #40). I've added a couple tests to ensure that the default parameter retrieval is working and returning expected values. Closing ...

from acf.

Related Issues (20)

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.