By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,236 Members | 1,992 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,236 IT Pros & Developers. It's quick & easy.

Weird output when using more samples (help)

P: n/a
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!

Jun 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.