Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:25:34+00:00 2026-06-17T18:25:34+00:00

I have a problem with training a model using the PASCAL dev kit with

  • 0

I have a problem with training a model using the PASCAL dev kit with the Discriminatively trained deformable part model system developed by Felzenszwalb, D. McAllester, D. Ramaman and his team which is implemented in Matlab.

Currently I have this output error when I tried to train a 1-component model for ‘cat’ using 10 positive and 10 negative images.

Error:

??? Index exceeds matrix dimensions.

Error in ==> pascal_train at 48
models{i} = train(cls, models{i}, spos{i}, neg(1:maxneg),
0, 0, 4, 3, ...

Error in ==> pascal at 28
model = pascal_train(cls, n, note);

And this is the pascal_train file

function model = pascal_train(cls, n, note)

% model = pascal_train(cls, n, note)
% Train a model with 2*n components using the PASCAL dataset.
% note allows you to save a note with the trained model
% example: note = 'testing FRHOG (FRobnicated HOG)

% At every "checkpoint" in the training process we reset the 
% RNG's seed to a fixed value so that experimental results are 
% reproducible.
initrand();

if nargin < 3
  note = '';
end

globals; 
[pos, neg] = pascal_data(cls, true, VOCyear);
% split data by aspect ratio into n groups
spos = split(cls, pos, n);

cachesize = 24000;
maxneg = 200;

% train root filters using warped positives & random negatives
try
  load([cachedir cls '_lrsplit1']);
catch
  initrand();
  for i = 1:n
    % split data into two groups: left vs. right facing instances
    models{i} = initmodel(cls, spos{i}, note, 'N');
    inds = lrsplit(models{i}, spos{i}, i);
    models{i} = train(cls, models{i}, spos{i}(inds), neg, i, 1, 1, 1, ...
                      cachesize, true, 0.7, false, ['lrsplit1_' num2str(i)]);
  end
  save([cachedir cls '_lrsplit1'], 'models');
end

% train root left vs. right facing root filters using latent detections
% and hard negatives
try
  load([cachedir cls '_lrsplit2']);
catch
  initrand();
  for i = 1:n
    models{i} = lrmodel(models{i});
    models{i} = train(cls, models{i}, spos{i}, neg(1:maxneg), 0, 0, 4, 3, ...
                      cachesize, true, 0.7, false, ['lrsplit2_' num2str(i)]);
  end
  save([cachedir cls '_lrsplit2'], 'models');
end

% merge models and train using latent detections & hard negatives
try 
  load([cachedir cls '_mix']);
catch
  initrand();
  model = mergemodels(models);
 48:   model = train(cls, model, pos, neg(1:maxneg), 0, 0, 1, 5, ...
                cachesize, true, 0.7, false, 'mix');


save([cachedir cls '_mix'], 'model');
end

% add parts and update models using latent detections & hard negatives.
try 
  load([cachedir cls '_parts']);
catch
  initrand();
  for i = 1:2:2*n
    model = model_addparts(model, model.start, i, i, 8, [6 6]);
  end
  model = train(cls, model, pos, neg(1:maxneg), 0, 0, 8, 10, ...
                cachesize, true, 0.7, false, 'parts_1');
  model = train(cls, model, pos, neg, 0, 0, 1, 5, ...
                cachesize, true, 0.7, true, 'parts_2');
  save([cachedir cls '_parts'], 'model');
end

save([cachedir cls '_final'], 'model');

I have highlighted the line of code where the error occurs at line 48.

I am pretty sure that the system is reading in both the positive and negative images for training correctly. I have no idea where this error is occurring since matlab does not indicate precisely which index is exceeding the matrix dimensions.

I have tried to tidy up the code as much as possible do guide me if I have done wrong somewhere.

Any suggestions where I should start looking at?

Ok, I tried with the use of display to check the variables in use for pascal_train;
disp(i);
disp(size(models));
disp(size(spos));
disp(length(neg));
disp(maxneg);

So the results returned were;

 1

 1     1

 1     1

10

200

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:25:35+00:00Added an answer on June 17, 2026 at 6:25 pm

    I don’t have an answer to your question, but here is a suggestion that might help you debug this problem yourself.

    In the Matlab menu go to Debug-> Stop if Errors/Warnings … and select “Always stop if error (dbstop if error)”. Now run your script again and this time when you get the error, matlab will stop at the line where the error occurred as if you put a breakpoint there. At that point you have the whole workspace at your disposal and you can check all variables and matrix sizes to see which variable is giving you the error you are seeing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using VB.NET My problem is that, I have got below request.querystring http://localhost/ISS/Training/TrainingUpdate.aspx?cpuserid='50'&%20courseid='6'&%20status='accept'
I have problem with my query on C, I’m using the oci8 driver. This
I’m using ASP.NET MVC 3 for a project I have. The problem is that
I have the following problem. I have a training dataset comprising of a range
I am doing the text categorization machine learning problem using Naive Bayes. I have
I have a major problem with a flash based training course that is rendering
I'm trying out Django and ran into the following problem: I have a model
I'm training code problems like UvA and I have this one in which I
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.