I keep getting error using plot not enough input arguments.

I keep getting error when I try to plot the following code and I don't really know what to do.
figure
plot(recall,precision)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))
Error using plot
Not enough input arguments.

3 件のコメント

Torsten
Torsten 2023 年 5 月 4 日
And how are the arrays for recall and prescision defined in your code ?
At the moment, both plot components are empty - thus nothing to plot.
Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
[ap,recall,precision] = evaluateDetectionPrecision(detectionResults,testData);
like this
Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
i improved the code to something like this :
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
figure
plot(recallv,precisionv)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))
the graph is shown but it looks bad, something else is wrong also.

サインインしてコメントする。

回答 (1 件)

Dyuman Joshi
Dyuman Joshi 2023 年 5 月 4 日

0 投票

You need to sort your x data.
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
[r,index] = sort(recallv);
p = precisionv(index);
figure
plot(r,p)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))

6 件のコメント

Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
編集済み: Adrian Kleffler 2023 年 5 月 4 日
thanks, it looks like this helped, but i have 6 classes in my detector... it looks like there is average precision for all the classes in one graph ... how to improve it ?
Dyuman Joshi
Dyuman Joshi 2023 年 5 月 4 日
Could you please attach your data?
Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
which data do you mean ?
Dyuman Joshi
Dyuman Joshi 2023 年 5 月 4 日
The arrays - recall and precision.
Also, could you elaborate on this statement?
"it looks like there is average precision for all the classes in one graph ... how to improve it ? "
Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
recall :
0
[0;0.166666666666667;0.333333333333333;0.500000000000000;0.666666666666667;0.833333333333333]
20x1 double
[0;0.125000000000000;0.250000000000000;0.375000000000000;0.500000000000000;0.625000000000000;0.750000000000000;0.875000000000000;1]
12x1 double
[0;0.111111111111111;0.222222222222222;0.333333333333333;0.444444444444444;0.555555555555556;0.666666666666667;0.777777777777778;0.888888888888889;1]
precision :
1
[1;1;1;1;1;1]
20x1 double
[1;1;1;1;1;1;1;1;1]
12x1 double
[1;1;1;1;1;1;1;1;1;1]
i want to say that i have 6 classes in my project, so in that graph (on the top of the graph, ap = 0,83, ap = 0,29...) i posted, there are average precisions for 6 classes in my opinion ... i don´t know if its possible to combine them to only one average precision or what to do with them... on matlab page there is one example where the graph looks like this (but they had only one class to detect) :
I hope you understand me, and i am so thankful for your answers.
Adrian Kleffler
Adrian Kleffler 2023 年 5 月 4 日
maybe it will be easier to make one graph for each class, but i don´t know how to do it ...

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

リリース

R2023a

質問済み:

2023 年 5 月 4 日

コメント済み:

2023 年 5 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by