Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

for 60 classes, you will need 60 (binary) output nodes in your network, and your responses could be created like this:

int N = numImages; (per class) int C = numClasses; Mat_<float> responses(NC, C, 0.0f); //all 0 initially for (int j=0; j<c; j++)="" {="" for="" (int="" i="0;" i<n;="" i++)="" {="" responses(j<="" em="">N+i, j) = 1.0f; } }

for 60 classes, you will need 60 (binary) output nodes in your network, and your responses could be created like this:

int N = numImages; // (per class)
class, 10 in your case)
int C = numClasses;
numClasses; // 60 here
Mat_<float> responses(NC, responses(N*C, C, 0.0f); //all 0 initially
for (int j=0; j<c; j++)="" {="" for="" (int="" i="0;" i<n;="" i++)="" {="" responses(j<="" em="">N+i, j<C; j++)
{
  for (int i=0; i<N; i++)
  {
     responses(j*N+i, j) = 1.0f;
  } 
} 

}

for 60 classes, you will need 60 (binary) output nodes in your network, and your responses could be created like this:

int N = numImages; // (per class, 10 in your case)
int C = numClasses; // 60 here
Mat_<float> responses(N*C, C, 0.0f); //all 0 initially
for (int j=0; j<C; j++)
{
  for (int i=0; i<N; i++)
  {
     responses(j*N+i, j) = 1.0f;
  } 
}

for N=3 and C=6, it looks like this:

[1, 0, 0, 0, 0, 0;
 1, 0, 0, 0, 0, 0;
 1, 0, 0, 0, 0, 0;
 0, 1, 0, 0, 0, 0;
 0, 1, 0, 0, 0, 0;
 0, 1, 0, 0, 0, 0;
 0, 0, 1, 0, 0, 0;
 0, 0, 1, 0, 0, 0;
 0, 0, 1, 0, 0, 0;
 0, 0, 0, 1, 0, 0;
 0, 0, 0, 1, 0, 0;
 0, 0, 0, 1, 0, 0;
 0, 0, 0, 0, 1, 0;
 0, 0, 0, 0, 1, 0;
 0, 0, 0, 0, 1, 0;
 0, 0, 0, 0, 0, 1;
 0, 0, 0, 0, 0, 1;
 0, 0, 0, 0, 0, 1]