Error using plot Not enough input arguments.

84 Ansichten (letzte 30 Tage)
Zaime Ali
Zaime Ali am 27 Sep. 2020
Kommentiert: Star Strider am 27 Sep. 2020
I'm having an issue when plotting recall vs precision
In my code i want to plot a graph to check my faster rcnn accuracy.
My code is below
overlap = 0.5;
[ap, recall, precision] = evaluateDetectionPrecision(resultsDoc, gTestTruth.LabelData(2, :), overlap);
figure;
plot(recall, precision);
grid on
title(sprintf('Average precision = %.1f', ap))
In precision variable i have a value
4×1 cell array
{3×1 double}
{[ 1]}
{[ 1]}
{2×1 double}
In recall variable i have a value
4×1 cell array
{3×1 double}
{[ 0]}
{[ 0]}
{2×1 double}
Now i don't know what to do

Antworten (2)

Star Strider
Star Strider am 27 Sep. 2020
You may need to use the cell2mat function, or concatenate the elements inside a vector, using this (strange-looking but effective) notation:
plot([recall{:}], [precision{:}])
.
  2 Kommentare
Zaime Ali
Zaime Ali am 27 Sep. 2020
when using cell2mat function, it is plotting the horizontal line on y-index
Star Strider
Star Strider am 27 Sep. 2020
Use the other option, cell2mat instead:
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
When I tested them with:
recall = {rand(3,1); 1; 1; rand(2,1)};
precision = {rand(3,1); 0; 0; rand(2,1)};
cell2mat worked correctly.
Then:
figure
plot(recallv, precisionv)
grid
title(sprintf('Average precision = %.1f', ap))
should produce the plot you want.
That plots correctly for me. It is plotting a horizontal line, look at the result of the cell2mat output. That is likely what your data actually are, such that ‘precision’ is essentially a constant for all values of ‘recall’. I do not have your data, so I cannot determine that.

Melden Sie sich an, um zu kommentieren.


the cyclist
the cyclist am 27 Sep. 2020
If you take a look at the documentation for the plot function, you will see that it cannot take cell arrays as input.
I'm not exactly sure what you are trying to plot, but maybe you need to pull out the contents of the cell array to plot? Possibly something like
plot(recall{1},precision{1})
  3 Kommentare
Zaime Ali
Zaime Ali am 27 Sep. 2020
I have also tried your solution but it's giving me a straight line now
the cyclist
the cyclist am 27 Sep. 2020
To be clear, all I was really trying to do was point out that you were using MATLAB syntax incorrectly. You did not post enough information to do much more than that.
I strongly suggest you do more than just "try a solution" posted here. You need to
  • think carefully about what you want your code to do conceptually -- in your case, plotting the accuracy
  • learn/understand the MATLAB functions that can accomplish that
  • form your data into the proper form of input for those functions
  • repeat the above if you do not get what you expect
We can help with some of that, but it is really important for to think about our suggestions, and understand how they help solve your problem.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by