المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Code optimization



C# Programming
10-19-2009, 02:21 AM
Good day

This is a relatively advanced problem...
I am writing training software for image recognition.

When the training program starts, it loads a set of a few thousand (roughly 5000) images of size 24x24 pixels (greyscale).

I decided to load all images into my own class type, using a list. In other words, if my class is called "class Image", i have a list: List.

The image data is stored as a 2D double array in the class.

On each training round I need to process all images, and I am finding this is taking very long. Is there a way to make processing faster?

This is what I have already tried without much reduction in time:
1. Using unsafe code and pointers to access each image object.
2. Parrallel processing the images (but I ended up with errors).
3. Using a "for loop" instead of "foreach" to iterate through the list (not much improvement).

I am also considering using structs instead of classes to store the images, but not sure if this would overload the stack?

Please ask if any more information needed (I didn't give more since there is too much to say).

Any help would be appreciated please http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

tvb