AI Neural Network Wrong Handwritten Digit Prediction due to inverted color. Octave / Matlab?

my Octave program uses Neural Networks to recognize handwritten numbers. The problem is that it does not recognize the number correctly if the color has changed. But if the color is inverted, it predicts incorrectly. For instance: Six GrayScale Image

Six GrayScale Image


The images above contain the same number with the same pattern. But they have inverted colors.

I already use RGB for GrayScale . How to overcome this problem? Is there a better option than using separate training examples for inverted color images?

+4
2

@bakkal , . , , , .. mathworks , HOG ( ).

, . HOG matlab extractHOGFeatures:

enter image description here

, vlfeat HOG, Octave.

- , , . 500x500, .

close all; clear; clc;

% reading in
img1 = rgb2gray(imread('img1.png'));
img2 = rgb2gray(imread('img2.png'));

img_size = [500 500]; % 

% all images should have the same size
img1_resized = imresize(img1, img_size);
img2_resized = imresize(img2, img_size);

% extracting features
[hog1, vis1] = extractHOGFeatures(img1_resized);
[hog2, vis2] = extractHOGFeatures(img2_resized);

% plotting
figure(1);
subplot(1, 2, 1);
plot(vis1);
subplot(1, 2, 2);
plot(vis2);

HOG. SURF

surf features

, , . , HOG, , , 20 /blobs 6, .. , matlab.

% extracting SURF features
points1 = detectSURFFeatures(img1_resized);
points2 = detectSURFFeatures(img2_resized);

% plotting SURF Features
figure(2);
subplot(1, 2, 1);
imshow(img1_resized);
hold on;
plot(points1.selectStrongest(20));
hold off;
subplot(1, 2, 2);
imshow(img2_resized);
hold on;
plot(points2.selectStrongest(20));
hold off;

, . , , , .

+2

, , ,

, , " ", " ":

enter image description here

, , .

MATLAB/OCtave :

https://mathworks.com/discovery/edge-detection.html https://octave.sourceforge.io/image/function/edge.html

< > Python OpenCV edges_image = cv2.Laplacian(original_image, cv2.CV_64F). MATLAB/Octave, :) >

, , , " ".

, , , / , , .

+2

Source: https://habr.com/ru/post/1679951/


All Articles