Search code examples
machine-learningdeep-learningneural-networkcomputer-visionconv-neural-network

How to Handle Data of Different Dimensions in CNN


I'm very beginner to Machine Learning.

Working on a Character Recognition Model using CNN.I have image datasets of different sizes (mainly of two size,64X64 and 192X64), training data set is prepared by reshaping 64X64 to 32X32. This data sets works very well.

On other hand I too have 192X64 images on reshaping them into 32X32, the pixel data were broken and distorted.

Any guidance on how to handle these data would be very helpful.

Thanks in advance.

I tried reshaping the 32X32 as 192X64, I know it is way too much.Got Memory Error

memory error


Solution

  • There are three potential ways you can go:

    1. Can you crop 64x64 images from your 192x64 images without loosing too much information from other parts of the image? In this way your images do not get distorted by down-scaling.
    2. If cropping is not possible, make sure that your model trains on distorted (192x64 to 64x64 downscaled) data. If your model trains on these samples, there also should not be a problem during inference.
    3. You could be padding your image from 192x64 to 192x192, and then downsample. The sample will not be distorted, however there will be large areas with approximated / padded pixel values (definitely this kind of data also needs to be present during training if you choose to go this way).