Adding Instances to Minos TrainingSet

Hi,

I am trying to add instances to a Minos TrainingSet I created in the program. The instances are all on the same image. I created the image by copying an image of a coin for testing purposes, so all the instances are identical.
This works perfectly fine when I am using the TeachBench but not inside my program.

This is the code I use:

TrainingSet newTrainingSet = new TrainingSet();
newTrainingSet.Images.Add(TrainingImage);

newTrainingSet.CorrelationThreshold = 0.5;
newTrainingSet.ExpectationRadius = 3; 

newTrainingSet.Models.Add(newTrainingSet.Images[0], "SearchTraining", RectCenter[0], TrainingWindow);
TrainingSet.ImageInstanceInfoCollection instanceInfos = new TrainingSet.ImageInstanceInfoCollection(newTrainingSet, newTrainingSet.Handle);

if (RectCenter.Count > 1) 
{
for (int i = 1; i < RectCenter.Count; i ++) 
{
Point2Dd tempRectCenter = new Point2Dd(RectCenter[i]);

string tempModel = newTrainingSet.Models[0].Name;

TrainingSet.InstanceInfo testInstanceInfo = instanceInfos.Add(tempModel, true, ref tempRectCenter);
}
}

RectCenter is a List with the locations of the instances.
TrainingWindow is a Rect with the size of the Training Window.

The message I get is:
image

It just does not make any sense to me as the instances are identical and they are not located too close to the image boundaries. There is also not problem when I’m trying it with the TeachBench.

Does anybody have an idea on what the problem is?
Thanks in advance!
alw

Hi @alw

Can you tell me the extent (left/top/right/bottom values) of the model “SearchTraining” and the size of the image from which you are trying to extract?

Just as a quick test, you could also try to lower the correlation threshold and see if it then changes the behavior.

Thank you @illusive and @Frank for your responses and your help!

@illusive: The extent of the model is l = -51; t = -51; r = 51; b = 51
and the size of the image is 737x720

@Frank: I tried that but unfortunately I get the same error message.

Hi @alw,

instead of

TrainingSet.InstanceInfo testInstanceInfo = instanceInfos.Add(tempModel, true, ref tempRectCenter);

try to add the instances with

newTrainingSet.Images[0].Instances.Add(tempModel,true, ref tempRectCenter);
2 Likes

Hi @s-woe,

that works! Thanks a lot!