gpu limit on 3070 with a simple CNN
2 次查看(过去 30 天)
显示 更早的评论
hello,
I have had this problem for the past two days and I have ran out of options how to solve this. I am training a basic CNN with the input and output mentioned in the code down below. However I use my data, wheter I split it up or use smaller samples, I always get the error " Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'. If the problem persists, reset the GPU by calling 'gpuDevice(1)'." I also changed my minisizebatch to one, which doesn´t help neither. The last thing I tried is to run it on my CPU where it stops after the 3rd epoch out of three. Any Ideas?
imageInputsize = [6570 7000 1];
layers = [
imageInputLayer(imageInputsize )
convolution2dLayer(3,16, 'Padding', 'same' )
batchNormalizationLayer
reluLayer
convolution2dLayer(3,10, 'Padding', 'same' )
batchNormalizationLayer
reluLayer
resize3dLayer('OutputSize',[10 70000 5], 'Name', 'resize10x10x5')
regressionLayer
];
options = trainingOptions('sgdm', ...
'InitialLearnRate', 0.01, ...
'ExecutionEnvironment', 'gpu',...
'MaxEpochs', 10,...
'MiniBatchSize', 1, ...
'Shuffle', 'every-epoch',...
'Verbose', false, ...
'Plots', 'training-progress');
net = trainNetwork(arr_B,arr_V,layers, options);
note: the input as well the outputs are double arrays.
thank you so much
采纳的回答
Joss Knight
2022-1-5
You have 2-D data so you can't use a resize3dLayer. Use a resize2dLayer. But actually it doesn't look like that's what you want.
If you have 70000 samples, they will be the batch dimension not one of the spatial dimensions, so you shouldn't include that dimension at all when specifying your layers. You'll probably need to permute both the data and the response to S-by-C-by-B format (ie. permute the last two dimensions). Perhaps what you want is a series of 1-D convolutional layers?
It seems like your response requires your network to output a result of length 10 with 5 channels? So you're going to need to make your network reduce the spatial dimension to 10 and ensure that the last convolution has 5 filters. Use analyzeNetwork(layers) to check what you're doing and make it work.
5 个评论
Joss Knight
2022-1-10
You say you have 10x10x5 data but your imageInputLayer takes an input size of 6570x7000x1. I'm not convinced you completely understand what your data is in terms of spatial, channel and batch dimensions. Similarly, to even be asking the question as to whether to be using 1-D, 2-D or 3-D convolutions implies that you're not sure what your data is or what the purpose of your network is. And to be attempting to match the network output to your responses by resizing the output data also indicates that you don't fully understand the purpose of the network, which is to transform the semantic information in the spatial input data into the space of the response (typically some metrics or categories), something which cannot be done just by warping the data.
Also, if you have read the documentation for trainNetwork then you will know all the different formats that are accepted, including this:
Numeric Array
For data that fits in memory and does not require additional processing like augmentation, you can specify a data set of images as a numeric array. If you specify images as a numeric array, then you must also specify the responses argument.
The size and shape of the numeric array depends on the type of image data.
DataFormat
2-D images
h-by-w-by-c-by-N numeric array, where h, w, and c are the height, width, and number of channels of the images, respectively, and N is the number of images.
3-D images
h-by-w-by-d-by-c-by-N numeric array, where h, w, d, and c are the height, width, depth, and number of channels of the images, respectively, and N is the number of images.
Perhaps if you want to use your data in cell form you might consider using an arrayDatastore:
ds = arrayDatastore(data,OutputType="same");
This begins to fit the formats for datastore inputs specified in the documentation. But you will have to ensure that your responses are included, perhaps using combine.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!