Issues with Faster R-CNN regarding Input Image Size, Mini-Batch Loss (NaN value) and another error.
1 次查看(过去 30 天)
显示 更早的评论
Hello Everyone,
I am trying to use Faster R-CNN for an object detection task. My code is based on the info in the following link:
I had several issues as follow:
1) The size of the images that I have is 512x640x1 (jpg format) and the size of the object vary from 3x3x1 to 10x10x1. The input layer in the ResNet-50 is 224x224x3. My question is how to change the input layer size of ResNet-50 to match the size of my input images?
2) What is the reason to get (NaN value) for the (Mini-batch Loss) and (empty column) for (Mini-batch Accuracy) and (Mini-batch RMSE)?
Knowing that I also decreased the 'InitialLearnRate' from 1e-3 to 1e-5 as suggested in one of answers in other questions, but still the issue has not been solved. (Image Attached below)
3) If I rescale the input images to 224x244x3 Using the code below, I got the following error. What is the reason of this error (Image attached below)?
ERROR: Undefined function 'categories' for input arguments of type 'double'.
% First, specify the network input size.
inputSize = [224 224 3];
%inputSize = [512 640 3];
% Estimate anchor boxes based on the size of objects in the training data.
preprocessedTrainingData = transform(trainingData, @(data)preprocessData(data,inputSize));
numAnchors = 3;
anchorBoxes = estimateAnchorBoxes(preprocessedTrainingData,numAnchors)
% load a pretrained ResNet-50 model.
featureExtractionNetwork = resnet50;
% This feature extraction layer outputs feature maps that are downsampled by a factor of 16.
featureLayer = 'activation_40_relu';
% analyzeNetwork(resnet50)
% Define the number of classes to detect.
numClasses = width(vehicleDataset)-1;
% Create the Faster R-CNN object detection network.
lgraph = fasterRCNNLayers(inputSize,numClasses,anchorBoxes,featureExtractionNetwork,featureLayer);
Thank you so much for your help in adavnce
1 个评论
ramin takmil
2022-2-22
编辑:ramin takmil
2022-2-22
hello I have this problem too
my input size is [512 512 1] but resnet-50 input is [224 224 1] so when I run the code it gives me this error : Input size mismatch. Size of input to this layer [512 512 1] is different from the expected input size [512 512 3].
I have tried to change the input layer using 'replaceLayer' function but it gives me error when I want to build "lgraph"
how did you solve the input size problem???
thanks in advance
采纳的回答
Raynier Suresh
2021-1-20
To change the input layer size, you can replace the layer either in MATLAB Terminal using ‘replaceLayer’ function or in Deep Network Designer App.
Refer the below links for more information:
The function categories will output the number of categories in a categorical array¸ I think that the training data might be improper, this could also be the reason for NaN’s in the Mini-Batch Loss.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Recognition, Object Detection, and Semantic Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!