Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Weird output when using more samples (help)

Reply
Thread Tools

Weird output when using more samples (help)

 
 
Jordi
Guest
Posts: n/a
 
      06-27-2006
I'm making a feature-file to train a Neural Network, but now that I've
added a new feature, the output becomes corrupted. The output is as
follows:
3000 25
1_002858 5 0 0 0 0 2 2 0 0 0 0 2 2 0 0 0 0 0 4 0 0 0 0 0 4
5_002671 2 1 1 0 0 0 0 0 0 1 2 0 0 0 2 1 0 0 0 0 3 0 0 0 1
7_001096 0 0 0 0 3 0 0 0 0 2 0 0 0 0 2 0 0 0 0 2 2 2 2 2 3
7_003394 0 0 1 0 0 0 0 1 0 0 1 1 2 2 0 0 0 0 1 0 2 1 1 1 3
2_003185 2 4 2 2 2 2 0 2 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0
0_000097 3 2 2 0 0 1 0 0 2 0 0 0 0 0 2 0 0 0 0 1 0 0 1 2 2
3_003450 0 0 1 1 1 0 0 0 0 1 0 2 1 1 2 0 0 1 1 0 1 1 1 1 1
2_002966 3 2 2 2 0 2 0 0 0 2 0 2 0 0 0 0 1 0 0 0 2 2 1 0 0
0_001064 1 1 1 1 0 1 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 2 1 1 0
7_002859 0 0 1 0 0 0 0 0 0 0 0 1 1 2 1 0 0 0 0 1 1 1 1 1 1
4_003501 0 0 1 0 0 0 1 3 0 0 2 0 1 0 0 2 0 0 1 0 0 0 0 0 1
1_002759 0 0 0 4 3 0 0 3 0 0 0 3 1 0 0 2 1 0 0 0 4 0 0 0 0
8_001458 2 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 1
1_000255 1 1 1 0 0 0 0 1 3 0 0 0 0 0 4 0 0 0 0 4 0 0 0 0 4
4_001116 0 0 2 0 0 0 0 1 0 0 2 1 1 3 0 1 0 0 1 2 1 1 0 0 1
3_003398 1 1 1 1 0 0 0 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 1 2
0_001471 0 2 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 2 1 0 0 0 0 1
@+~Y~Y~Y~Y~Y~Z? 1 2 2 2 2 2 0 0 0 0 0 2 0 0 0 0 0 1 0 0 2 2 0 0 0
1_001419 5 2 0 0 0 0 3 0 0 0 0 0 2 1 0 0 0 0 2 1 0 0 0 0 4
3_002413 1 1 1 1 2 1 0 0 0 1 0 1 1 0 0 0 1 1 0 0 1 1 1 2 0
5_000198 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 3 0 0 0

The first number in the file is the number of samples and the second is
the number of numbers that the feature has. The first character string
on each successive row is a label that is used to identify a certain
sample. The other numbers are the feature.
Notice how the label on the fourth row from the bottom is corrupted?
That's the problem. Strangely enough, my feature-program does
absolutely nothing with the labels. Other features work fine and it
also works fine when I use approx. 900 (somewhere between 900 and 950)
or less samples.
The feature-function is called in one for-loop and the printing is done
in another one.
Something like this:
samples = read_all_hwr(argv[1],&nsamples, 0);
grids = (int**) malloc (sizeof(int*)*nsamples);
for (i = 0; i < nsamples; i++) {
grids[i] = hwr2grid(samples[i], width, height);
}

for (i = 0; i < nsamples; i++) {
printf("\n%s", samples[i]->label);
}

If I would put the printf-statement in the the first for-loop before or
after the call to hwr2grid, the error doesn't occur, but this isn't
really a nice option for the real program and besides, I want to know
what's wrong. If I call another feature in the first for-loop before or
after hwr2grid, the problem also disappears.
samples = read_all_hwr(argv[1],&nsamples, 0);
grids = (int**) malloc (sizeof(int*)*nsamples);
chaincodes = (int**) malloc (sizeof(int*)*nsamples);
for (i = 0; i < nsamples; i++) {
chaincodes[i] = hwr2chain(samples[i], nquant, nsegments);
grids[i] = hwr2grid3(samples[i], width, height);
}

for (i = 0; i < nsamples; i++) {
printf("\n%s", samples[i]->label);
}
I will do this eventually, but I would really like to know what is
wrong, because it might have other side-effects that I'm not aware of.

It really doesn't make any sense to me, because:
1) labels are not altered anywhere.
2) if they were altered in hwr2grid, why aren't they all?
3) if some are altered, then how does hwr2chaincode disable this
change, if it is called BEFORE hwr2grid?

At first I thought that maybe it had something to do with using too
much memory, but then it wouldn't really make sense that using even
more memory (adding the other feature) would cancel the problem.

I really hope you guys could help me with this. Thanks!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!! - Need any suggestions, ideas and samples with a Dynamic Graph in ASP using Access 2003 Trev ASP .Net 2 05-11-2007 02:09 PM
Help!! - Need any suggestions, ideas and samples with a Dynamic Graph in ASP using Access 2003 Trev ASP General 0 05-11-2007 01:59 PM
More samples of rubyfilter code? Lloyd Zusman Ruby 2 11-23-2004 05:11 AM
More 1Ds Mk II samples... Brian C. Baird Digital Photography 2 09-27-2004 02:26 PM
More Panasonic DMC-FZ1-2 samples from Africa Hans-Georg Michna Digital Photography 0 07-01-2004 07:01 PM



Advertisments