Nvidia Classification results using InceptionV3 transfer learning and GPU coder do not match the classification results using Matlab itself

2 views (last 30 days)
i use imageDatastore, augmentedImageDatastore to convert the different size of gray scale images to the 3 channels RGB images,
*****
imds1 = imageDatastore('folderpath',true,'LabelSource','foldernames');
imageAugmenter = imageDataAugmenter( ...
'RandXReflection',0, ...
'RandScale',[0.7 1.3],...
'RandXShear',[-2 2]);
[trainImgs, valImgs] = splitEachLabel (imds1,08.,0.2,'randomize');
trainImgs1 = augmentedImageDatastore(.. 'ColorPreprocessing','gray2rgb','DataAugmentation',imageAugmenter);
...
then train InceptionV3 using my own image dataset.
The created model is then compiled using GPU coder for Nvidia device.
The compiled wrapper file runtime in Nividia gives different output from the matlab environment when running the trained model. Additional information for this, my raw image is preprocessed in the wrapper file (using openCV - resize, then cvColor to convert grayscale to color images).then, feed into the trained model. However, the model was trained by augmentedImageDatastore, I do not know exactly what processing is done for ColorPreprocessing and gray2rgg.
Can any one give suggestions how to fix the issue?
Thanks!

Answers (1)

Hariprasad Ravishankar
Hariprasad Ravishankar on 7 Dec 2022
Hi @Liwei,
As clarified through our support team, we suspect that this might be because you are generating code that expects the image in column major layout whereas the opencv imread function and the BGR to RGB processing returns data in row-major layout.
Consider transposing the input from row-major to column-major before calling the auto generated function.
Hari

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!