필터 지우기
필터 지우기

Use ROIAlign Layer in a FastRCNN network?

조회 수: 7 (최근 30일)
Karl Mueller
Karl Mueller 2023년 5월 17일
댓글: Tian,HCong 2024년 5월 27일
Hello,
I have defined a Fast RCNN network which I have trained with image data from ~9000 images of 1 class + background, split into train/validate/test. The network completed training with >95% validated accuracy, but I found that the bounding box/ROI was not very accurate.
I have discovered that MATLAB includes the ROIAlign layer which can supposedly produce bounding boxes with much higher positional accuracy and I have attempted to include this in my network with no success.
It seems that the output of the roi-input is not compatible with the input of the ROIAlign layer.
I have posted the code to generate my network:
params = load("params_2023_05_17__16_25_31.mat");
lgraph = layerGraph();
tempLayers = [
imageInputLayer([576 720 3],"Name","imageinput","Normalization","none")
convolution2dLayer([5 5],64,"Name","conv_6","Padding","same")
reluLayer("Name","relu_2")
batchNormalizationLayer("Name","batchnorm_3")
maxPooling2dLayer([3 3],"Name","maxpool_1","Padding","same","Stride",[2 2])
convolution2dLayer([5 5],128,"Name","conv_2","Padding","same")
reluLayer("Name","relu")
batchNormalizationLayer("Name","batchnorm_2")
maxPooling2dLayer([3 3],"Name","maxpool_3","Padding","same","Stride",[2 2])
convolution2dLayer([5 5],256,"Name","conv_1","Padding","same")
reluLayer("Name","relu_3")
batchNormalizationLayer("Name","batchnorm_1")
maxPooling2dLayer([3 3],"Name","maxpool_2","Padding","same","Stride",[2 2])
convolution2dLayer([5 5],512,"Name","conv_3","Padding","same")
reluLayer("Name","relu_1")];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = roiInputLayer("Name","roi-input");
lgraph = addLayers(lgraph,tempLayers);
% ROIAlign would go here:
tempLayers = [
roiMaxPooling2dLayer([16 16],"Name","roi-max-pooling")
dropoutLayer(0.5,"Name","dropout")];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
fullyConnectedLayer(4,"Name","fc_2")
rcnnBoxRegressionLayer("Name","rcnn-regression")];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
fullyConnectedLayer(2,"Name","fc_1")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
lgraph = addLayers(lgraph,tempLayers);
% clean up helper variable
clear tempLayers;
lgraph = connectLayers(lgraph,"roi-input","roi-max-pooling/roi");
lgraph = connectLayers(lgraph,"relu_1","roi-max-pooling/in");
lgraph = connectLayers(lgraph,"dropout","fc_2");
lgraph = connectLayers(lgraph,"dropout","fc_1");
plot(lgraph);
The documentation for ROIAlignLayer simply states that it requires an input feature map HWCN, and mine is 72,90,512,1, and a list of ROIs to pool, and that logically seems to mean the ROI input layer in my fastRCNN network, or perhaps the output of a region proposal network? I have actually tried both of these with no success.
The error I receive when I analyse the network is:
The RPN output was a slightly different size of 1(S) x 5(C) x 1(B), but it also failed.
Any help would be appreciated
Thanks,
  댓글 수: 2
Siraj
Siraj 2023년 8월 23일
Is it possible for you to share the param(params_2023_05_17__16_25_31.mat) file.
Tian,HCong
Tian,HCong 2024년 5월 27일
Hello, has your problem been resolved? I also encountered a similar problem when applying roialignLayer to FastRCNN network.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by