Hello, I am new to machine learning. Here is the problem description: I have 10,000 inputs, 1,000 test, and (only) ONE target image. Each input, test, and target is the identical grayscale image of 256X256 resolution. In the input there are 10,000 corresponding rotation (angle) and 10,000 shift values. So the 10,000 input images are shifter and rotated. The target is the same image (as inputs) with no rotation and no shift (basically, zero shift and zero rotation). The 1,000 test images are shifted and rotated but obviously with no information for shift and for rotation. Since my train and test data are 3-dimensional, I have "columnized" each image input, test, and target as 65536X1. Hence, my input is 65536X10000; test is 65536X1000; and target is 65536X1.
I get the error, "Inputs and targets have different numbers of samples." which obviously is true taken what it is. My question is whether I could have my number of samples to be different in input vs. target.
If so, what "flavor" of function calls do I need.
BTW, my patchy solution (i have not tried it yet) is to replicate the one target 10000 times so I have a matching input and target but somehow it doesn't seem to be an efficient way of doing it.
The error occurs in line: "net = train(net,train_data_2d,ImTruth_1d);". Below is the code. Thanks.
clear all; close all; clc; % train_data = load('FrameStack.mat'); test_data = load('FrameTest.mat'); % N_train = 10000; N_test = 1000; N_image = 256; % train_data_2d = zeros(N_image*N_image,N_train); test_data_2d = zeros(N_image*N_image,N_test); % % Convert the input, test, and target from 3-d to 2-d matrices. % for ii = 1:N_train temp = []; temp = train_data.Images(:,:,ii); temp = temp(:); %train_data_2d = horzcat(train_data_2d,reshape(train_data.Images(:,:,i),[],1)); train_data_2d(:,ii) = temp; end % for iii = 1:N_test temp = []; temp = test_data.Images(:,:,iii); temp = temp(:); %train_data_2d = horzcat(train_data_2d,reshape(train_data.Images(:,:,i),[],1)); test_data_2d(:,iii) = temp; end % temp = []; temp = train_data.ImTruth(:); ImTruth_1d = temp(:); % % % net = feedforwardnet(20); net = train(net,train_data_2d,ImTruth_1d); % outputs = net(test_data_2d); errors = gsubtract(test_data_2d,outputs); performance = perform(net,test_data_2d,outputs) %
0 Comments
Sign in to comment.